From a6c6c114afa9cdc89508ae90bbe837421914d342 Mon Sep 17 00:00:00 2001 From: Varsha Rao Date: Thu, 17 Sep 2020 12:29:40 +0530 Subject: [PATCH] mgr/rook: Pass pod namespace to list_namespaced_pod() As list_namespaced_pod method requires pod namespace instead of cluster name. Fixes: https://tracker.ceph.com/issues/47511 Signed-off-by: Varsha Rao --- src/pybind/mgr/rook/module.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/pybind/mgr/rook/module.py b/src/pybind/mgr/rook/module.py index 64fcff99c8d90..984f474022bc5 100644 --- a/src/pybind/mgr/rook/module.py +++ b/src/pybind/mgr/rook/module.py @@ -126,7 +126,7 @@ class RookOrchestrator(MgrModule, orchestrator.Orchestrator): return False, "ceph-mgr not running in Rook cluster" try: - self.k8s.list_namespaced_pod(self._rook_env.cluster_name) + self.k8s.list_namespaced_pod(self._rook_env.namespace) except ApiException as e: return False, "Cannot reach Kubernetes API: {}".format(e) else: @@ -169,13 +169,10 @@ class RookOrchestrator(MgrModule, orchestrator.Orchestrator): if self._rook_env.has_namespace(): config.load_incluster_config() - cluster_name = self._rook_env.cluster_name else: self.log.warning("DEVELOPMENT ONLY: Reading kube config from ~") config.load_kube_config() - cluster_name = "rook-ceph" - # So that I can do port forwarding from my workstation - jcsp from kubernetes.client import configuration configuration.verify_ssl = False @@ -188,7 +185,7 @@ class RookOrchestrator(MgrModule, orchestrator.Orchestrator): # this context, or subsequent API usage from handle_command # fails with SSLError('bad handshake'). Suspect some kind of # thread context setup in SSL lib? - self._k8s_CoreV1_api.list_namespaced_pod(cluster_name) + self._k8s_CoreV1_api.list_namespaced_pod(self._rook_env.namespace) except ApiException: # Ignore here to make self.available() fail with a proper error message pass -- 2.39.5