utils

package module
v0.0.0-...-bbbaf8e Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Drainer

type Drainer struct {
	// contains filtered or unexported fields
}

Drainer will store Kubernetes client that will be used in the cordon and drain operation. Use 'NewK8sClientsetFromKubeconfigPath' or 'NewK8sClientsetFromKubeconfigBytes' to generate one.

func NewK8sClientsetFromKubeconfigBytes

func NewK8sClientsetFromKubeconfigBytes(kubeconfigBytes []byte) (*Drainer, error)

NewK8sClientsetFromKubeconfigBytes takes byte slice of Kubeconfig file and returns Drainer pointer and error (if any)

func NewK8sClientsetFromKubeconfigPath

func NewK8sClientsetFromKubeconfigPath(filepath string) (*Drainer, error)

NewK8sClientsetFromKubeconfigPath takes file path to Kubeconfig file and returns Drainer pointer and error (if any)

func (*Drainer) CordonAndDrainNode

func (d *Drainer) CordonAndDrainNode(nodeName string) error

CordonAndDrainNode will set nodeName to unschedulable and release all workloads running inside it. If the node has been cordoned and drained, it will not raise any error. If the node is not found, it will return an error.

func (*Drainer) CordonNode

func (d *Drainer) CordonNode(nodeName string) error

CordonNode will set nodeName to unschedulable. If the node has been cordoned, it will not raise any error.

func (*Drainer) DrainNode

func (d *Drainer) DrainNode(nodeName string) error

DrainNode will release all workloads running inside it. If the node has been drained, it will not raise any error.

Jump to

Keyboard shortcuts

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