kubeutils

package
v0.0.0-...-a954c3e Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2023 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddOrUpdateTaint

func AddOrUpdateTaint(node *v1.Node, taint *v1.Taint) (*v1.Node, bool, error)

AddOrUpdateTaint tries to add a taint to annotations list. Returns a new copy of updated Node and true if something was updated false otherwise.

func GetClientset

func GetClientset() (kubernetes.Interface, error)

GetClientset returns clientset created from config

Types

type Utils

type Utils interface {
	GetNodeFromK8sApi(context.Context, string) (*v1.Node, error)
	AddLabelsToNode(context.Context, string, map[string]string) error
	AddAnnotationsToNode(context.Context, string, map[string]string) error
	RemoveAnnotationsFromNode(context.Context, string, []string) error
	AddTaintsToNode(context.Context, string, []*v1.Taint) error
	DrainNodeFromApiServer(context.Context, string) error
	UncordonNode(context.Context, string) error
	K8sApiAvailable(config.Config) error
	PreventAutoReattach() error
	IsInterfaceNil() bool
	EnsureDns(config.Config) error
	EnsureAppCatalog() error
	ApplyYamlConfigFiles([]string) error
	WriteCloudProviderConfig(config.Config) error
}

type UtilsImpl

type UtilsImpl struct {
	Clientset kubernetes.Interface
}

func NewClient

func NewClient() (*UtilsImpl, error)

NewCient initialize UtilsImpl with new creted clientset

func (*UtilsImpl) AddAnnotationsToNode

func (u *UtilsImpl) AddAnnotationsToNode(ctx context.Context, nodeName string, annotsToAdd map[string]string) error

AddAnnotationsToNode adds annotations to node

func (*UtilsImpl) AddLabelsToNode

func (u *UtilsImpl) AddLabelsToNode(ctx context.Context, nodeName string, labelsToAdd map[string]string) error

AddLabelsToNode adds labels to node

func (*UtilsImpl) AddTaintsToNode

func (u *UtilsImpl) AddTaintsToNode(ctx context.Context, nodeName string, taintsToAdd []*v1.Taint) error

AddTaintsToNode adds taints to node

func (*UtilsImpl) ApplyYamlConfigFiles

func (u *UtilsImpl) ApplyYamlConfigFiles(files []string) error

ApplyYamlConfigFiles applies the yaml files

func (*UtilsImpl) DrainNodeFromApiServer

func (u *UtilsImpl) DrainNodeFromApiServer(ctx context.Context, nodeName string) error

DrainNodeFromApiServer drains node from K8s server

func (*UtilsImpl) EnsureAppCatalog

func (u *UtilsImpl) EnsureAppCatalog() error

EnsureAppCatalog applies app catalog yaml files

func (*UtilsImpl) EnsureDns

func (u *UtilsImpl) EnsureDns(cfg config.Config) error

EnsureDns applies coredns yaml file

func (*UtilsImpl) GetNodeFromK8sApi

func (u *UtilsImpl) GetNodeFromK8sApi(ctx context.Context, nodeName string) (*v1.Node, error)

GetNodeFromK8sApi returns node from K8s api with given nodename

func (*UtilsImpl) IsInterfaceNil

func (u *UtilsImpl) IsInterfaceNil() bool

func (*UtilsImpl) K8sApiAvailable

func (u *UtilsImpl) K8sApiAvailable(cfg config.Config) error

K8sApiAvailable checks if K8s api server is available

func (*UtilsImpl) PreventAutoReattach

func (u *UtilsImpl) PreventAutoReattach() error

PreventAutoReattach removes qbert metaData file if present

func (*UtilsImpl) RemoveAnnotationsFromNode

func (u *UtilsImpl) RemoveAnnotationsFromNode(ctx context.Context, nodeName string, annotsToRemove []string) error

RemoveAnnotationsFromNode removes annotations from node

func (*UtilsImpl) UncordonNode

func (u *UtilsImpl) UncordonNode(ctx context.Context, nodeName string) error

UncordonNode uncordons node

func (*UtilsImpl) WriteCloudProviderConfig

func (u *UtilsImpl) WriteCloudProviderConfig(cfg config.Config) error

Jump to

Keyboard shortcuts

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