kubernetesclient

package
v0.1.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 21, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type K8SClientInterface

type K8SClientInterface interface {
	GetConfig() *rest.Config
	GetDiscoveryClient() (*discovery.DiscoveryClient, error)
	GetDynamicClient() (dynamic.Interface, error)
	GetMetricsClient() (*metrics.Clientset, error)
	GetSecret(namespace string, name string) (*v1.Secret, error)
	GetNodes() ([]v1.Node, error)
}

type K8sClientsets

type K8sClientsets struct {
	// contains filtered or unexported fields
}

K8sClientsets represents a collection of Kubernetes clientsets.

func NewK8sClientConfig

func NewK8sClientConfig() *K8sClientsets

NewK8sClientConfig initializes a new instance of the K8sClientsets struct with the Kubernetes configuration.

Returns: - (*K8sClientsets): The initialized K8sClientsets object.

func (*K8sClientsets) GetConfig

func (c *K8sClientsets) GetConfig() *rest.Config

GetConfig retrieves the Kubernetes configuration.

Returns: - (*rest.Config): The Kubernetes configuration.

func (*K8sClientsets) GetDiscoveryClient

func (c *K8sClientsets) GetDiscoveryClient() (*discovery.DiscoveryClient, error)

GetDiscoveryClient returns the Kubernetes discovery client for retrieving API server information. If the discovery client has not been initialized, it creates a new client using the provided Kubernetes configuration.

Returns: - (discovery.DiscoveryInterface): The discovery client. - (error): An error if the discovery client creation fails.

func (*K8sClientsets) GetDynamicClient

func (c *K8sClientsets) GetDynamicClient() (dynamic.Interface, error)

GetDynamicClient returns the dynamic client for interacting with Kubernetes resources. If the dynamic client has not been initialized, it creates a new client using the provided Kubernetes configuration.

Returns: - (dynamic.Interface): The dynamic client. - (error): An error if the dynamic client creation fails.

func (*K8sClientsets) GetKubernetesClientset

func (c *K8sClientsets) GetKubernetesClientset() (*kubernetes.Clientset, error)

GetKubernetesClientset returns a Kubernetes clientset for interacting with the Kubernetes API.

Parameters: - kubeconfigPath (string): The path to the Kubernetes configuration file.

Returns: - (*kubernetes.Clientset): The Kubernetes clientset. - (error): An error if the clientset creation fails.

func (*K8sClientsets) GetMetricsClient

func (c *K8sClientsets) GetMetricsClient() (*metrics.Clientset, error)

GetMetricsClient returns the metrics client for interacting with Kubernetes metrics. If the metrics client has not been initialized, it creates a new client using the provided Kubernetes configuration.

Returns: - (*metrics.Clientset): The metrics clientset. - (error): An error if the metrics client creation fails.

func (*K8sClientsets) GetNamespace

func (c *K8sClientsets) GetNamespace(namespace string) (*v1.Namespace, error)

GetNamespace retrieves a Kubernetes namespace by its name using the provided clientsets.

func (*K8sClientsets) GetNodes

func (c *K8sClientsets) GetNodes() ([]v1.Node, error)

GetNodes retrieves the list of Kubernetes nodes using the provided clientsets.

Parameters: - c (*K8sClientsets): The K8sClientsets object that contains the necessary clientsets for interacting with nodes.

Returns: - ([]corev1.Node, error): The list of retrieved nodes and an error if the retrieval fails.

func (*K8sClientsets) GetSecret

func (c *K8sClientsets) GetSecret(namespace string, name string) (*v1.Secret, error)

GetSecret retrieves a Kubernetes secret by its name and namespace using the provided clientsets.

Parameters: - c (*K8sClientsets): The K8sClientsets object that contains the necessary clientsets for interacting with secrets. - name (string): The name of the secret to retrieve. - namespace (string): The namespace of the secret.

Returns: - (*corev1.Secret): The retrieved secret. - (error): An error if the secret retrieval fails.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL