cri: warn when a sandbox controller returns an SELinux label

CRI owns the pod SELinux label, so a label returned by the sandbox
controller is ignored. Log a warning when it differs from the one CRI
allocated.

Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
This commit is contained in:
Maksym Pavlenko committed 2026-10-30 12:18:21 -07:00
1 parent 5cce0c668b
commit e7b76482e2
1 file changed
+9
+9
View File
@@ -362,6 +362,15 @@ func (c *criService) RunPodSandbox(ctx context.Context, r *runtime.RunPodSandbox
}
}
// CRI owns the pod SELinux label; a label from the controller is ignored.
if l := ctrl.Labels["selinux_label"]; l != "" && l != sandbox.ProcessLabel {
log.G(ctx).WithFields(log.Fields{
"sandbox": id,
"controller_label": l,
"selinux_label": sandbox.ProcessLabel,
}).Warn("ignoring the SELinux label returned by the sandbox controller, using the label allocated by CRI")
}
sandboxInfo.Labels = ctrl.Labels
sandboxInfo.Spec = ctrl.Spec