Merge pull request #96071 from Huang-Wei/phantom-sched-update-evt

Ignore some update Pod events in scheduler
This commit is contained in:
Kubernetes Prow Robot 2020-11-10 10:55:17 -08:00 committed by GitHub
commit 2b8f43bf15
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -176,11 +176,16 @@ func (sched *Scheduler) addPodToSchedulingQueue(obj interface{}) {
}
func (sched *Scheduler) updatePodInSchedulingQueue(oldObj, newObj interface{}) {
pod := newObj.(*v1.Pod)
if sched.skipPodUpdate(pod) {
oldPod, newPod := oldObj.(*v1.Pod), newObj.(*v1.Pod)
// Bypass update event that carries identical objects; otherwise, a duplicated
// Pod may go through scheduling and cause unexpected behavior (see #96071).
if oldPod.ResourceVersion == newPod.ResourceVersion {
return
}
if err := sched.SchedulingQueue.Update(oldObj.(*v1.Pod), pod); err != nil {
if sched.skipPodUpdate(newPod) {
return
}
if err := sched.SchedulingQueue.Update(oldPod, newPod); err != nil {
utilruntime.HandleError(fmt.Errorf("unable to update %T: %v", newObj, err))
}
}