Commit c1667432 authored by Nikhita Raghunath's avatar Nikhita Raghunath

scheduler: fix panic while removing node from imageStates cache

parent c861ceb4
...@@ -506,12 +506,12 @@ func (cache *schedulerCache) removeNodeImageStates(node *v1.Node) { ...@@ -506,12 +506,12 @@ func (cache *schedulerCache) removeNodeImageStates(node *v1.Node) {
state, ok := cache.imageStates[name] state, ok := cache.imageStates[name]
if ok { if ok {
state.nodes.Delete(node.Name) state.nodes.Delete(node.Name)
} if len(state.nodes) == 0 {
if len(state.nodes) == 0 { // Remove the unused image to make sure the length of
// Remove the unused image to make sure the length of // imageStates represents the total number of different
// imageStates represents the total number of different // images on all nodes
// images on all nodes delete(cache.imageStates, name)
delete(cache.imageStates, name) }
} }
} }
} }
......
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