Skip to content

Commit eeabc3a

Browse files
committed
selinux: Ignore pods with Recursive policy
Pod that explicitly opted into "seLinuxChangePolicy: Recursive" should not report conflicts with another SELinux labels. They will only report a conflict with other Pods using the same volume with "seLinuxChangePolicy: Mount" (or nil).
1 parent 4b12e89 commit eeabc3a

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

pkg/controller/volume/selinuxwarning/selinux_warning_controller.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -451,10 +451,9 @@ func (c *Controller) syncPod(ctx context.Context, pod *v1.Pod) error {
451451
continue
452452
}
453453

454-
// Ignore how the volume is going to be mounted.
455-
// Report any errors when a volume is used by two pods with different SELinux labels regardless of their
456-
// SELinuxChangePolicy
457-
seLinuxLabel := mountInfo.SELinuxProcessLabel
454+
// Use the same label as kubelet will use for mount -o context.
455+
// If the Pod has opted in to Recursive policy, it will be empty string here and no conflicts will be reported for it.
456+
seLinuxLabel := mountInfo.SELinuxMountLabel
458457

459458
err = c.syncVolume(logger, pod, spec, seLinuxLabel, mountInfo.PluginSupportsSELinuxContextMount)
460459
if err != nil {

0 commit comments

Comments
 (0)