chore: do not force :Z
flag in Docker volume mount
#1055
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Follow up on #1054
This PR adopts the approach seen in
etcd
for compatibilty with SELinux:https://github.com/kubernetes/kubernetes/blob/ad9b60e2c9ddb21e8b00cabbe27e639638a0ea88/cluster/images/etcd/Makefile#L76-L81
Instead of forcing
:Z
, detect if SElinux is enabled and add:z
on demand.According to the documentation and multiple examples I could find, using
:z
seems to be less dangerous than:Z
.I tested this on my non-SELinux enabled system and the volume mount does not use
:z
.I also tested by running
make docker-generate SELINUX_ENABLED=1
and:z
is correctly added to volume mount.@jvillal-amp what is your opinion on using
:z
vs:Z
?Can you confirm if this PR still allows you to use
make docker-generate
in your SELinux environmnet?EDIT: I removed the trailing slash in the volume mount source in purpose, as that is not necessary.