mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 06:27:05 +00:00
Fix bug in TopologManager RemoveContainer()
Previously, we unconditionally removed *all* topology hints from a pod whenever just one container was being removed. This commit makes it so we only remove the hints for the single container being removed, and then conditionally remove the pod from the podTopologyHints[podUID] when no containers left in it.
This commit is contained in:
parent
7a01cdcaea
commit
95a3ac447f
@ -194,10 +194,17 @@ func (m *manager) AddContainer(pod *v1.Pod, containerID string) error {
|
||||
}
|
||||
|
||||
func (m *manager) RemoveContainer(containerID string) error {
|
||||
klog.Infof("[topologymanager] RemoveContainer - Container ID: %v", containerID)
|
||||
|
||||
podUIDString := m.podMap[containerID]
|
||||
delete(m.podTopologyHints, podUIDString)
|
||||
delete(m.podMap, containerID)
|
||||
klog.Infof("[topologymanager] RemoveContainer - Container ID: %v podTopologyHints: %v", containerID, m.podTopologyHints)
|
||||
if _, exists := m.podTopologyHints[podUIDString]; exists {
|
||||
delete(m.podTopologyHints[podUIDString], containerID)
|
||||
if len(m.podTopologyHints[podUIDString]) == 0 {
|
||||
delete(m.podTopologyHints, podUIDString)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user