]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/rook: Pass pod namespace to list_namespaced_pod()
authorVarsha Rao <varao@redhat.com>
Thu, 17 Sep 2020 06:59:40 +0000 (12:29 +0530)
committerNathan Cutler <ncutler@suse.com>
Tue, 6 Oct 2020 09:40:53 +0000 (11:40 +0200)
As list_namespaced_pod method requires pod namespace instead of cluster name.

Fixes: https://tracker.ceph.com/issues/47511
Signed-off-by: Varsha Rao <varao@redhat.com>
(cherry picked from commit a6c6c114afa9cdc89508ae90bbe837421914d342)

src/pybind/mgr/rook/module.py

index daebe31899f89abec2d8a68034ff2b60f8635d52..68763eb4ed42f519aee3d5175610b6d7a1502ae2 100644 (file)
@@ -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