From 9a564e455e4b2f5c5e05207d5b0ec241302fbce4 Mon Sep 17 00:00:00 2001 From: Guilherme Santos Date: Tue, 19 Mar 2024 12:29:25 -0300 Subject: [PATCH] Expose Kubernetes ApiextensionsV1Api This commit exposes the Kubernetes API extensions in order to allow StarlingX Applications to manage CRDs using API calls. Test Plan: PASS: AIO-SX host-lock and host-unlock run successfully. PASS: Exposed resources have been called from an Application and run accordingly. Story: 2011069 Task: 49756 Change-Id: I7d04d3e779dae9ebf95403c8afb93fe6d048993b Signed-off-by: Guilherme Santos --- sysinv/sysinv/sysinv/sysinv/common/kubernetes.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sysinv/sysinv/sysinv/sysinv/common/kubernetes.py b/sysinv/sysinv/sysinv/sysinv/common/kubernetes.py index a757b47268..6da88373ce 100644 --- a/sysinv/sysinv/sysinv/sysinv/common/kubernetes.py +++ b/sysinv/sysinv/sysinv/sysinv/common/kubernetes.py @@ -381,6 +381,7 @@ class KubeOperator(object): self._kube_client_custom_objects = None self._kube_client_admission_registration = None self._kube_client_rbac_authorization = None + self._kube_client_extensions = None def _load_kube_config(self): if not is_k8s_configured(): @@ -435,6 +436,12 @@ class KubeOperator(object): self._kube_client_rbac_authorization = client.RbacAuthorizationV1Api() return self._kube_client_rbac_authorization + def _get_kubernetesclient_extensions(self): + if not self._kube_client_extensions: + self._load_kube_config() + self._kube_client_extensions = client.ApiextensionsV1Api() + return self._kube_client_extensions + def _retry_on_urllibs3_MaxRetryError(ex): # pylint: disable=no-self-argument if isinstance(ex, MaxRetryError): LOG.warn('Retrying against MaxRetryError: {}'.format(ex))