diff --git a/docs/detailed-documentation/cluster/auth.html b/docs/detailed-documentation/cluster/auth.html index 61d199e52..d35b46093 100644 --- a/docs/detailed-documentation/cluster/auth.html +++ b/docs/detailed-documentation/cluster/auth.html @@ -126,17 +126,7 @@
codeflare_sdk.cluster.auth
codeflare_sdk.cluster.auth
codeflare_sdk.cluster.auth
codeflare_sdk.cluster.auth
-def api_config_handler() ‑> Optional[kubernetes.client.api_client.ApiClient]
-
This function is used to load the api client if the user has logged in
def api_config_handler() -> Optional[client.ApiClient]:
- """
- This function is used to load the api client if the user has logged in
- """
- if api_client != None and config_path == None:
- return api_client
- else:
- return None
-
def config_check() ‑> str
+def get_api_client() ‑> kubernetes.client.api_client.ApiClient
+
This function should load the api client with defaults
def get_api_client() -> client.ApiClient:
+ "This function should load the api client with defaults"
+ if api_client != None:
+ return api_client
+ to_return = client.ApiClient()
+ _client_with_cert(to_return)
+ return to_return
+codeflare_sdk.cluster.awload
codeflare_sdk.cluster.awload
codeflare_sdk.cluster.awload
codeflare_sdk.cluster.cluster
codeflare_sdk.cluster.cluster
codeflare_sdk.cluster.cluster
codeflare_sdk.cluster.cluster
codeflare_sdk.cluster.cluster
codeflare_sdk.cluster.cluster
codeflare_sdk.cluster.cluster
codeflare_sdk.cluster.cluster
codeflare_sdk.cluster.cluster
codeflare_sdk.cluster.cluster
codeflare_sdk.cluster.cluster
codeflare_sdk.cluster.cluster
codeflare_sdk.cluster.cluster
codeflare_sdk.cluster.cluster
codeflare_sdk.cluster.cluster
codeflare_sdk.cluster.cluster
codeflare_sdk.cluster.cluster
codeflare_sdk.cluster.cluster
codeflare_sdk.cluster.cluster
@property
def job_client(self):
- k8client = api_config_handler() or client.ApiClient()
+ k8client = get_api_client()
if self._job_submission_client:
return self._job_submission_client
if is_openshift_cluster():
@@ -1641,7 +1635,7 @@ Methods
config_check()
if is_openshift_cluster():
try:
- api_instance = client.CustomObjectsApi(api_config_handler())
+ api_instance = client.CustomObjectsApi(get_api_client())
routes = api_instance.list_namespaced_custom_object(
group="route.openshift.io",
version="v1",
@@ -1663,7 +1657,7 @@ Methods
return f"{protocol}://{route['spec']['host']}"
else:
try:
- api_instance = client.NetworkingV1Api(api_config_handler())
+ api_instance = client.NetworkingV1Api(get_api_client())
ingresses = api_instance.list_namespaced_ingress(self.config.namespace)
except Exception as e: # pragma no cover
return _kube_api_error_handling(e)
@@ -1762,7 +1756,7 @@ Methods
self._throw_for_no_raycluster()
try:
config_check()
- api_instance = client.CustomObjectsApi(api_config_handler())
+ api_instance = client.CustomObjectsApi(get_api_client())
if self.config.appwrapper:
api_instance.delete_namespaced_custom_object(
group="workload.codeflare.dev",
@@ -2046,7 +2040,7 @@ Methods
try:
config_check()
- api_instance = client.CustomObjectsApi(api_config_handler())
+ api_instance = client.CustomObjectsApi(get_api_client())
if self.config.appwrapper:
if self.config.write_to_file:
with open(self.app_wrapper_yaml) as f:
diff --git a/docs/detailed-documentation/cluster/widgets.html b/docs/detailed-documentation/cluster/widgets.html
index e07fa2ea2..b0334903f 100644
--- a/docs/detailed-documentation/cluster/widgets.html
+++ b/docs/detailed-documentation/cluster/widgets.html
@@ -58,7 +58,7 @@ Module codeflare_sdk.cluster.widgets
from .config import ClusterConfiguration
from .model import RayClusterStatus
from ..utils.kube_api_helpers import _kube_api_error_handling
-from .auth import config_check, api_config_handler
+from .auth import config_check, get_api_client
def cluster_up_down_buttons(cluster: "codeflare_sdk.cluster.Cluster") -> widgets.Button:
@@ -372,7 +372,7 @@ Module codeflare_sdk.cluster.widgets
try:
config_check()
- api_instance = client.CustomObjectsApi(api_config_handler())
+ api_instance = client.CustomObjectsApi(get_api_client())
if _check_aw_exists(cluster_name, namespace):
api_instance.delete_namespaced_custom_object(
diff --git a/docs/detailed-documentation/utils/generate_cert.html b/docs/detailed-documentation/utils/generate_cert.html
index 176584c40..01084d84f 100644
--- a/docs/detailed-documentation/utils/generate_cert.html
+++ b/docs/detailed-documentation/utils/generate_cert.html
@@ -47,7 +47,7 @@ Module codeflare_sdk.utils.generate_cert
from cryptography import x509
from cryptography.x509.oid import NameOID
import datetime
-from ..cluster.auth import config_check, api_config_handler
+from ..cluster.auth import config_check, get_api_client
from kubernetes import client, config
from .kube_api_helpers import _kube_api_error_handling
@@ -131,7 +131,7 @@ Module codeflare_sdk.utils.generate_cert
# oc get secret ca-secret-<cluster-name> -o template='{{index .data "ca.key"}}'
# oc get secret ca-secret-<cluster-name> -o template='{{index .data "ca.crt"}}'|base64 -d > ${TLSDIR}/ca.crt
config_check()
- v1 = client.CoreV1Api(api_config_handler())
+ v1 = client.CoreV1Api(get_api_client())
# Secrets have a suffix appended to the end so we must list them and gather the secret that includes cluster_name-ca-secret-
secret_name = get_secret_name(cluster_name, namespace, v1)
@@ -316,7 +316,7 @@ Functions
# oc get secret ca-secret-<cluster-name> -o template='{{index .data "ca.key"}}'
# oc get secret ca-secret-<cluster-name> -o template='{{index .data "ca.crt"}}'|base64 -d > ${TLSDIR}/ca.crt
config_check()
- v1 = client.CoreV1Api(api_config_handler())
+ v1 = client.CoreV1Api(get_api_client())
# Secrets have a suffix appended to the end so we must list them and gather the secret that includes cluster_name-ca-secret-
secret_name = get_secret_name(cluster_name, namespace, v1)
diff --git a/docs/detailed-documentation/utils/generate_yaml.html b/docs/detailed-documentation/utils/generate_yaml.html
index 60ce89dfe..c2a7bb347 100644
--- a/docs/detailed-documentation/utils/generate_yaml.html
+++ b/docs/detailed-documentation/utils/generate_yaml.html
@@ -58,7 +58,7 @@ Module codeflare_sdk.utils.generate_yaml
import uuid
from kubernetes import client, config
from .kube_api_helpers import _kube_api_error_handling
-from ..cluster.auth import api_config_handler, config_check
+from ..cluster.auth import get_api_client, config_check
from os import urandom
from base64 import b64encode
from urllib3.util import parse_url
@@ -88,7 +88,7 @@ Module codeflare_sdk.utils.generate_yaml
def is_openshift_cluster():
try:
config_check()
- for api in client.ApisApi(api_config_handler()).get_api_versions().groups:
+ for api in client.ApisApi(get_api_client()).get_api_versions().groups:
for v in api.versions:
if "route.openshift.io/v1" in v.group_version:
return True
@@ -266,7 +266,7 @@ Module codeflare_sdk.utils.generate_yaml
# If the local queue is set, use it. Otherwise, try to use the default queue.
try:
config_check()
- api_instance = client.CustomObjectsApi(api_config_handler())
+ api_instance = client.CustomObjectsApi(get_api_client())
local_queues = api_instance.list_namespaced_custom_object(
group="kueue.x-k8s.io",
version="v1beta1",
@@ -292,7 +292,7 @@ Module codeflare_sdk.utils.generate_yaml
# get all local queues in the namespace
try:
config_check()
- api_instance = client.CustomObjectsApi(api_config_handler())
+ api_instance = client.CustomObjectsApi(get_api_client())
local_queues = api_instance.list_namespaced_custom_object(
group="kueue.x-k8s.io",
version="v1beta1",
@@ -514,7 +514,7 @@ Functions
# If the local queue is set, use it. Otherwise, try to use the default queue.
try:
config_check()
- api_instance = client.CustomObjectsApi(api_config_handler())
+ api_instance = client.CustomObjectsApi(get_api_client())
local_queues = api_instance.list_namespaced_custom_object(
group="kueue.x-k8s.io",
version="v1beta1",
@@ -627,7 +627,7 @@ Functions
def is_openshift_cluster():
try:
config_check()
- for api in client.ApisApi(api_config_handler()).get_api_versions().groups:
+ for api in client.ApisApi(get_api_client()).get_api_versions().groups:
for v in api.versions:
if "route.openshift.io/v1" in v.group_version:
return True
@@ -650,7 +650,7 @@ Functions
# get all local queues in the namespace
try:
config_check()
- api_instance = client.CustomObjectsApi(api_config_handler())
+ api_instance = client.CustomObjectsApi(get_api_client())
local_queues = api_instance.list_namespaced_custom_object(
group="kueue.x-k8s.io",
version="v1beta1",