-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support selinux options with bind mounts play/gen #11793
Support selinux options with bind mounts play/gen #11793
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: baude The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What does the annotation look like? |
|
ff14410
to
893a484
Compare
LGTM |
pkg/specgen/generate/kube/kube.go
Outdated
// a selinux mount option exists for it | ||
for k, v := range opts.Annotations { | ||
// Make sure the z/Z option is not already there (from editing the YAML) | ||
if k == volumeSource.Source && !util.StringInSlice("z", options) && !util.StringInSlice("Z", options) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe, but I'm just checking, z
and Z
are unique values in options. I.e. there's no chance one of them would be part of another string value in options right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there are unique
LGTM |
/lgtm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor nits in gomega matchers.
Tests are red |
893a484
to
760b86d
Compare
fixed requests for clearer error messages. |
I am not crazy about these from a human perspective. Hard to know from looking at the Yaml what these mean. What happens if other annotations are in the code |
Would it make sense to extend this to support all volume options?
I agree, I think the path should be prefixed, e.g |
I dont love the idea of having to split the annotation key however...this is what iw as talking about yesterday |
Prefix is a good idea, we do use annotations for other things |
760b86d
to
8ea932f
Compare
When using play kube and generate kube, we need to support if bind mounts have selinux options. As kubernetes does not support selinux in this way, we tuck the selinux values into a pod annotation for generation of the kube yaml. Then on play, we check annotations to see if a value for the mount exists and apply it. Fixes BZ #1984081 Signed-off-by: Brent Baude <[email protected]>
8ea932f
to
1ff6a50
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
/lgtm |
/hold cancel |
When using play kube and generate kube, we need to support if bind
mounts have selinux options. As kubernetes does not support selinux in
this way, we tuck the selinux values into a pod annotation for
generation of the kube yaml. Then on play, we check annotations to see
if a value for the mount exists and apply it.
Fixes BZ #1984081
Signed-off-by: Brent Baude [email protected]
What this PR does / why we need it:
How to verify it
Which issue(s) this PR fixes:
Special notes for your reviewer: