k8sclient

package
v0.0.21 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2024 License: GPL-3.0 Imports: 11 Imported by: 4

Documentation

Index

Constants

View Source
const (
	// GroupAPI is the group API scope use in this package
	GroupAPI = "sxlibs.k8s.startx.fr"
	// GroupName is the group name use in this package
	GroupName = "k8sclient"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type K8sClient

type K8sClient struct {
	*kubernetes.Clientset
	// contains filtered or unexported fields
}

K8sClient represents a wrapper around the Kubernetes clientset.

func NewK8sClient

func NewK8sClient(kubeconfigpath string, isOpenshift bool) *K8sClient

Initialize a K8sClient object ex:

k8sclient := kc.NewK8sClient()

func (*K8sClient) Debug

func (kc *K8sClient) Debug() *K8sClient

Return a display of the current object ex:

kc.Debug()

func (*K8sClient) GetConfig added in v0.0.11

func (kc *K8sClient) GetConfig() *rest.Config

Return the config resource ex:

kc.Debug()

func (*K8sClient) GetCurrentNamespace

func (kc *K8sClient) GetCurrentNamespace() string

Return the name of the current namespace ex:

namespace := kc.GetCurrentNamespace()

func (*K8sClient) GetKubeconfigPath

func (kc *K8sClient) GetKubeconfigPath() string

Return the name of the kubeconfig path ex:

kubeconfigpath := kc.GetKubeconfigPath()

func (*K8sClient) GetKubeconfigToken added in v0.0.21

func (kc *K8sClient) GetKubeconfigToken() (string, error)

Get the token from the kubeconfig used

func (*K8sClient) IsConnected

func (kc *K8sClient) IsConnected() bool

ConnectToCluster establishes a connection to the Kubernetes cluster.

func (*K8sClient) ListAllMatchingNamespaces

func (kc *K8sClient) ListAllMatchingNamespaces(pattern string) ([]string, error)

Return the list of all the namespaces matching the pattern ex:

namespaces := kc.ListAllMatchingNamespaces("*dev*")

func (*K8sClient) ListAllNamespaces

func (kc *K8sClient) ListAllNamespaces() ([]string, error)

Return the list of all the namespaces ex:

namespaces := kc.ListAllNamespaces()

func (*K8sClient) NewOCPClientSet added in v0.0.19

func (kc *K8sClient) NewOCPClientSet() (*ocpcs.Clientset, error)

newOcpClientSet creates a new openshift clientset.

Jump to

Keyboard shortcuts

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