From 388bb40b71121f5ea902986b6020c4e268373ce5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Lalinsk=C3=BD?= Date: Tue, 28 Feb 2023 10:07:27 +0100 Subject: [PATCH] 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. --- patroni/dcs/kubernetes.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/patroni/dcs/kubernetes.py b/patroni/dcs/kubernetes.py index 736b93aa..80afb0ff 100644 --- a/patroni/dcs/kubernetes.py +++ b/patroni/dcs/kubernetes.py @@ -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