Skip to content

Commit

Permalink
Don't provision for pods with nominated node (#1051)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ole Markus With authored Dec 29, 2021
1 parent 247abcd commit f52fbe7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/controllers/selection/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,12 @@ func (c *Controller) selectProvisioner(ctx context.Context, pod *v1.Pod) (errs e
}

func isProvisionable(p *v1.Pod) bool {
return p.Spec.NodeName == "" && pod.FailedToSchedule(p) && !pod.IsOwnedByDaemonSet(p) && !pod.IsOwnedByNode(p)
return !pod.IsScheduled(p) &&
!pod.IsPreempting(p) &&
pod.FailedToSchedule(p) &&
!pod.IsOwnedByDaemonSet(p) &&
!pod.IsOwnedByNode(p)

}

func validate(p *v1.Pod) error {
Expand Down
4 changes: 4 additions & 0 deletions pkg/utils/pod/scheduling.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ func IsScheduled(pod *v1.Pod) bool {
return pod.Spec.NodeName != ""
}

func IsPreempting(pod *v1.Pod) bool {
return pod.Status.NominatedNodeName != ""
}

func IsTerminal(pod *v1.Pod) bool {
return pod.Status.Phase == v1.PodFailed || pod.Status.Phase == v1.PodSucceeded
}
Expand Down

0 comments on commit f52fbe7

Please sign in to comment.