]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/rook: add AppsV1Api to Rook Orchestrator
authorJoseph Sawaya <jsawaya@redhat.com>
Wed, 28 Jul 2021 17:11:32 +0000 (13:11 -0400)
committerJoseph Sawaya <jsawaya@redhat.com>
Thu, 19 Aug 2021 20:01:51 +0000 (16:01 -0400)
This commit adds the AppsV1Api to the Rook Orchestrator module to
scale and delete deployments.

Signed-off-by: Joseph Sawaya <jsawaya@redhat.com>
src/pybind/mgr/rook/module.py
src/pybind/mgr/rook/rook_cluster.py

index e1066340c63b8b1dd431481d112dcfff2a017ef0..ecbb591dfb0754e9b04ac912d044b1b89e883da5 100644 (file)
@@ -112,6 +112,7 @@ class RookOrchestrator(MgrModule, orchestrator.Orchestrator):
         self._k8s_StorageV1_api: Optional[client.StorageV1Api] = None
         self._rook_cluster: Optional[RookCluster] = None
         self._rook_env = RookEnv()
+        self._k8s_AppsV1_api: Optional[client.AppsV1Api] = None
         self.storage_class = self.get_module_option('storage_class')
 
         self._shutdown = threading.Event()
@@ -167,6 +168,7 @@ class RookOrchestrator(MgrModule, orchestrator.Orchestrator):
         self._k8s_BatchV1_api = client.BatchV1Api()
         self._k8s_CustomObjects_api = client.CustomObjectsApi()
         self._k8s_StorageV1_api = client.StorageV1Api()
+        self._k8s_AppsV1_api = client.AppsV1Api()
 
         try:
             # XXX mystery hack -- I need to do an API call from
@@ -185,6 +187,7 @@ class RookOrchestrator(MgrModule, orchestrator.Orchestrator):
             self._k8s_BatchV1_api,
             self._k8s_CustomObjects_api,
             self._k8s_StorageV1_api,
+            self._k8s_AppsV1_api,
             self._rook_env,
             self.storage_class)
 
index 3ba5a226eeb1368859d7a98b17b26c953cfae8f1..18bf853ff390fc02bf2313db95aac510ef1d8fed 100644 (file)
@@ -267,7 +267,6 @@ class KubernetesResource(Generic[T]):
                     raise AttributeError(
                         "{} doesn't contain a metadata.name. Unable to track changes".format(
                             self.api_func)) 
-
     @threaded
     def _watch(self, res_ver: Optional[str]) -> None:
         """ worker thread that runs the kubernetes watch """
@@ -476,12 +475,13 @@ class LSOCreator(DefaultCreator):
 class RookCluster(object):
     # import of client.CoreV1Api must be optional at import time.
     # Instead allow mgr/rook to be imported anyway.
-    def __init__(self, coreV1_api: 'client.CoreV1Api', batchV1_api: 'client.BatchV1Api', customObjects_api: 'client.CustomObjectsApi', storageV1_api: 'client.StorageV1Api', rook_env: 'RookEnv', storage_class: 'str'):
+    def __init__(self, coreV1_api: 'client.CoreV1Api', batchV1_api: 'client.BatchV1Api', customObjects_api: 'client.CustomObjectsApi', storageV1_api: 'client.StorageV1Api', appsV1_api: 'client.AppsV1Api', rook_env: 'RookEnv', storage_class: 'str'):
         self.rook_env = rook_env  # type: RookEnv
         self.coreV1_api = coreV1_api  # client.CoreV1Api
         self.batchV1_api = batchV1_api
         self.customObjects_api = customObjects_api
         self.storageV1_api = storageV1_api  # client.StorageV1Api
+        self.appsV1_api = appsV1_api  # client.AppsV1Api
         self.storage_class = storage_class # type: str
 
         #  TODO: replace direct k8s calls with Rook API calls