Skip to content

Commit 3ebbe57

Browse files
committed
Add a note about Conflicts return value
1 parent 98dca81 commit 3ebbe57

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

pkg/controller/volume/selinuxwarning/translator/selinux_translator.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,13 @@ func (c *ControllerSELinuxTranslator) SELinuxOptionsToFileLabel(opts *v1.SELinux
6060
// Conflicts returns true if two SELinux labels conflict.
6161
// These labels must be generated by SELinuxOptionsToFileLabel above
6262
// (the function expects strict nr. of elements in the labels).
63-
// Since this translator cannot default missing components,
64-
// the first three components treated as incomparable when missing and they do not
65-
// conflict with anything.
63+
// Since this translator cannot default missing label components from the operating system,
64+
// the first three components can be empty. In this case, the empty components don't lead to a
65+
// conflict when compared to a real SELinux label and this function returns false (as no
66+
// conflict can be detected).
6667
// The last component (level) is always compared, as it is not defaulted by the operating system.
6768
// Example: "system_u:system_r:container_t:s0:c1,c2" *does not* conflict with ":::s0:c1,c2",
68-
// because the node that will run such a Pod may expand "":::s0:c1,c2" to "system_u:system_r:container_t:s0:c1,c2".
69+
// because the node that will run such a Pod may expand ":::s0:c1,c2" to "system_u:system_r:container_t:s0:c1,c2".
6970
// However: "system_u:system_r:container_t:s0:c1,c2" *does* conflict with ":::s0:c98,c99".
7071
// And ":::s0:c1,c2" *does* conflict with "" or ":::", because it's never defaulted by the OS.
7172
func (c *ControllerSELinuxTranslator) Conflicts(labelA, labelB string) bool {

0 commit comments

Comments
 (0)