Skip to content

Commit

Permalink
fix: don't mark pods with 'karpenter.sh/do-not-disrupt=true' as resch…
Browse files Browse the repository at this point in the history
…edulable
  • Loading branch information
saurav-agarwalla committed Feb 26, 2025
1 parent 82a7d80 commit d16e35c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/utils/pod/scheduling.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit d16e35c

Please sign in to comment.