Set permissions of kube config like airskiff.yaml
This script mounts ~/.kube/config to a volume in the armada container, however this file is not readable by the armada user with its' default permissions. This change sets the permissions on the file to 0644 before mounting it, then sets the permissions back to the original values afterwards. Change-Id: I60ee02b7edfd763e826488e787f02cda7f73eb92
This commit is contained in:
parent
3f5af67768
commit
def39706da
@ -25,10 +25,17 @@ set -xe
|
||||
# Render documents
|
||||
${PEGLEG} site -r . render "${PL_SITE}" -o airskiff.yaml
|
||||
|
||||
# Set permissions o+r, beacause it need to be readable
|
||||
# Set permissions o+r, beacause these files need to be readable
|
||||
# for Armada in the container
|
||||
AIRSKIFF_PERMISSIONS=$(stat --format '%a' airskiff.yaml)
|
||||
KUBE_CONFIG_PERMISSIONS=$(stat --format '%a' ~/.kube/config)
|
||||
|
||||
sudo chmod 0644 airskiff.yaml
|
||||
sudo chmod 0644 ~/.kube/config
|
||||
|
||||
# In the event that this docker command fails, we want to continue the script
|
||||
# and reset the file permissions.
|
||||
set +e
|
||||
|
||||
# Download latest Armada image and deploy Airship components
|
||||
docker run --rm --net host -p 8000:8000 --name armada \
|
||||
@ -38,5 +45,6 @@ docker run --rm --net host -p 8000:8000 --name armada \
|
||||
quay.io/airshipit/armada:latest \
|
||||
apply /airskiff.yaml --target-manifest $TARGET_MANIFEST
|
||||
|
||||
# Set back permissions of the file
|
||||
# Set back permissions of the files
|
||||
sudo chmod "${AIRSKIFF_PERMISSIONS}" airskiff.yaml
|
||||
sudo chmod "${KUBE_CONFIG_PERMISSIONS}" ~/.kube/config
|
||||
|
Loading…
Reference in New Issue
Block a user