Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileReaderFunc ¶ added in v2.2.6
FileReaderFunc defines a function signature for reading a file from a given path.
type KubernetesClient ¶
type KubernetesClient struct { Clientset kubernetes.Interface DynamicClient dynamic.Interface Config *rest.Config }
KubernetesClient wraps a clientset to interact with Kubernetes APIs.
**Attributes:**
Clientset: The clientset interface provided by client-go to interact with Kubernetes resources. DynamicClient: The dynamic client interface provided by client-go to interact with Kubernetes resources. Config: The kubeconfig configuration used to create the clientset and dynamic client.
func NewKubernetesClient ¶
func NewKubernetesClient(kubeconfig string, reader FileReaderFunc, client KubernetesClientInterface) (*KubernetesClient, error)
NewKubernetesClient creates a new KubernetesClient using the provided kubeconfig path and file reader function.
**Parameters:**
kubeconfig: Path to the kubeconfig file to configure access to the Kubernetes API. reader: A function to read the kubeconfig file from the specified path.
**Returns:**
*KubernetesClient: A new KubernetesClient instance configured with the specified kubeconfig. error: An error if any issue occurs while creating the Kubernetes client.
type KubernetesClientInterface ¶ added in v2.2.6
type KubernetesClientInterface interface { NewForConfig(config *rest.Config) (kubernetes.Interface, error) NewDynamicForConfig(config *rest.Config) (dynamic.Interface, error) RESTConfigFromKubeConfig(configData []byte) (*rest.Config, error) }
KubernetesClientInterface defines the interface for the KubernetesClient.
**Methods:**
NewForConfig: Creates a new clientset using the provided REST configuration. NewDynamicForConfig: Creates a new dynamic client using the provided REST configuration. RESTConfigFromKubeConfig: Creates a REST configuration from the provided kubeconfig data.
type RealKubernetesClient ¶ added in v2.2.6
type RealKubernetesClient struct{}
RealKubernetesClient implements the KubernetesClientInterface using the client-go library.
func (*RealKubernetesClient) NewDynamicForConfig ¶ added in v2.2.6
NewDynamicForConfig creates a new dynamic client using the provided REST configuration.
**Parameters:**
config: The REST configuration to use to create the dynamic client.
**Returns:**
dynamic.Interface: A new dynamic client instance created using the provided REST configuration. error: An error if any issue occurs while creating the dynamic client.
func (*RealKubernetesClient) NewForConfig ¶ added in v2.2.6
func (r *RealKubernetesClient) NewForConfig(config *rest.Config) (kubernetes.Interface, error)
NewForConfig creates a new clientset using the provided REST configuration.
**Parameters:**
config: The REST configuration to use to create the clientset.
**Returns:**
*kubernetes.Clientset: A new clientset instance created using the provided REST configuration. error: An error if any issue occurs while creating the clientset.
func (*RealKubernetesClient) RESTConfigFromKubeConfig ¶ added in v2.2.6
func (r *RealKubernetesClient) RESTConfigFromKubeConfig(configData []byte) (*rest.Config, error)
RESTConfigFromKubeConfig creates a REST configuration from the provided kubeconfig data.
**Parameters:**
configData: The kubeconfig data to use to create the REST configuration.
**Returns:**
*rest.Config: A new REST configuration instance created using the provided kubeconfig data. error: An error if any issue occurs while creating the REST configuration.