drainer

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2022 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultMaxGracePeriod   = 8 * time.Minute
	DefaultEvictionOverhead = 30 * time.Second

	DefaultTimeGap                      = 10 * time.Minute
	DefaultMinimumTimeSinceLastAddition = 60 * time.Minute

	DefaultMinimumNodes           = 3
	DefaultMinimumNonTaintedNodes = 3
	DefaultExcessNodesThreshold   = 2
	DefaultEnabled                = true
)

Default drainer settings.

Variables

This section is empty.

Functions

This section is empty.

Types

type APICordonDrainer

type APICordonDrainer struct {

	// Current State
	LastNodeAddition time.Time
	LastScaleDown    time.Time
	// contains filtered or unexported fields
}

APICordonDrainer drains Kubernetes nodes via the Kubernetes API.

func NewAPICordonDrainer

func NewAPICordonDrainer(c kubernetes.Interface, supervisor *supervisor.Supervisor) *APICordonDrainer

NewAPICordonDrainer returns a CordonDrainer that cordons and drains nodes via the Kubernetes API.

func (*APICordonDrainer) AlterNodeState

func (d *APICordonDrainer) AlterNodeState(nodeDesiredState NodeDesiredState) error

AlterNodeState from unschedulable to schedulable and vice-versa

func (*APICordonDrainer) AttemptDrain

func (d *APICordonDrainer) AttemptDrain(nodeToDrain string, clusterManifest *internaltypes.ClusterManifest)

AttemptDrain runs multiple checks to ensure that the drain procedure satisfies all the requirements

func (*APICordonDrainer) Cordon

func (d *APICordonDrainer) Cordon(nodeName string) error

Cordon the supplied node. Marks it unschedulable for new pods.

func (*APICordonDrainer) Drain

func (d *APICordonDrainer) Drain(nodeName string) error

Drain searches and evicts all pods contained in a node.

func (*APICordonDrainer) ScaleDown

func (d *APICordonDrainer) ScaleDown(node string)

ScaleDown records timestamp to the last scale down and initiates a node drain

func (*APICordonDrainer) SetLastNodeAddition

func (d *APICordonDrainer) SetLastNodeAddition(time time.Time)

SetLastNodeAddition sets the time the last node was added to the cluster

func (*APICordonDrainer) Uncordon

func (d *APICordonDrainer) Uncordon(nodeName string) error

Uncordon the supplied node. Marks it schedulable for new pods.

func (*APICordonDrainer) UpdateSettings

func (d *APICordonDrainer) UpdateSettings(cm *v1.ConfigMap) error

UpdateSettings checks every setting in the drainer and sees if it needs to be updated or not and does the necessary action

type CordonDrainer

type CordonDrainer interface {
	Cordoner
	Drainer
}

CordonDrainer both cordons/uncordons and drains nodes

type Cordoner

type Cordoner interface {
	// Cordon the supplied node. Marks it unschedulable for new pods.
	Cordon(nodeName string) error

	// Uncordon the supplied node. Marks it schedulable for new pods.
	Uncordon(nodeName string) error
}

Cordoner cordons/uncordons nodes.

type Drainer

type Drainer interface {
	// Drain the supplied node. Evicts the node of all but mirror and DaemonSet pods.
	Drain(nodeName string) error
}

Drainer drains nodes.

type NodeDesiredState

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

NodeDesiredState to set a future state for the unschedulable node flag

Jump to

Keyboard shortcuts

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