Commit 7856e46f authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #33967 from xiang90/fix_33772

Automatic merge from submit-queue scheduler: initialize podsWithAffinity Without initializing podsWithAffinity, scheduler panics when deleting a pod from a node that has no pods with affinity ever scheduled to. Fix #33772
parents 0ad50d20 dc620074
......@@ -244,12 +244,12 @@ func (cache *schedulerCache) RemovePod(pod *api.Pod) error {
cache.mu.Lock()
defer cache.mu.Unlock()
_, ok := cache.podStates[key]
cachedstate, ok := cache.podStates[key]
switch {
// An assumed pod won't have Delete/Remove event. It needs to have Add event
// before Remove event, in which case the state would change from Assumed to Added.
case ok && !cache.assumedPods[key]:
err := cache.removePod(pod)
err := cache.removePod(cachedstate.pod)
if err != nil {
return err
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment