Fix patronictl switchover on Citus cluster running on Kubernetes (#2562)

The patronictl code tries to initialize DCS twice, first for the current Citus group and the second time for the selected group. However, kubernetes.py was overwriting the namespace config. As a result, after the second initialization patronictl was trying to work with the `default` namespace instead of the configured one.
This commit is contained in:
Lukáš Lalinský
2023-02-28 10:07:27 +01:00
committed by GitHub
parent 422047f105
commit 388bb40b71
+1 -2
View File
@@ -698,8 +698,7 @@ class Kubernetes(AbstractDCS):
self._namespace = config.get('namespace') or 'default'
self._role_label = config.get('role_label', 'role')
self._ca_certs = os.environ.get('PATRONI_KUBERNETES_CACERT', config.get('cacert')) or SERVICE_CERT_FILENAME
config['namespace'] = ''
super(Kubernetes, self).__init__(config)
super(Kubernetes, self).__init__({**config, 'namespace': ''})
if self._citus_group:
self._labels[self._CITUS_LABEL] = self._citus_group