k8sutils

package
v2.10.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateKubeClientSet

func CreateKubeClientSet(kubeconfig string) (*kubernetes.Clientset, error)

CreateKubeClientSet creates and returns kubeclient set

func GetNodeLabels

func GetNodeLabels(ctx context.Context, kubeConfigPath string, kubeNodeName string) (map[string]string, error)

GetNodeLabels returns labels present in the k8s node

Types

type NodeLabelsRetrieverImpl

type NodeLabelsRetrieverImpl struct{}

NodeLabelsRetrieverImpl provided the implementation for NodeLabelsRetrieverInterface

func (*NodeLabelsRetrieverImpl) BuildConfigFromFlags

func (svc *NodeLabelsRetrieverImpl) BuildConfigFromFlags(masterURL, kubeconfig string) (*rest.Config, error)

BuildConfigFromFlags is a method for building kubernetes client config

func (*NodeLabelsRetrieverImpl) GetNodeLabels

func (svc *NodeLabelsRetrieverImpl) GetNodeLabels(ctx context.Context, k8sclientset *kubernetes.Clientset, kubeNodeName string) (map[string]string, error)

GetNodeLabels retrieves the kubernetes node object and returns its labels

func (*NodeLabelsRetrieverImpl) InClusterConfig

func (svc *NodeLabelsRetrieverImpl) InClusterConfig() (*rest.Config, error)

InClusterConfig returns a config object which uses the service account kubernetes gives to pods

func (*NodeLabelsRetrieverImpl) NewForConfig

func (svc *NodeLabelsRetrieverImpl) NewForConfig(config *rest.Config) (*kubernetes.Clientset, error)

NewForConfig creates a new Clientset for the given config

type NodeLabelsRetrieverInterface

type NodeLabelsRetrieverInterface interface {
	BuildConfigFromFlags(masterURL, kubeconfig string) (*rest.Config, error)
	InClusterConfig() (*rest.Config, error)
	NewForConfig(config *rest.Config) (*kubernetes.Clientset, error)
	GetNodeLabels(ctx context.Context, k8sclientset *kubernetes.Clientset, kubeNodeName string) (map[string]string, error)
}

NodeLabelsRetrieverInterface defines the methods for retrieving Kubernetes Node Labels

var NodeLabelsRetriever NodeLabelsRetrieverInterface

NodeLabelsRetriever is the actual instance of NodeLabelsRetrieverInterface which is used to retrieve the node labels

Jump to

Keyboard shortcuts

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