Skip to content

Commit 0d0cdda

Browse files
committed
handling the cmdline change in runsc
1 parent 32c6ad2 commit 0d0cdda

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

containers/registry.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,9 @@ func (r *Registry) getOrCreateContainer(pid uint32) *Container {
246246
cmdline := proc.GetCmdline(pid)
247247
parts := bytes.Split(cmdline, []byte{0})
248248
if len(parts) > 0 {
249+
cmd := parts[0]
249250
lastArg := parts[len(parts)-1]
250-
if bytes.HasSuffix(parts[0], []byte("runsc-sandbox")) && containerIdRegexp.Match(lastArg) {
251+
if (bytes.HasSuffix(cmd, []byte("runsc-sandbox")) || bytes.HasSuffix(cmd, []byte("runsc"))) && containerIdRegexp.Match(lastArg) {
251252
cg.ContainerId = string(lastArg)
252253
}
253254
}
@@ -309,6 +310,9 @@ func calcId(cg *cgroup.Cgroup, md *ContainerMetadata) ContainerID {
309310
default:
310311
return ""
311312
}
313+
if cg.ContainerId == "" {
314+
return ""
315+
}
312316
if md.labels["io.kubernetes.pod.name"] != "" {
313317
pod := md.labels["io.kubernetes.pod.name"]
314318
namespace := md.labels["io.kubernetes.pod.namespace"]

0 commit comments

Comments
 (0)