drain

package
v0.0.0-...-70c0ce9 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 4 Imported by: 14

Documentation

Index

Constants

View Source
const (
	// PodSafeToEvictKey - annotation that ignores constraints to evict a pod like not being replicated, being on
	// kube-system namespace or having a local storage.
	PodSafeToEvictKey = "cluster-autoscaler.kubernetes.io/safe-to-evict"
	// SafeToEvictLocalVolumesKey - annotation that ignores (doesn't block on) a local storage volume during node scale down
	SafeToEvictLocalVolumesKey = "cluster-autoscaler.kubernetes.io/safe-to-evict-local-volumes"
)
View Source
const (
	// PodLongTerminatingExtraThreshold - time after which a pod, that is terminating and that has run over its terminationGracePeriod, should be ignored and considered as deleted
	PodLongTerminatingExtraThreshold = 30 * time.Second
)

Variables

This section is empty.

Functions

func ControllerRef

func ControllerRef(pod *apiv1.Pod) *metav1.OwnerReference

ControllerRef returns the OwnerReference to pod's controller.

func HasBlockingLocalStorage

func HasBlockingLocalStorage(pod *apiv1.Pod) bool

HasBlockingLocalStorage returns true if pod has any local storage without pod annotation `<SafeToEvictLocalVolumeKey>: <volume-name-1>,<volume-name-2>...`

func HasNotSafeToEvictAnnotation

func HasNotSafeToEvictAnnotation(pod *apiv1.Pod) bool

HasNotSafeToEvictAnnotation checks if pod has PodSafeToEvictKey annotation set to false.

func HasSafeToEvictAnnotation

func HasSafeToEvictAnnotation(pod *apiv1.Pod) bool

HasSafeToEvictAnnotation checks if pod has PodSafeToEvictKey annotation.

func IsPodLongTerminating

func IsPodLongTerminating(pod *apiv1.Pod, currentTime time.Time) bool

IsPodLongTerminating checks if a pod has been terminating for a long time (pod's terminationGracePeriod + an additional const buffer)

func IsPodTerminal

func IsPodTerminal(pod *apiv1.Pod) bool

IsPodTerminal checks whether the pod is in a terminal state.

Types

type BlockingPod

type BlockingPod struct {
	Pod    *apiv1.Pod
	Reason BlockingPodReason
}

BlockingPod represents a pod which is blocking the scale down of a node.

type BlockingPodReason

type BlockingPodReason int

BlockingPodReason represents a reason why a pod is blocking the scale down of a node.

const (
	// NoReason - sanity check, this should never be set explicitly. If this is found in the wild, it means that it was
	// implicitly initialized and might indicate a bug.
	NoReason BlockingPodReason = iota
	// ControllerNotFound - pod is blocking scale down because its controller can't be found.
	ControllerNotFound
	// MinReplicasReached - pod is blocking scale down because its controller already has the minimum number of replicas.
	MinReplicasReached
	// NotReplicated - pod is blocking scale down because it's not replicated.
	NotReplicated
	// LocalStorageRequested - pod is blocking scale down because it requests local storage.
	LocalStorageRequested
	// NotSafeToEvictAnnotation - pod is blocking scale down because it has a "not safe to evict" annotation.
	NotSafeToEvictAnnotation
	// UnmovableKubeSystemPod - pod is blocking scale down because it's a non-daemonset, non-mirrored, non-pdb-assigned kube-system pod.
	UnmovableKubeSystemPod
	// NotEnoughPdb - pod is blocking scale down because it doesn't have enough PDB left.
	NotEnoughPdb
	// UnexpectedError - pod is blocking scale down because of an unexpected error.
	UnexpectedError
)

Jump to

Keyboard shortcuts

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