From bd9d8fa42f72581c09d6f6bce4ff8c392e26665e Mon Sep 17 00:00:00 2001 From: Kevin Klues Date: Mon, 20 Jan 2020 20:30:40 +0100 Subject: [PATCH] Initialize CPUManager containerMap to set of initial containers A recent change made it so that the CPUManager receives a list of initial containers that exist on the system at startup. This list can be non-empty, for example, after a kubelet retart. This commit ensures that the CPUManagers containerMap structure is initialized with the containers from this list. --- pkg/kubelet/cm/cpumanager/cpu_manager.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/kubelet/cm/cpumanager/cpu_manager.go b/pkg/kubelet/cm/cpumanager/cpu_manager.go index aea7ba73dd7..b2c59c3c714 100644 --- a/pkg/kubelet/cm/cpumanager/cpu_manager.go +++ b/pkg/kubelet/cm/cpumanager/cpu_manager.go @@ -167,7 +167,6 @@ func NewManager(cpuPolicyName string, reconcilePeriod time.Duration, machineInfo manager := &manager{ policy: policy, reconcilePeriod: reconcilePeriod, - containerMap: containermap.NewContainerMap(), topology: topo, nodeAllocatableReservation: nodeAllocatableReservation, stateFileDirectory: stateFileDirectory, @@ -183,8 +182,9 @@ func (m *manager) Start(activePods ActivePodsFunc, sourcesReady config.SourcesRe m.activePods = activePods m.podStatusProvider = podStatusProvider m.containerRuntime = containerRuntime + m.containerMap = initialContainers - stateImpl, err := state.NewCheckpointState(m.stateFileDirectory, cpuManagerStateFileName, m.policy.Name(), initialContainers) + stateImpl, err := state.NewCheckpointState(m.stateFileDirectory, cpuManagerStateFileName, m.policy.Name(), m.containerMap) if err != nil { klog.Errorf("[cpumanager] could not initialize checkpoint manager: %v, please drain node and remove policy state file", err) return err