fix and update

This commit is contained in:
shiyajuan123
2021-03-10 14:29:03 +08:00
parent 6b53f8c65d
commit 9cee635494

View File

@@ -222,7 +222,7 @@ func NewContainerManager(mountUtil mount.Interface, cadvisorInterface cadvisor.I
swapData, err := ioutil.ReadFile(swapFile)
if err != nil {
if os.IsNotExist(err) {
klog.InfoS("File does not exist, assuming that swap is disabled", "file", swapFile)
klog.InfoS("File does not exist, assuming that swap is disabled", "path", swapFile)
} else {
return nil, err
}
@@ -310,7 +310,7 @@ func NewContainerManager(mountUtil mount.Interface, cadvisorInterface cadvisor.I
return nil, err
}
klog.InfoS("[Topologymanager] Initializing Topology Manager with policy and level scope", "policy", nodeConfig.ExperimentalTopologyManagerPolicy, "scope", nodeConfig.ExperimentalTopologyManagerScope)
klog.InfoS("Initializing Topology Manager", "policy", nodeConfig.ExperimentalTopologyManagerPolicy, "scope", nodeConfig.ExperimentalTopologyManagerScope)
} else {
cm.topologyManager = topologymanager.NewFakeManager()
}
@@ -449,9 +449,9 @@ func setupKernelTunables(option KernelTunableBehavior) error {
case KernelTunableError:
errList = append(errList, fmt.Errorf("invalid kernel flag: %v, expected value: %v, actual value: %v", flag, expectedValue, val))
case KernelTunableWarn:
klog.V(2).InfoS("Invalid kernel flag, expected value, actual value", "flag", flag, "expectedValue", expectedValue, "actualValue", val)
klog.V(2).InfoS("Invalid kernel flag", "flag", flag, "expectedValue", expectedValue, "actualValue", val)
case KernelTunableModify:
klog.V(2).InfoS("Updating kernel flag, expected value, actual value", "flag", flag, "expectedValue", expectedValue, "actualValue", val)
klog.V(2).InfoS("Updating kernel flag", "flag", flag, "expectedValue", expectedValue, "actualValue", val)
err = sysctl.SetSysctl(flag, expectedValue)
if err != nil {
errList = append(errList, err)
@@ -500,13 +500,13 @@ func (cm *containerManagerImpl) setupNode(activePods ActivePodsFunc) error {
// Check the cgroup for docker periodically, so kubelet can serve stats for the docker runtime.
// TODO(KEP#866): remove special processing for CRI "docker" enablement
cm.periodicTasks = append(cm.periodicTasks, func() {
klog.V(4).InfoS("[ContainerManager]: Adding periodic tasks for docker CRI integration")
klog.V(4).InfoS("Adding periodic tasks for docker CRI integration")
cont, err := getContainerNameForProcess(dockerProcessName, dockerPidFile)
if err != nil {
klog.ErrorS(err, "Failed to get container name for process")
return
}
klog.V(2).InfoS("[ContainerManager]: Discovered runtime cgroups name", "cgroupsName", cont)
klog.V(2).InfoS("Discovered runtime cgroup name", "cgroupName", cont
cm.Lock()
defer cm.Unlock()
cm.RuntimeCgroupsName = cont
@@ -675,7 +675,7 @@ func (cm *containerManagerImpl) Start(node *v1.Node,
for _, cont := range cm.systemContainers {
if cont.ensureStateFunc != nil {
if err := cont.ensureStateFunc(cont.manager); err != nil {
klog.InfoS("[ContainerManager] Failed to ensure state of", "ensureState", cont.name, "err", err)
klog.InfoS("Failed to ensure state", "containerName", cont.name, "err", err)
}
}
}
@@ -825,12 +825,12 @@ func isProcessRunningInHost(pid int) (bool, error) {
if err != nil {
return false, fmt.Errorf("failed to find pid namespace of init process")
}
klog.V(10).InfoS("Init pid ns is", "initPidNs", initPidNs)
klog.V(10).InfoS("Found init PID namespace", "namespace", initPidNs)
processPidNs, err := os.Readlink(fmt.Sprintf("/proc/%d/ns/pid", pid))
if err != nil {
return false, fmt.Errorf("failed to find pid namespace of process %q", pid)
}
klog.V(10).InfoS("Pid", pid, "pidNs", processPidNs)
klog.V(10).InfoS("Process info", "pid", pid, "namespace", processPidNs)
return initPidNs == processPidNs, nil
}
@@ -872,7 +872,7 @@ func getPidsForProcess(name, pidFile string) ([]int, error) {
// Return error from getPidFromPidFile since that should have worked
// and is the real source of the problem.
klog.V(4).InfoS("Unable to get pid from", "pidFile", pidFile, "err", err)
klog.V(4).InfoS("Unable to get pid from file", "path", pidFile, "err", err)
return []int{}, err
}
@@ -912,7 +912,7 @@ func ensureProcessInContainerWithOOMScore(pid int, oomScoreAdj int, manager cgro
return err
} else if !runningInHost {
// Process is running inside a container. Don't touch that.
klog.V(2).InfoS("Pid is not running in the host namespaces", "pid", pid)
klog.V(2).InfoS("PID is not running in the host namespace", "pid", pid)
return nil
}
@@ -941,9 +941,9 @@ func ensureProcessInContainerWithOOMScore(pid int, oomScoreAdj int, manager cgro
// Also apply oom-score-adj to processes
oomAdjuster := oom.NewOOMAdjuster()
klog.V(5).InfoS("Attempting to apply oom_score_adj of to pid", "oomScoreAdj", oomScoreAdj, "pid", pid)
klog.V(5).InfoS("Attempting to apply oom_score_adj to process", "oomScoreAdj", oomScoreAdj, "pid", pid)
if err := oomAdjuster.ApplyOOMScoreAdj(pid, oomScoreAdj); err != nil {
klog.V(3).InfoS("Failed to apply oom_score_adj for pid", "oomScoreAdj", oomScoreAdj, "pid", pid, "err", err)
klog.V(3).InfoS("Failed to apply oom_score_adj to process", "oomScoreAdj", oomScoreAdj, "pid", pid, "err", err)
errs = append(errs, fmt.Errorf("failed to apply oom score %d to PID %d: %v", oomScoreAdj, pid, err))
}
return utilerrors.NewAggregate(errs)
@@ -991,10 +991,10 @@ func getContainer(pid int) (string, error) {
// in addition, you would not get memory or cpu accounting for the runtime unless accounting was enabled on its unit (or globally).
if systemd, found := cgs["name=systemd"]; found {
if systemd != cpu {
klog.InfoS("CPUAccounting not enabled for pid", "pid", pid)
klog.InfoS("CPUAccounting not enabled for process", "pid", pid)
}
if systemd != memory {
klog.InfoS("MemoryAccounting not enabled for pid", "pid", pid)
klog.InfoS("MemoryAccounting not enabled for process", "pid", pid)
}
return systemd, nil
}
@@ -1034,7 +1034,7 @@ func ensureSystemCgroups(rootCgroupPath string, manager cgroups.Manager) error {
return nil
}
klog.InfoS("Moving non-kernel processes", "processes", pids)
klog.InfoS("Moving non-kernel processes", "pids", pids)
for _, pid := range pids {
err := manager.Apply(pid)
if err != nil {