diff --git a/pkg/controllers/provisioning/provisioner.go b/pkg/controllers/provisioning/provisioner.go index ce9e148c6044..e7a235e62dff 100644 --- a/pkg/controllers/provisioning/provisioner.go +++ b/pkg/controllers/provisioning/provisioner.go @@ -146,16 +146,17 @@ func (p *Provisioner) Batch(ctx context.Context) (pods []*v1.Pod) { // between the time it was ingested into the scheduler and the time it is included // in a provisioner batch. func (p *Provisioner) FilterProvisionable(ctx context.Context, pods []*v1.Pod) []*v1.Pod { - unscheduled := []*v1.Pod{} + provisionable := []*v1.Pod{} for _, pod := range pods { - candidate := pod + // the original pod should be returned rather than the newly fetched pod in case the scheduler relaxed constraints + original := pod + candidate := &v1.Pod{} if err := p.kubeClient.Get(ctx, types.NamespacedName{Namespace: pod.Namespace, Name: pod.Name}, candidate); err != nil { logging.FromContext(ctx).Errorf("Unexpected error retrieving pod \"%s/%s\" while checking if it is provisionable", pod.Namespace, pod.Name) } - if !isProvisionable(candidate) { - continue + if candidate.Spec.NodeName == "" { + provisionable = append(provisionable, original) } - unscheduled = append(unscheduled, candidate) } - return unscheduled + return provisionable }