mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 10:51:29 +00:00
Merge pull request #83625 from mrobson/log-cgroups
Add podCgroup to process kill events to allow for correlation
This commit is contained in:
commit
5ce75a8734
@ -23,7 +23,7 @@ import (
|
||||
"path"
|
||||
"strings"
|
||||
|
||||
"k8s.io/api/core/v1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
utilerrors "k8s.io/apimachinery/pkg/util/errors"
|
||||
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||
@ -160,23 +160,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. Retyring", i)
|
||||
klog.V(3).Infof("Attempt %v failed to kill all unwanted process from cgroup: %v. Retyring", i, podCgroup)
|
||||
}
|
||||
errlist = []error{}
|
||||
for _, pid := range pidsToKill {
|
||||
if _, ok := removed[pid]; ok {
|
||||
continue
|
||||
}
|
||||
klog.V(3).Infof("Attempt to kill process with pid: %v", pid)
|
||||
klog.V(3).Infof("Attempt to kill process with pid: %v from cgroup: %v", pid, podCgroup)
|
||||
if err := m.killOnePid(pid); err != nil {
|
||||
klog.V(3).Infof("failed to kill process with pid: %v", pid)
|
||||
klog.V(3).Infof("failed to kill process with pid: %v from cgroup: %v", pid, podCgroup)
|
||||
errlist = append(errlist, err)
|
||||
} else {
|
||||
removed[pid] = true
|
||||
}
|
||||
}
|
||||
if len(errlist) == 0 {
|
||||
klog.V(3).Infof("successfully killed all unwanted processes.")
|
||||
klog.V(3).Infof("successfully killed all unwanted processes from cgroup: %v", podCgroup)
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user