mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-07-19 18:54:07 +00:00
add minikube over virtualbox cgroup format (#882)
This commit is contained in:
parent
5614e153f3
commit
4159938cea
@ -132,9 +132,23 @@ func extractCgroup(lines []string) string {
|
||||
return ""
|
||||
}
|
||||
|
||||
// cgroup in the /proc/<pid>/cgroup may look something like
|
||||
//
|
||||
// /system.slice/docker-<ID>.scope
|
||||
// /system.slice/containerd-<ID>.scope
|
||||
// /kubepods.slice/kubepods-burstable.slice/kubepods-burstable-pod3beae8e0_164d_4689_a087_efd902d8c2ab.slice/docker-<ID>.scope
|
||||
// /kubepods/besteffort/pod7709c1d5-447c-428f-bed9-8ddec35c93f4/<ID>
|
||||
//
|
||||
// This function extract the <ID> out of the cgroup path, the <ID> should match
|
||||
// the "Container ID:" field when running kubectl describe pod <POD>
|
||||
//
|
||||
func normalizeCgroup(cgrouppath string) string {
|
||||
basename := strings.TrimSpace(path.Base(cgrouppath))
|
||||
|
||||
if strings.Contains(basename, "-") {
|
||||
basename = basename[strings.Index(basename, "-") + 1:]
|
||||
}
|
||||
|
||||
if strings.Contains(basename, ".") {
|
||||
return strings.TrimSuffix(basename, filepath.Ext(basename))
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user