Skip to content

Commit d16e35c

Browse files
fix: don't mark pods with 'karpenter.sh/do-not-disrupt=true' as reschedulable
1 parent 82a7d80 commit d16e35c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pkg/utils/pod/scheduling.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,15 @@ func IsActive(pod *corev1.Pod) bool {
3939
// - Is an active pod (isn't terminal or actively terminating) OR Is owned by a StatefulSet and Is Terminating
4040
// - Isn't owned by a DaemonSet
4141
// - Isn't a mirror pod (https://kubernetes.io/docs/tasks/configure-pod-container/static-pod/)
42+
// - Does not have the "karpenter.sh/do-not-disrupt=true" annotation (https://karpenter.sh/docs/concepts/disruption/#pod-level-controls)
4243
func IsReschedulable(pod *corev1.Pod) bool {
4344
// StatefulSet pods can be handled differently here because we know that StatefulSet pods MUST
4445
// get deleted before new pods are re-created. This means that we can model terminating pods for StatefulSets
4546
// differently for higher availability by considering terminating pods for scheduling
4647
return (IsActive(pod) || (IsOwnedByStatefulSet(pod) && IsTerminating(pod))) &&
4748
!IsOwnedByDaemonSet(pod) &&
48-
!IsOwnedByNode(pod)
49+
!IsOwnedByNode(pod) &&
50+
!HasDoNotDisrupt(pod)
4951
}
5052

5153
// IsEvictable checks if a pod is evictable by Karpenter by ensuring that the pod:

0 commit comments

Comments
 (0)