bemade-addons/k8s_odoo_manager/data/k8s_data.xml
Marc Durepos 9019d8f280 k8s_odoo_manager: first little MVP
- Adds the k8s.cluster and k8s.odoo.instance models
- Successful connection test (ignoring SSL self-signed cert error)
- Successfully pulls OdooInstance information from the cluster

Further work roadmap:

- Fix the SSL issue (cluster-side, most likely)
- Get rid of the text fields containing straight JSON and convert to
  appropriately typed Odoo fields (on read).
- Allow updating OdooInstance fields and writing patches back to the
  cluster. Failed patch should result in a failed write and reverting
  back to actual cluster status.
2025-10-01 20:32:46 -04:00

47 lines
1.7 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- Default data for the module -->
<!-- Cron job for periodic sync -->
<record id="cron_k8s_sync_instances" model="ir.cron">
<field name="name">Sync Kubernetes Odoo Instances</field>
<field name="model_id" ref="model_k8s_cluster"/>
<field name="state">code</field>
<field name="code">model.cron_sync_all_clusters()</field>
<field name="interval_number">15</field>
<field name="interval_type">minutes</field>
<field name="active" eval="False"/>
<field name="user_id" ref="base.user_root"/>
</record>
<!-- Server actions -->
<record id="action_server_sync_all_clusters" model="ir.actions.server">
<field name="name">Sync All Clusters</field>
<field name="model_id" ref="model_k8s_cluster"/>
<field name="binding_model_id" ref="model_k8s_cluster"/>
<field name="binding_view_types">list</field>
<field name="state">code</field>
<field name="code">
# Sync selected clusters
for record in records.filtered('active'):
try:
record.sync_odoo_instances()
except Exception as e:
# Continue with other clusters even if one fails
pass
</field>
</record>
<record id="action_server_test_cluster_connection" model="ir.actions.server">
<field name="name">Test Connection</field>
<field name="model_id" ref="model_k8s_cluster"/>
<field name="binding_model_id" ref="model_k8s_cluster"/>
<field name="binding_view_types">list</field>
<field name="state">code</field>
<field name="code">
# Test connection for selected clusters
for record in records:
record.test_connection()
</field>
</record>
</odoo>