mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-22 02:18:51 +00:00
Fix scheduler cache inconsistency upon Pods with same name but different UIDs
Co-authored-by: Wei Huang <wei.huang1@ibm.com> Co-authored-by: tianxia52 <871883758@qq.com>
This commit is contained in:
@@ -243,6 +243,15 @@ func (sched *Scheduler) updatePodInCache(oldObj, newObj interface{}) {
|
||||
return
|
||||
}
|
||||
|
||||
// A Pod delete event followed by an immediate Pod add event may be merged
|
||||
// into a Pod update event. In this case, we should invalidate the old Pod, and
|
||||
// then add the new Pod.
|
||||
if oldPod.UID != newPod.UID {
|
||||
sched.deletePodFromCache(oldObj)
|
||||
sched.addPodToCache(newObj)
|
||||
return
|
||||
}
|
||||
|
||||
// NOTE: Updates must be written to scheduler cache before invalidating
|
||||
// equivalence cache, because we could snapshot equivalence cache after the
|
||||
// invalidation and then snapshot the cache itself. If the cache is
|
||||
|
Reference in New Issue
Block a user