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 <guilherme.santos@windriver.com>
This commit is contained in:
Guilherme Santos 2024-03-19 12:29:25 -03:00 committed by Eduardo Alberti
parent 2a072b65c5
commit 9a564e455e
1 changed files with 7 additions and 0 deletions

View File

@ -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))