Skip to content

Commit fbfa300

Browse files
raajheshkannaapoiana
authored andcommitted
fix(plugins/container): guard against nil RuntimeSpec in CNI fallback
containerd v2.3.0 (CRI API v0.36) does not populate the runtimeSpec field in sandbox info JSON. This field is cri-o specific. When CNIResult is also absent, the fallback branch dereferences a nil pointer in cniSandboxInfo.RuntimeSpec.Annotations and the plugin panics. All Falco DaemonSet pods on a containerd v2.3.0 node go into CrashLoopBackOff. Wrap the annotation lookup in a nil check, matching the existing pattern used for info.RuntimeSpec at cri.go:92 and :126. Closes #1353 Signed-off-by: Raajhesh Kannaa Chidambaram <495042+raajheshkannaa@users.noreply.github.com>
1 parent 80ce456 commit fbfa300

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

  • plugins/container/go-worker/pkg/container

plugins/container/go-worker/pkg/container/cri.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,10 @@ func (c *criEngine) ctrToInfo(ctx context.Context, ctr *v1.ContainerStatus, podS
240240
if err != nil {
241241
cniJson = string(bytes)
242242
}
243-
} else if val, ok := cniInfo.RuntimeSpec.Annotations["io.kubernetes.cri-o.CNIResult"]; ok {
244-
cniJson = val
243+
} else if cniInfo.RuntimeSpec != nil {
244+
if val, ok := cniInfo.RuntimeSpec.Annotations["io.kubernetes.cri-o.CNIResult"]; ok {
245+
cniJson = val
246+
}
245247
}
246248

247249
if len(cniJson) > maxCNILen {

0 commit comments

Comments
 (0)