k8sutils

package
v2.12.0 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NodeLabelsRetriever NodeLabelsRetrieverInterface
	NodeLabelsModifier  NodeLabelsModifierInterface
)

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

Functions

func AddNVMeLabels added in v2.12.0

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) (*kubernetes.Clientset, error)

CreateKubeClientSet creates and returns kubeclient set

func GetNVMeUUIDs added in v2.12.0

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 added in v2.12.0

type NodeLabelsModifierImpl struct{}

NodeLabelsModifierImpl provides the implementation for NodeLabelsModifierInterface

func (*NodeLabelsModifierImpl) AddNVMeLabels added in v2.12.0

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

AddNVMeLabels adds a hostnqn uuid label to the specified Kubernetes node

type NodeLabelsModifierInterface added in v2.12.0

type NodeLabelsModifierInterface interface {
	AddNVMeLabels(ctx context.Context, k8sclientset *kubernetes.Clientset, 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 added in v2.12.0

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

GetNVMeUUIDs returns map of hosts with their hostnqn uuids

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)
	GetNVMeUUIDs(ctx context.Context, k8sclientset *kubernetes.Clientset) (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