mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 12:15:52 +00:00
Merge pull request #99563 from jmguzik/migrate-cm-cpumanager-state-structured-logging
Migrate pkg/kubelet/cm/cpumanager/state to structured logging
This commit is contained in:
commit
a951e877be
@ -133,8 +133,8 @@ func (sc *stateCheckpoint) restoreState() error {
|
||||
sc.cache.SetDefaultCPUSet(tmpDefaultCPUSet)
|
||||
sc.cache.SetCPUAssignments(tmpAssignments)
|
||||
|
||||
klog.V(2).Info("[cpumanager] state checkpoint: restored state from checkpoint")
|
||||
klog.V(2).Infof("[cpumanager] state checkpoint: defaultCPUSet: %s", tmpDefaultCPUSet.String())
|
||||
klog.V(2).InfoS("State checkpoint: restored state from checkpoint")
|
||||
klog.V(2).InfoS("State checkpoint: defaultCPUSet", "defaultCpuSet", tmpDefaultCPUSet.String())
|
||||
|
||||
return nil
|
||||
}
|
||||
@ -155,7 +155,7 @@ func (sc *stateCheckpoint) storeState() error {
|
||||
|
||||
err := sc.checkpointManager.CreateCheckpoint(sc.checkpointName, checkpoint)
|
||||
if err != nil {
|
||||
klog.Errorf("[cpumanager] could not save checkpoint: %v", err)
|
||||
klog.ErrorS(err, "Failed to save checkpoint")
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
@ -201,7 +201,7 @@ func (sc *stateCheckpoint) SetCPUSet(podUID string, containerName string, cset c
|
||||
sc.cache.SetCPUSet(podUID, containerName, cset)
|
||||
err := sc.storeState()
|
||||
if err != nil {
|
||||
klog.Warningf("store state to checkpoint error: %v", err)
|
||||
klog.InfoS("Store state to checkpoint error", "err", err)
|
||||
}
|
||||
}
|
||||
|
||||
@ -212,7 +212,7 @@ func (sc *stateCheckpoint) SetDefaultCPUSet(cset cpuset.CPUSet) {
|
||||
sc.cache.SetDefaultCPUSet(cset)
|
||||
err := sc.storeState()
|
||||
if err != nil {
|
||||
klog.Warningf("store state to checkpoint error: %v", err)
|
||||
klog.InfoS("Store state to checkpoint error", "err", err)
|
||||
}
|
||||
}
|
||||
|
||||
@ -223,7 +223,7 @@ func (sc *stateCheckpoint) SetCPUAssignments(a ContainerCPUAssignments) {
|
||||
sc.cache.SetCPUAssignments(a)
|
||||
err := sc.storeState()
|
||||
if err != nil {
|
||||
klog.Warningf("store state to checkpoint error: %v", err)
|
||||
klog.InfoS("Store state to checkpoint error", "err", err)
|
||||
}
|
||||
}
|
||||
|
||||
@ -234,7 +234,7 @@ func (sc *stateCheckpoint) Delete(podUID string, containerName string) {
|
||||
sc.cache.Delete(podUID, containerName)
|
||||
err := sc.storeState()
|
||||
if err != nil {
|
||||
klog.Warningf("store state to checkpoint error: %v", err)
|
||||
klog.InfoS("Store state to checkpoint error", "err", err)
|
||||
}
|
||||
}
|
||||
|
||||
@ -245,6 +245,6 @@ func (sc *stateCheckpoint) ClearState() {
|
||||
sc.cache.ClearState()
|
||||
err := sc.storeState()
|
||||
if err != nil {
|
||||
klog.Warningf("store state to checkpoint error: %v", err)
|
||||
klog.InfoS("Store state to checkpoint error", "err", err)
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ var _ State = &stateMemory{}
|
||||
|
||||
// NewMemoryState creates new State for keeping track of cpu/pod assignment
|
||||
func NewMemoryState() State {
|
||||
klog.Infof("[cpumanager] initializing new in-memory state store")
|
||||
klog.InfoS("Initialized new in-memory state store")
|
||||
return &stateMemory{
|
||||
assignments: ContainerCPUAssignments{},
|
||||
defaultCPUSet: cpuset.NewCPUSet(),
|
||||
@ -77,7 +77,7 @@ func (s *stateMemory) SetCPUSet(podUID string, containerName string, cset cpuset
|
||||
}
|
||||
|
||||
s.assignments[podUID][containerName] = cset
|
||||
klog.Infof("[cpumanager] updated desired cpuset (pod: %s, container: %s, cpuset: \"%s\")", podUID, containerName, cset)
|
||||
klog.InfoS("Updated desired CPUSet", "podUID", podUID, "containerName", containerName, "cpuSet", cset)
|
||||
}
|
||||
|
||||
func (s *stateMemory) SetDefaultCPUSet(cset cpuset.CPUSet) {
|
||||
@ -85,7 +85,7 @@ func (s *stateMemory) SetDefaultCPUSet(cset cpuset.CPUSet) {
|
||||
defer s.Unlock()
|
||||
|
||||
s.defaultCPUSet = cset
|
||||
klog.Infof("[cpumanager] updated default cpuset: \"%s\"", cset)
|
||||
klog.InfoS("Updated default CPUSet", "cpuSet", cset)
|
||||
}
|
||||
|
||||
func (s *stateMemory) SetCPUAssignments(a ContainerCPUAssignments) {
|
||||
@ -93,7 +93,7 @@ func (s *stateMemory) SetCPUAssignments(a ContainerCPUAssignments) {
|
||||
defer s.Unlock()
|
||||
|
||||
s.assignments = a.Clone()
|
||||
klog.Infof("[cpumanager] updated cpuset assignments: \"%v\"", a)
|
||||
klog.InfoS("Updated CPUSet assignments", "assignments", a)
|
||||
}
|
||||
|
||||
func (s *stateMemory) Delete(podUID string, containerName string) {
|
||||
@ -104,7 +104,7 @@ func (s *stateMemory) Delete(podUID string, containerName string) {
|
||||
if len(s.assignments[podUID]) == 0 {
|
||||
delete(s.assignments, podUID)
|
||||
}
|
||||
klog.V(2).Infof("[cpumanager] deleted cpuset assignment (pod: %s, container: %s)", podUID, containerName)
|
||||
klog.V(2).InfoS("Deleted CPUSet assignment", "podUID", podUID, "containerName", containerName)
|
||||
}
|
||||
|
||||
func (s *stateMemory) ClearState() {
|
||||
@ -113,5 +113,5 @@ func (s *stateMemory) ClearState() {
|
||||
|
||||
s.defaultCPUSet = cpuset.CPUSet{}
|
||||
s.assignments = make(ContainerCPUAssignments)
|
||||
klog.V(2).Infof("[cpumanager] cleared state")
|
||||
klog.V(2).InfoS("Cleared state")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user