]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/rook: add StorageV1Api and storage_class_name to RookCluster
authorJoseph Sawaya <jsawaya@redhat.com>
Wed, 30 Jun 2021 20:22:02 +0000 (16:22 -0400)
committerJoseph Sawaya <jsawaya@redhat.com>
Tue, 13 Jul 2021 17:55:05 +0000 (13:55 -0400)
This commit adds the Kubernetes Python client StorageV1Api and
the storage_class_name Rook module option to the RookCluster class.

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

index d0df716f82c72d8e772ded7638009fc8004c0d44..8778086d2eced2f686f800cb56c13c5aa39c631a 100644 (file)
@@ -177,11 +177,15 @@ class RookOrchestrator(MgrModule, orchestrator.Orchestrator):
             # Ignore here to make self.available() fail with a proper error message
             pass
 
+        assert isinstance(self.storage_class_name, str)
+
         self._rook_cluster = RookCluster(
             self._k8s_CoreV1_api,
             self._k8s_BatchV1_api,
             self._k8s_CustomObjects_api,
-            self._rook_env)
+            self._k8s_StorageV1_api,
+            self._rook_env,
+            self.storage_class_name)
 
         self._initialized.set()
 
index ecb90c06aacc132a00b754394450698a3c4577a2..0c2bf8c0bf4ca1d2925b4ab02e36f8f0de06c854 100644 (file)
@@ -198,11 +198,13 @@ class KubernetesResource(Generic[T]):
 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', rook_env: 'RookEnv'):
+    def __init__(self, coreV1_api: 'client.CoreV1Api', batchV1_api: 'client.BatchV1Api', customObjects_api: 'client.CustomObjectsApi', storageV1_api: 'client.StorageV1Api', rook_env: 'RookEnv', storage_class_name: '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.storage_class_name = storage_class_name # type: str
 
         #  TODO: replace direct k8s calls with Rook API calls
         # when they're implemented