From: Joseph Sawaya Date: Wed, 30 Jun 2021 20:22:02 +0000 (-0400) Subject: mgr/rook: add StorageV1Api and storage_class_name to RookCluster X-Git-Tag: v17.1.0~1144^2~9 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d7ec31c1b87e7e50eb2a1a3c8f572d4e85398900;p=ceph.git mgr/rook: add StorageV1Api and storage_class_name to RookCluster 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 --- diff --git a/src/pybind/mgr/rook/module.py b/src/pybind/mgr/rook/module.py index d0df716f82c7..8778086d2ece 100644 --- a/src/pybind/mgr/rook/module.py +++ b/src/pybind/mgr/rook/module.py @@ -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() diff --git a/src/pybind/mgr/rook/rook_cluster.py b/src/pybind/mgr/rook/rook_cluster.py index ecb90c06aacc..0c2bf8c0bf4c 100644 --- a/src/pybind/mgr/rook/rook_cluster.py +++ b/src/pybind/mgr/rook/rook_cluster.py @@ -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