Skip to content

Commit 34b942a

Browse files
committed
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.
1 parent 5802f3a commit 34b942a

File tree

1 file changed

+0
-6
lines changed

1 file changed

+0
-6
lines changed

pkg/kubelet/cm/cpumanager/cpu_manager.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -312,12 +312,6 @@ func (m *manager) removeStaleState() {
312312

313313
// Get the list of active pods.
314314
activePods := m.activePods()
315-
if len(activePods) == 0 {
316-
// If there are no active pods, skip the removal of stale state.
317-
// Since this function is called periodically, we will just try again
318-
// next time this function is called.
319-
return
320-
}
321315

322316
// Build a list of (podUID, containerName) pairs for all containers in all active Pods.
323317
activeContainers := make(map[string]map[string]struct{})

0 commit comments

Comments
 (0)