@@ -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
323324class 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
0 commit comments