Migrate pkg/kubelet/cm/ top level files to structured logging
This commit is contained in:
@@ -135,7 +135,7 @@ func (m *podContainerManagerImpl) killOnePid(pid int) error {
|
||||
// Hate parsing strings, but
|
||||
// vendor/github.com/opencontainers/runc/libcontainer/
|
||||
// also does this.
|
||||
klog.V(3).Infof("process with pid %v no longer exists", pid)
|
||||
klog.V(3).InfoS("Process no longer exists", "pid", pid)
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
@@ -158,23 +158,23 @@ func (m *podContainerManagerImpl) tryKillingCgroupProcesses(podCgroup CgroupName
|
||||
removed := map[int]bool{}
|
||||
for i := 0; i < 5; i++ {
|
||||
if i != 0 {
|
||||
klog.V(3).Infof("Attempt %v failed to kill all unwanted process from cgroup: %v. Retyring", i, podCgroup)
|
||||
klog.V(3).InfoS("Attempt failed to kill all unwanted process from cgroup, retrying", "attempt", i, "cgroupName", podCgroup)
|
||||
}
|
||||
errlist = []error{}
|
||||
for _, pid := range pidsToKill {
|
||||
if _, ok := removed[pid]; ok {
|
||||
continue
|
||||
}
|
||||
klog.V(3).Infof("Attempt to kill process with pid: %v from cgroup: %v", pid, podCgroup)
|
||||
klog.V(3).InfoS("Attempting to kill process from cgroup", "pid", pid, "cgroupName", podCgroup)
|
||||
if err := m.killOnePid(pid); err != nil {
|
||||
klog.V(3).Infof("failed to kill process with pid: %v from cgroup: %v", pid, podCgroup)
|
||||
klog.V(3).InfoS("Failed to kill process from cgroup", "pid", pid, "cgroupName", podCgroup, "err", err)
|
||||
errlist = append(errlist, err)
|
||||
} else {
|
||||
removed[pid] = true
|
||||
}
|
||||
}
|
||||
if len(errlist) == 0 {
|
||||
klog.V(3).Infof("successfully killed all unwanted processes from cgroup: %v", podCgroup)
|
||||
klog.V(3).InfoS("Successfully killed all unwanted processes from cgroup", "cgroupName", podCgroup)
|
||||
return nil
|
||||
}
|
||||
}
|
||||
@@ -185,7 +185,7 @@ func (m *podContainerManagerImpl) tryKillingCgroupProcesses(podCgroup CgroupName
|
||||
func (m *podContainerManagerImpl) Destroy(podCgroup CgroupName) error {
|
||||
// Try killing all the processes attached to the pod cgroup
|
||||
if err := m.tryKillingCgroupProcesses(podCgroup); err != nil {
|
||||
klog.Warningf("failed to kill all the processes attached to the %v cgroups", podCgroup)
|
||||
klog.InfoS("Failed to kill all the processes attached to cgroup", "cgroupName", podCgroup, "err", err)
|
||||
return fmt.Errorf("failed to kill all the processes attached to the %v cgroups : %v", podCgroup, err)
|
||||
}
|
||||
|
||||
@@ -195,7 +195,7 @@ func (m *podContainerManagerImpl) Destroy(podCgroup CgroupName) error {
|
||||
ResourceParameters: &ResourceConfig{},
|
||||
}
|
||||
if err := m.cgroupManager.Destroy(containerConfig); err != nil {
|
||||
klog.Warningf("failed to delete cgroup paths for %v : %v", podCgroup, err)
|
||||
klog.InfoS("Failed to delete cgroup paths", "cgroupName", podCgroup, "err", err)
|
||||
return fmt.Errorf("failed to delete cgroup paths for %v : %v", podCgroup, err)
|
||||
}
|
||||
return nil
|
||||
@@ -274,7 +274,7 @@ func (m *podContainerManagerImpl) GetAllPodsFromCgroups() (map[types.UID]CgroupN
|
||||
parts := strings.Split(basePath, podCgroupNamePrefix)
|
||||
// the uid is missing, so we log the unexpected cgroup not of form pod<uid>
|
||||
if len(parts) != 2 {
|
||||
klog.Errorf("pod cgroup manager ignoring unexpected cgroup %v because it is not a pod", cgroupfsPath)
|
||||
klog.InfoS("Pod cgroup manager ignored unexpected cgroup because it is not a pod", "path", cgroupfsPath)
|
||||
continue
|
||||
}
|
||||
podUID := parts[1]
|
||||
|
Reference in New Issue
Block a user