From abec0ef2f7a89b605cbc314078264eb0133ff946 Mon Sep 17 00:00:00 2001 From: Bobbins228 Date: Fri, 15 Sep 2023 13:40:45 +0100 Subject: [PATCH] Replaced load_kube_config() with config_check() --- src/codeflare_sdk/cluster/cluster.py | 6 +++--- src/codeflare_sdk/utils/generate_yaml.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/codeflare_sdk/cluster/cluster.py b/src/codeflare_sdk/cluster/cluster.py index b496ab6e4..88081a455 100644 --- a/src/codeflare_sdk/cluster/cluster.py +++ b/src/codeflare_sdk/cluster/cluster.py @@ -455,8 +455,8 @@ def get_current_namespace(): # pragma: no cover def get_cluster(cluster_name: str, namespace: str = "default"): try: - config.load_kube_config() - api_instance = client.CustomObjectsApi() + config_check() + api_instance = client.CustomObjectsApi(api_config_handler()) rcs = api_instance.list_namespaced_custom_object( group="ray.io", version="v1alpha1", @@ -477,7 +477,7 @@ def get_cluster(cluster_name: str, namespace: str = "default"): # private methods def _get_ingress_domain(): try: - config.load_kube_config() + config_check() api_client = client.CustomObjectsApi(api_config_handler()) ingress = api_client.get_cluster_custom_object( "config.openshift.io", "v1", "ingresses", "cluster" diff --git a/src/codeflare_sdk/utils/generate_yaml.py b/src/codeflare_sdk/utils/generate_yaml.py index f128ef8b1..54196fce8 100755 --- a/src/codeflare_sdk/utils/generate_yaml.py +++ b/src/codeflare_sdk/utils/generate_yaml.py @@ -23,7 +23,7 @@ import uuid from kubernetes import client, config from .kube_api_helpers import _kube_api_error_handling -from ..cluster.auth import api_config_handler +from ..cluster.auth import api_config_handler, config_check def read_template(template): @@ -268,7 +268,7 @@ def enable_local_interactive(resources, cluster_name, namespace): command = command.replace("deployment-name", cluster_name) try: - config.load_kube_config() + config_check() api_client = client.CustomObjectsApi(api_config_handler()) ingress = api_client.get_cluster_custom_object( "config.openshift.io", "v1", "ingresses", "cluster"