diff --git a/pkg/utils/pod/scheduling.go b/pkg/utils/pod/scheduling.go index 2b10a2523c..d05b57862f 100644 --- a/pkg/utils/pod/scheduling.go +++ b/pkg/utils/pod/scheduling.go @@ -39,13 +39,15 @@ func IsActive(pod *corev1.Pod) bool { // - Is an active pod (isn't terminal or actively terminating) OR Is owned by a StatefulSet and Is Terminating // - Isn't owned by a DaemonSet // - Isn't a mirror pod (https://kubernetes.io/docs/tasks/configure-pod-container/static-pod/) +// - Does not have the "karpenter.sh/do-not-disrupt=true" annotation (https://karpenter.sh/docs/concepts/disruption/#pod-level-controls) func IsReschedulable(pod *corev1.Pod) bool { // StatefulSet pods can be handled differently here because we know that StatefulSet pods MUST // get deleted before new pods are re-created. This means that we can model terminating pods for StatefulSets // differently for higher availability by considering terminating pods for scheduling return (IsActive(pod) || (IsOwnedByStatefulSet(pod) && IsTerminating(pod))) && !IsOwnedByDaemonSet(pod) && - !IsOwnedByNode(pod) + !IsOwnedByNode(pod) && + !HasDoNotDisrupt(pod) } // IsEvictable checks if a pod is evictable by Karpenter by ensuring that the pod: