From 7997c93cfdf7e7e00711d6a3731ccf0964eddbf8 Mon Sep 17 00:00:00 2001 From: Swati Sehgal Date: Thu, 6 Feb 2025 13:34:11 +0000 Subject: [PATCH] node: cpu-mgr: Adhere to the message style guidelines Ensure that the log messages adhere to the message style guildelines as captured [here](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-instrumentation/logging.md#message-style-guidelines). Signed-off-by: Swati Sehgal --- pkg/kubelet/cm/cpumanager/cpu_manager.go | 2 +- pkg/kubelet/cm/cpumanager/policy_static.go | 2 +- pkg/kubelet/cm/cpumanager/state/state_checkpoint.go | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pkg/kubelet/cm/cpumanager/cpu_manager.go b/pkg/kubelet/cm/cpumanager/cpu_manager.go index cd2c4c05a4f..8b59ba67121 100644 --- a/pkg/kubelet/cm/cpumanager/cpu_manager.go +++ b/pkg/kubelet/cm/cpumanager/cpu_manager.go @@ -467,7 +467,7 @@ func (m *manager) reconcileState() (success []reconciledContainer, failure []rec cset := m.state.GetCPUSetOrDefault(string(pod.UID), container.Name) if cset.IsEmpty() { // NOTE: This should not happen outside of tests. - klog.V(2).InfoS("ReconcileState: skipping container; assigned cpuset is empty", "pod", klog.KObj(pod), "containerName", container.Name) + klog.V(2).InfoS("ReconcileState: skipping container; empty cpuset assigned", "pod", klog.KObj(pod), "containerName", container.Name) failure = append(failure, reconciledContainer{pod.Name, container.Name, containerID}) continue } diff --git a/pkg/kubelet/cm/cpumanager/policy_static.go b/pkg/kubelet/cm/cpumanager/policy_static.go index d517aa698b5..16a44c5d582 100644 --- a/pkg/kubelet/cm/cpumanager/policy_static.go +++ b/pkg/kubelet/cm/cpumanager/policy_static.go @@ -473,7 +473,7 @@ func (p *staticPolicy) guaranteedCPUs(pod *v1.Pod, container *v1.Container) int } cpuValue := cpuQuantity.Value() if cpuValue*1000 != cpuQuantity.MilliValue() { - klog.V(5).InfoS("Exclusive CPU allocation skipped, pod is not requesting integral CPUs", "pod", klog.KObj(pod), "containerName", container.Name, "cpu", cpuValue) + klog.V(5).InfoS("Exclusive CPU allocation skipped, pod requested non-integral CPUs", "pod", klog.KObj(pod), "containerName", container.Name, "cpu", cpuValue) return 0 } // Safe downcast to do for all systems with < 2.1 billion CPUs. diff --git a/pkg/kubelet/cm/cpumanager/state/state_checkpoint.go b/pkg/kubelet/cm/cpumanager/state/state_checkpoint.go index 64b7aa8f532..bda90ba1f4c 100644 --- a/pkg/kubelet/cm/cpumanager/state/state_checkpoint.go +++ b/pkg/kubelet/cm/cpumanager/state/state_checkpoint.go @@ -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.ErrorS(err, "Store state to checkpoint error", "podUID", podUID, "containerName", containerName) + klog.ErrorS(err, "Failed to store state to checkpoint", "podUID", podUID, "containerName", containerName) } } @@ -212,7 +212,7 @@ func (sc *stateCheckpoint) SetDefaultCPUSet(cset cpuset.CPUSet) { sc.cache.SetDefaultCPUSet(cset) err := sc.storeState() if err != nil { - klog.ErrorS(err, "Store state to checkpoint error") + klog.ErrorS(err, "Failed to store state to checkpoint") } } @@ -223,7 +223,7 @@ func (sc *stateCheckpoint) SetCPUAssignments(a ContainerCPUAssignments) { sc.cache.SetCPUAssignments(a) err := sc.storeState() if err != nil { - klog.ErrorS(err, "Store state to checkpoint error") + klog.ErrorS(err, "Failed to store state to checkpoint") } } @@ -234,7 +234,7 @@ func (sc *stateCheckpoint) Delete(podUID string, containerName string) { sc.cache.Delete(podUID, containerName) err := sc.storeState() if err != nil { - klog.ErrorS(err, "Store state to checkpoint error", "podUID", podUID, "containerName", containerName) + klog.ErrorS(err, "Failed to store state to checkpoint", "podUID", podUID, "containerName", containerName) } } @@ -245,6 +245,6 @@ func (sc *stateCheckpoint) ClearState() { sc.cache.ClearState() err := sc.storeState() if err != nil { - klog.ErrorS(err, "Store state to checkpoint error") + klog.ErrorS(err, "Failed to store state to checkpoint") } }