mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-04 01:40:07 +00:00
Merge pull request #29100 from wojtek-t/pods_can_never_be_scheduled_again
Automatic merge from submit-queue Fix disappearing pods in scheduler Fix #29098
This commit is contained in:
commit
b0bcb8f7b2
@ -48,6 +48,8 @@ import (
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
SchedulerAnnotationKey = "scheduler.alpha.kubernetes.io/name"
|
SchedulerAnnotationKey = "scheduler.alpha.kubernetes.io/name"
|
||||||
|
initialGetBackoff = 100 * time.Millisecond
|
||||||
|
maximalGetBackoff = time.Minute
|
||||||
)
|
)
|
||||||
|
|
||||||
// ConfigFactory knows how to fill out a scheduler config with its support functions.
|
// ConfigFactory knows how to fill out a scheduler config with its support functions.
|
||||||
@ -531,13 +533,21 @@ func (factory *ConfigFactory) makeDefaultErrorFunc(backoff *podBackoff, podQueue
|
|||||||
}
|
}
|
||||||
// Get the pod again; it may have changed/been scheduled already.
|
// Get the pod again; it may have changed/been scheduled already.
|
||||||
pod = &api.Pod{}
|
pod = &api.Pod{}
|
||||||
err := factory.Client.Get().Namespace(podID.Namespace).Resource("pods").Name(podID.Name).Do().Into(pod)
|
getBackoff := initialGetBackoff
|
||||||
if err != nil {
|
for {
|
||||||
if !errors.IsNotFound(err) {
|
if err := factory.Client.Get().Namespace(podID.Namespace).Resource("pods").Name(podID.Name).Do().Into(pod); err == nil {
|
||||||
glog.Errorf("Error getting pod %v for retry: %v; abandoning", podID, err)
|
break
|
||||||
}
|
}
|
||||||
|
if errors.IsNotFound(err) {
|
||||||
|
glog.Warning("A pod %v no longer exists", podID)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
glog.Errorf("Error getting pod %v for retry: %v; retrying...", podID, err)
|
||||||
|
if getBackoff = getBackoff * 2; getBackoff > maximalGetBackoff {
|
||||||
|
getBackoff = maximalGetBackoff
|
||||||
|
}
|
||||||
|
time.Sleep(getBackoff)
|
||||||
|
}
|
||||||
if pod.Spec.NodeName == "" {
|
if pod.Spec.NodeName == "" {
|
||||||
podQueue.AddIfNotPresent(pod)
|
podQueue.AddIfNotPresent(pod)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user