Skip to content

Commit a00ae57

Browse files
committed
Make CRD API group configurable
1 parent b364de3 commit a00ae57

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

patroni/multisite.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ def __init__(self, config, on_change=None):
8989
if msconfig.get('update_crd'):
9090
self._state_updater = KubernetesStateManagement(msconfig.get('update_crd'),
9191
msconfig.get('crd_uid'),
92-
reporter=self.name) # Use pod name?
92+
reporter=self.name, # Use pod name?
93+
crd_api=msconfig.get('crd_api', 'acid.zalan.do/v1'))
9394
else:
9495
self._state_updater = None
9596

@@ -321,10 +322,11 @@ def shutdown(self):
321322

322323

323324
class KubernetesStateManagement:
324-
def __init__(self, crd_name, crd_uid, reporter):
325+
def __init__(self, crd_name, crd_uid, reporter, crd_api):
325326
self.crd_namespace, self.crd_name = (['default'] + crd_name.rsplit('.', 1))[-2:]
326327
self.crd_uid = crd_uid
327328
self.reporter = reporter
329+
self.crd_api_group, self.crd_api_version = crd_api.rsplit('/', 1)
328330

329331
# TODO: handle config loading when main DCS is not Kubernetes based
330332
#apiclient = k8s_client.ApiClient(False)
@@ -374,7 +376,7 @@ def store_updates(self):
374376

375377
@catch_kubernetes_errors
376378
def update_crd_state(self, update):
377-
self._customobj_api.patch_namespaced_custom_object_status('acid.zalan.do', 'v1', self.crd_namespace,
379+
self._customobj_api.patch_namespaced_custom_object_status(self.crd_api_group, self.crd_api_version, self.crd_namespace,
378380
'postgresqls', self.crd_name + '/status', update,
379381
field_manager='patroni')
380382

patroni/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
33
:var __version__: the current Patroni version.
44
"""
5-
__version__ = '4.0.2.0'
5+
__version__ = '4.0.2.1'

0 commit comments

Comments
 (0)