Skip to content

Commit

Permalink
Merge pull request kubernetes#100163 from lala123912/kubelet_log_3
Browse files Browse the repository at this point in the history
Migrate pkg/kubelet/cm/cpumanage/{topology/togit pology.go, policy_none.go, cpu_assignment.go} to structured logging
  • Loading branch information
k8s-ci-robot authored Mar 16, 2021
2 parents 158e146 + b247240 commit 1d4777b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
6 changes: 3 additions & 3 deletions pkg/kubelet/cm/cpumanager/cpu_assignment.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ func takeByTopology(topo *topology.CPUTopology, availableCPUs cpuset.CPUSet, num
// least a socket's-worth of CPUs.
if acc.needs(acc.topo.CPUsPerSocket()) {
for _, s := range acc.freeSockets() {
klog.V(4).Infof("[cpumanager] takeByTopology: claiming socket [%d]", s)
klog.V(4).InfoS("takeByTopology: claiming socket", "socket", s)
acc.take(acc.details.CPUsInSockets(s))
if acc.isSatisfied() {
return acc.result, nil
Expand All @@ -175,7 +175,7 @@ func takeByTopology(topo *topology.CPUTopology, availableCPUs cpuset.CPUSet, num
// a core's-worth of CPUs.
if acc.needs(acc.topo.CPUsPerCore()) {
for _, c := range acc.freeCores() {
klog.V(4).Infof("[cpumanager] takeByTopology: claiming core [%d]", c)
klog.V(4).InfoS("takeByTopology: claiming core", "core", c)
acc.take(acc.details.CPUsInCores(c))
if acc.isSatisfied() {
return acc.result, nil
Expand All @@ -190,7 +190,7 @@ func takeByTopology(topo *topology.CPUTopology, availableCPUs cpuset.CPUSet, num
// on the same sockets as the whole cores we have already taken in this
// allocation.
for _, c := range acc.freeCPUs() {
klog.V(4).Infof("[cpumanager] takeByTopology: claiming CPU [%d]", c)
klog.V(4).InfoS("takeByTopology: claiming CPU", "cpu", c)
if acc.needs(1) {
acc.take(cpuset.NewCPUSet(c))
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/kubelet/cm/cpumanager/policy_none.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func (p *nonePolicy) Name() string {
}

func (p *nonePolicy) Start(s state.State) error {
klog.Info("[cpumanager] none policy: Start")
klog.InfoS("None policy: Start")
return nil
}

Expand Down
3 changes: 1 addition & 2 deletions pkg/kubelet/cm/cpumanager/topology/topology.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,7 @@ func Discover(machineInfo *cadvisorapi.MachineInfo) (*CPUTopology, error) {
}
}
} else {
klog.Errorf("could not get unique coreID for socket: %d core %d threads: %v",
core.SocketID, core.Id, core.Threads)
klog.ErrorS(nil, "Could not get unique coreID for socket", "socket", core.SocketID, "core", core.Id, "threads", core.Threads)
return nil, err
}
}
Expand Down

0 comments on commit 1d4777b

Please sign in to comment.