|
@@ -18,6 +18,7 @@ var (
|
|
|
|
|
|
|
|
dockerIdRegexp = regexp.MustCompile(`([a-z0-9]{64})`)
|
|
dockerIdRegexp = regexp.MustCompile(`([a-z0-9]{64})`)
|
|
|
crioIdRegexp = regexp.MustCompile(`crio-([a-z0-9]{64})`)
|
|
crioIdRegexp = regexp.MustCompile(`crio-([a-z0-9]{64})`)
|
|
|
|
|
+ containerdIdRegexp = regexp.MustCompile(`cri-containerd-([a-z0-9]{64})`)
|
|
|
lxcIdRegexp = regexp.MustCompile(`/lxc/([^/]+)`)
|
|
lxcIdRegexp = regexp.MustCompile(`/lxc/([^/]+)`)
|
|
|
systemSliceIdRegexp = regexp.MustCompile(`(/system\.slice/([^/]+))`)
|
|
systemSliceIdRegexp = regexp.MustCompile(`(/system\.slice/([^/]+))`)
|
|
|
)
|
|
)
|
|
@@ -29,6 +30,7 @@ const (
|
|
|
ContainerTypeStandaloneProcess
|
|
ContainerTypeStandaloneProcess
|
|
|
ContainerTypeDocker
|
|
ContainerTypeDocker
|
|
|
ContainerTypeCrio
|
|
ContainerTypeCrio
|
|
|
|
|
+ ContainerTypeContainerd
|
|
|
ContainerTypeLxc
|
|
ContainerTypeLxc
|
|
|
ContainerTypeSystemdService
|
|
ContainerTypeSystemdService
|
|
|
)
|
|
)
|
|
@@ -41,6 +43,8 @@ func (t ContainerType) String() string {
|
|
|
return "docker"
|
|
return "docker"
|
|
|
case ContainerTypeCrio:
|
|
case ContainerTypeCrio:
|
|
|
return "crio"
|
|
return "crio"
|
|
|
|
|
+ case ContainerTypeContainerd:
|
|
|
|
|
+ return "cri-containerd"
|
|
|
case ContainerTypeLxc:
|
|
case ContainerTypeLxc:
|
|
|
return "lxc"
|
|
return "lxc"
|
|
|
case ContainerTypeSystemdService:
|
|
case ContainerTypeSystemdService:
|
|
@@ -184,11 +188,15 @@ func containerByCgroup(path string) (ContainerType, string, error) {
|
|
|
return ContainerTypeUnknown, "", fmt.Errorf("invalid docker cgroup %s", path)
|
|
return ContainerTypeUnknown, "", fmt.Errorf("invalid docker cgroup %s", path)
|
|
|
}
|
|
}
|
|
|
return ContainerTypeDocker, matches[1], nil
|
|
return ContainerTypeDocker, matches[1], nil
|
|
|
- case "kubepods":
|
|
|
|
|
|
|
+ case "kubepods", "kubepods.slice":
|
|
|
crioMatches := crioIdRegexp.FindStringSubmatch(path)
|
|
crioMatches := crioIdRegexp.FindStringSubmatch(path)
|
|
|
if crioMatches != nil {
|
|
if crioMatches != nil {
|
|
|
return ContainerTypeCrio, crioMatches[1], nil
|
|
return ContainerTypeCrio, crioMatches[1], nil
|
|
|
}
|
|
}
|
|
|
|
|
+ containerdMatches := containerdIdRegexp.FindStringSubmatch(path)
|
|
|
|
|
+ if containerdMatches != nil {
|
|
|
|
|
+ return ContainerTypeContainerd, containerdMatches[1], nil
|
|
|
|
|
+ }
|
|
|
matches := dockerIdRegexp.FindStringSubmatch(path)
|
|
matches := dockerIdRegexp.FindStringSubmatch(path)
|
|
|
if matches == nil {
|
|
if matches == nil {
|
|
|
return ContainerTypeUnknown, "", fmt.Errorf("invalid docker cgroup %s", path)
|
|
return ContainerTypeUnknown, "", fmt.Errorf("invalid docker cgroup %s", path)
|