]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/rook: Pass pod namespace to list_namespaced_pod() 37213/head
authorVarsha Rao <varao@redhat.com>
Thu, 17 Sep 2020 06:59:40 +0000 (12:29 +0530)
committerVarsha Rao <varao@redhat.com>
Thu, 17 Sep 2020 07:41:35 +0000 (13:11 +0530)
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>
src/pybind/mgr/rook/module.py

index 64fcff99c8d90ee81d45ae57789e131113308250..984f474022bc59bb46579f2b304a563ba50cc160 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