Remove check for empty activePods list in CPUManager removeStaleState

This check is redundant since we protect this call with a call to
`m.sourcesReady.AllReady()` earlier on. Moreover, having this check in
place means that we will leave some stale state around in cases where
there are actually no active pods in the system and this loop hasn't
cleaned them up yet. This can happen, for example, if a pod exits while
the kubelet is down for some reason. We see this exact case being
triggered in our e2e tests, where a test has been failing since October
when this change was first introduced.
This commit is contained in:
Kevin Klues 2020-01-15 20:09:24 +01:00
parent 5802f3a910
commit 34b942a41d

View File

@ -312,12 +312,6 @@ func (m *manager) removeStaleState() {
// Get the list of active pods.
activePods := m.activePods()
if len(activePods) == 0 {
// If there are no active pods, skip the removal of stale state.
// Since this function is called periodically, we will just try again
// next time this function is called.
return
}
// Build a list of (podUID, containerName) pairs for all containers in all active Pods.
activeContainers := make(map[string]map[string]struct{})