mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-18 16:21:13 +00:00
Exit scheduler retry loop correctly
The error was being eaten and shadowed, which means we would never exit this loop. This might lead to a goroutine in the scheduler being used forever without exiting at maximum backoff. Switched to use the real client to make later refactors easier.
This commit is contained in:
parent
e357b9a6f4
commit
4d79030b8d
@ -532,10 +532,13 @@ func (factory *ConfigFactory) makeDefaultErrorFunc(backoff *podBackoff, podQueue
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
// 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{}
|
|
||||||
getBackoff := initialGetBackoff
|
getBackoff := initialGetBackoff
|
||||||
for {
|
for {
|
||||||
if err := factory.Client.Get().Namespace(podID.Namespace).Resource("pods").Name(podID.Name).Do().Into(pod); err == nil {
|
pod, err := factory.Client.Pods(podID.Namespace).Get(podID.Name)
|
||||||
|
if err == nil {
|
||||||
|
if len(pod.Spec.NodeName) == 0 {
|
||||||
|
podQueue.AddIfNotPresent(pod)
|
||||||
|
}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
if errors.IsNotFound(err) {
|
if errors.IsNotFound(err) {
|
||||||
@ -548,9 +551,6 @@ func (factory *ConfigFactory) makeDefaultErrorFunc(backoff *podBackoff, podQueue
|
|||||||
}
|
}
|
||||||
time.Sleep(getBackoff)
|
time.Sleep(getBackoff)
|
||||||
}
|
}
|
||||||
if pod.Spec.NodeName == "" {
|
|
||||||
podQueue.AddIfNotPresent(pod)
|
|
||||||
}
|
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user