mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-09 05:01:46 +00:00
node: cpumgr: move flow to left and add logs
Refactor the code to align to the left bailing out earlier if the code must do nothing. Add log to trace this occurrence. Besides extra log, no intended change in behavior. Signed-off-by: Francesco Romani <fromani@redhat.com>
This commit is contained in:
@@ -380,24 +380,28 @@ func (m *manager) removeStaleState() {
|
|||||||
assignments := m.state.GetCPUAssignments()
|
assignments := m.state.GetCPUAssignments()
|
||||||
for podUID := range assignments {
|
for podUID := range assignments {
|
||||||
for containerName := range assignments[podUID] {
|
for containerName := range assignments[podUID] {
|
||||||
if _, ok := activeContainers[podUID][containerName]; !ok {
|
if _, ok := activeContainers[podUID][containerName]; ok {
|
||||||
klog.V(2).InfoS("RemoveStaleState: removing container", "podUID", podUID, "containerName", containerName)
|
klog.V(4).InfoS("RemoveStaleState: container still active", "podUID", podUID, "containerName", containerName)
|
||||||
err := m.policyRemoveContainerByRef(podUID, containerName)
|
continue
|
||||||
if err != nil {
|
|
||||||
klog.ErrorS(err, "RemoveStaleState: failed to remove container", "podUID", podUID, "containerName", containerName)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
m.containerMap.Visit(func(podUID, containerName, containerID string) {
|
|
||||||
if _, ok := activeContainers[podUID][containerName]; !ok {
|
|
||||||
klog.V(2).InfoS("RemoveStaleState: removing container", "podUID", podUID, "containerName", containerName)
|
klog.V(2).InfoS("RemoveStaleState: removing container", "podUID", podUID, "containerName", containerName)
|
||||||
err := m.policyRemoveContainerByRef(podUID, containerName)
|
err := m.policyRemoveContainerByRef(podUID, containerName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
klog.ErrorS(err, "RemoveStaleState: failed to remove container", "podUID", podUID, "containerName", containerName)
|
klog.ErrorS(err, "RemoveStaleState: failed to remove container", "podUID", podUID, "containerName", containerName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m.containerMap.Visit(func(podUID, containerName, containerID string) {
|
||||||
|
if _, ok := activeContainers[podUID][containerName]; ok {
|
||||||
|
klog.V(4).InfoS("RemoveStaleState: containerMap: container still active", "podUID", podUID, "containerName", containerName)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
klog.V(2).InfoS("RemoveStaleState: containerMap: removing container", "podUID", podUID, "containerName", containerName)
|
||||||
|
err := m.policyRemoveContainerByRef(podUID, containerName)
|
||||||
|
if err != nil {
|
||||||
|
klog.ErrorS(err, "RemoveStaleState: containerMap: failed to remove container", "podUID", podUID, "containerName", containerName)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user