Skip to content
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

Fix SELinux settings for mounted volumes #24662

Merged
merged 1 commit into from
May 6, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 8 additions & 2 deletions build/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ function kube::build::prepare_output() {
# On RHEL/Fedora SELinux is enabled by default and currently breaks docker
# volume mounts. We can work around this by explicitly adding a security
# context to the _output directory.
# Details: https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Resource_Management_and_Linux_Containers_Guide/sec-Sharing_Data_Across_Containers.html#sec-Mounting_a_Host_Directory_to_a_Container
# Details: http://www.projectatomic.io/blog/2015/06/using-volumes-with-docker-can-cause-problems-with-selinux/
if which selinuxenabled &>/dev/null && \
selinuxenabled && \
which chcon >/dev/null ; then
Expand All @@ -330,6 +330,12 @@ function kube::build::prepare_output() {
echo " Continuing, but this build may fail later if SELinux prevents access."
fi
fi
number=${#DOCKER_MOUNT_ARGS[@]}
for (( i=0; i<number; i++ )); do
if [[ "${DOCKER_MOUNT_ARGS[i]}" =~ "${KUBE_ROOT}" ]]; then
DOCKER_MOUNT_ARGS[i]="${DOCKER_MOUNT_ARGS[i]}:Z"
fi
done
fi

}
Expand Down Expand Up @@ -1491,7 +1497,7 @@ function kube::release::docker::release() {
# Activate credentials for the k8s.production.user@gmail.com
gcloud config set account k8s.production.user@gmail.com
fi

for arch in "${KUBE_SERVER_PLATFORMS[@]##*/}"; do
for binary in "${binaries[@]}"; do

Expand Down