codeflare_sdk.common.kubernetes_cluster package
Submodules
codeflare_sdk.common.kubernetes_cluster.auth module
The auth sub-module contains the definitions for the Authentication objects, which represent the methods by which a user can authenticate to their cluster(s). The abstract class, Authentication, contains two required methods login() and logout(). Users can use one of the existing concrete classes to authenticate to their cluster or add their own custom concrete classes here.
- class codeflare_sdk.common.kubernetes_cluster.auth.Authentication[source]
Bases:
object
An abstract class that defines the necessary methods for authenticating to a remote environment. Specifically, this class defines the need for a login() and a logout() function.
- class codeflare_sdk.common.kubernetes_cluster.auth.KubeConfigFileAuthentication(kube_config_path: str | None = None)[source]
Bases:
KubeConfiguration
A class that defines the necessary methods for passing a user’s own Kubernetes config file. Specifically this class defines the load_kube_config() and config_check() functions.
- class codeflare_sdk.common.kubernetes_cluster.auth.KubeConfiguration[source]
Bases:
object
An abstract class that defines the method for loading a user defined config file using the load_kube_config() function
- class codeflare_sdk.common.kubernetes_cluster.auth.TokenAuthentication(token: str, server: str, skip_tls: bool = False, ca_cert_path: str | None = None)[source]
Bases:
Authentication
TokenAuthentication is a subclass of Authentication. It can be used to authenticate to a Kubernetes cluster when the user has an API token and the API server address.
- login() str [source]
This function is used to log in to a Kubernetes cluster using the user’s API token and API server address. Depending on the cluster, a user can choose to login in with –insecure-skip-tls-verify by setting skip_tls to True or –certificate-authority by setting skip_tls to False and providing a path to a ca bundle with ca_cert_path.
- codeflare_sdk.common.kubernetes_cluster.auth.config_check() str [source]
Check and load the Kubernetes config from the default location.
This function checks if a Kubernetes config file exists at the default path (~/.kube/config). If none is provided, it tries to load in-cluster config. If the config_path global variable is set by an external module (e.g., auth.py), this path will be used directly.
- Returns:
- str:
The loaded config path if successful.
- Raises:
- PermissionError:
If no valid credentials or config file is found.
- codeflare_sdk.common.kubernetes_cluster.auth.get_api_client() ApiClient [source]
Retrieve the Kubernetes API client with the default configuration.
This function returns the current API client instance if already loaded, or creates a new API client with the default configuration.
- Returns:
- client.ApiClient:
The Kubernetes API client object.
codeflare_sdk.common.kubernetes_cluster.kube_api_helpers module
This sub-module exists primarily to be used internally for any Kubernetes API error handling or wrapping.