mirror of https://github.com/k3s-io/k3s
Make volume binder resilient to races: scheduler change
There is no need to clear stale pod binding cache in scheduling, because it will be recreated at beginning of each schedule loop, and will be cleared when pod is removed from scheduling queue.pull/564/head
parent
8b94b9625b
commit
cfc8ef51d1
|
@ -1105,7 +1105,6 @@ func (c *configFactory) MakeDefaultErrorFunc(backoff *util.PodBackoff, podQueue
|
|||
Namespace: pod.Namespace,
|
||||
Name: pod.Name,
|
||||
}
|
||||
origPod := pod
|
||||
|
||||
// When pod priority is enabled, we would like to place an unschedulable
|
||||
// pod in the unschedulable queue. This ensures that if the pod is nominated
|
||||
|
@ -1124,21 +1123,11 @@ func (c *configFactory) MakeDefaultErrorFunc(backoff *util.PodBackoff, podQueue
|
|||
if err == nil {
|
||||
if len(pod.Spec.NodeName) == 0 {
|
||||
podQueue.AddUnschedulableIfNotPresent(pod)
|
||||
} else {
|
||||
if c.volumeBinder != nil {
|
||||
// Volume binder only wants to keep unassigned pods
|
||||
c.volumeBinder.DeletePodBindings(pod)
|
||||
}
|
||||
}
|
||||
break
|
||||
}
|
||||
if errors.IsNotFound(err) {
|
||||
klog.Warningf("A pod %v no longer exists", podID)
|
||||
|
||||
if c.volumeBinder != nil {
|
||||
// Volume binder only wants to keep unassigned pods
|
||||
c.volumeBinder.DeletePodBindings(origPod)
|
||||
}
|
||||
return
|
||||
}
|
||||
klog.Errorf("Error getting pod %v for retry: %v; retrying...", podID, err)
|
||||
|
|
|
@ -383,10 +383,6 @@ func (sched *Scheduler) bindVolumes(assumed *v1.Pod) error {
|
|||
klog.Errorf("scheduler cache ForgetPod failed: %v", forgetErr)
|
||||
}
|
||||
|
||||
// Volumes may be bound by PV controller asynchronously, we must clear
|
||||
// stale pod binding cache.
|
||||
sched.config.VolumeBinder.DeletePodBindings(assumed)
|
||||
|
||||
sched.recordSchedulingFailure(assumed, err, "VolumeBindingFailed", err.Error())
|
||||
return err
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue