Documentation ¶
Index ¶
- Constants
- func ControllerRef(pod *apiv1.Pod) *metav1.OwnerReference
- func HasBlockingLocalStorage(pod *apiv1.Pod) bool
- func HasNotSafeToEvictAnnotation(pod *apiv1.Pod) bool
- func HasSafeToEvictAnnotation(pod *apiv1.Pod) bool
- func IsPodLongTerminating(pod *apiv1.Pod, currentTime time.Time) bool
- func IsPodTerminal(pod *apiv1.Pod) bool
- type BlockingPod
- type BlockingPodReason
Constants ¶
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" )
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 ¶
HasBlockingLocalStorage returns true if pod has any local storage without pod annotation `<SafeToEvictLocalVolumeKey>: <volume-name-1>,<volume-name-2>...`
func HasNotSafeToEvictAnnotation ¶
HasNotSafeToEvictAnnotation checks if pod has PodSafeToEvictKey annotation set to false.
func HasSafeToEvictAnnotation ¶
HasSafeToEvictAnnotation checks if pod has PodSafeToEvictKey annotation.
func IsPodLongTerminating ¶
IsPodLongTerminating checks if a pod has been terminating for a long time (pod's terminationGracePeriod + an additional const buffer)
func IsPodTerminal ¶
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 )
func (BlockingPodReason) String ¶
func (e BlockingPodReason) String() string