k8sutils

package
v2.14.1 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// NodeLabelsRetriever is the actual instance of NodeLabelsRetrieverInterface which is used to retrieve the node labels
	NodeLabelsRetriever NodeLabelsRetrieverInterface
	NodeLabelsModifier  NodeLabelsModifierInterface
	// Kube Clientset
	Clientset kubernetes.Interface
)

Functions

func AddNVMeLabels

func AddNVMeLabels(ctx context.Context, kubeConfigPath string, kubeNodeName string, labelKey string, labelValue []string) error

AddNVMeLabels adds a hostnqn uuid label in the k8s node

func CreateKubeClientSet

func CreateKubeClientSet(kubeconfig string) error

CreateKubeClientSet creates kubeclient set if not created already

func GetNVMeUUIDs

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

GetNVMeUUIDs checks for duplicate hostnqn uuid labels in the k8s node

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 NodeLabelsModifierImpl

type NodeLabelsModifierImpl struct{}

NodeLabelsModifierImpl provides the implementation for NodeLabelsModifierInterface

func (*NodeLabelsModifierImpl) AddNVMeLabels

func (svc *NodeLabelsModifierImpl) AddNVMeLabels(ctx context.Context, kubeNodeName string, labelKey string, labelValue []string) error

AddNVMeLabels adds a hostnqn uuid label to the specified Kubernetes node

type NodeLabelsModifierInterface

type NodeLabelsModifierInterface interface {
	AddNVMeLabels(ctx context.Context, kubeNodeName string, labelKey string, labelValue []string) error
}

NodeLabelsModifierInterface defines the methods for retrieving Kubernetes Node Labels

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) GetNVMeUUIDs

func (svc *NodeLabelsRetrieverImpl) GetNVMeUUIDs(ctx context.Context) (map[string]string, error)

GetNVMeUUIDs returns map of hosts with their hostnqn uuids

func (*NodeLabelsRetrieverImpl) GetNodeLabels

func (svc *NodeLabelsRetrieverImpl) GetNodeLabels(ctx context.Context, 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, kubeNodeName string) (map[string]string, error)
	GetNVMeUUIDs(ctx context.Context) (map[string]string, error)
}

NodeLabelsRetrieverInterface defines the methods for retrieving Kubernetes Node Labels

Jump to

Keyboard shortcuts

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