Merge pull request #100163 from lala123912/kubelet_log_3

Migrate pkg/kubelet/cm/cpumanage/{topology/togit pology.go, policy_none.go, cpu_assignment.go} to structured logging
This commit is contained in:
Kubernetes Prow Robot 2021-03-16 15:57:08 -07:00 committed by GitHub
commit 1d4777b798
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 6 deletions

View File

@ -160,7 +160,7 @@ func takeByTopology(topo *topology.CPUTopology, availableCPUs cpuset.CPUSet, num
// least a socket's-worth of CPUs. // least a socket's-worth of CPUs.
if acc.needs(acc.topo.CPUsPerSocket()) { if acc.needs(acc.topo.CPUsPerSocket()) {
for _, s := range acc.freeSockets() { 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)) acc.take(acc.details.CPUsInSockets(s))
if acc.isSatisfied() { if acc.isSatisfied() {
return acc.result, nil return acc.result, nil
@ -175,7 +175,7 @@ func takeByTopology(topo *topology.CPUTopology, availableCPUs cpuset.CPUSet, num
// a core's-worth of CPUs. // a core's-worth of CPUs.
if acc.needs(acc.topo.CPUsPerCore()) { if acc.needs(acc.topo.CPUsPerCore()) {
for _, c := range acc.freeCores() { 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)) acc.take(acc.details.CPUsInCores(c))
if acc.isSatisfied() { if acc.isSatisfied() {
return acc.result, nil return acc.result, nil
@ -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 // on the same sockets as the whole cores we have already taken in this
// allocation. // allocation.
for _, c := range acc.freeCPUs() { 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) { if acc.needs(1) {
acc.take(cpuset.NewCPUSet(c)) acc.take(cpuset.NewCPUSet(c))
} }

View File

@ -41,7 +41,7 @@ func (p *nonePolicy) Name() string {
} }
func (p *nonePolicy) Start(s state.State) error { func (p *nonePolicy) Start(s state.State) error {
klog.Info("[cpumanager] none policy: Start") klog.InfoS("None policy: Start")
return nil return nil
} }

View File

@ -236,8 +236,7 @@ func Discover(machineInfo *cadvisorapi.MachineInfo) (*CPUTopology, error) {
} }
} }
} else { } else {
klog.Errorf("could not get unique coreID for socket: %d core %d threads: %v", klog.ErrorS(nil, "Could not get unique coreID for socket", "socket", core.SocketID, "core", core.Id, "threads", core.Threads)
core.SocketID, core.Id, core.Threads)
return nil, err return nil, err
} }
} }