Automator: update common-files@master in istio/istio.io@master (#14497)

This commit is contained in:
Istio Automation 2024-01-18 13:35:33 -08:00 committed by GitHub
parent 7d13efbe8f
commit 6ca8051beb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 3 deletions

View File

@ -1 +1 @@
372be4999661538e00683895441a643f792f965b
531a8c76730d2adb82f0813313971704b1e72442

View File

@ -130,12 +130,17 @@ fi
# echo ${CONDITIONAL_HOST_MOUNTS}
# This function checks if the file exists. If it does, it creates a randomly named host location
# for the file, adds it to the host KUBECONFIG, and creates a mount for it.
# for the file, adds it to the host KUBECONFIG, and creates a mount for it. Note that we use a copy
# of the original file, so that the container can write to it.
add_KUBECONFIG_if_exists () {
if [[ -f "$1" ]]; then
local local_config
local_config="$(mktemp)"
cp "${1}" "${local_config}"
kubeconfig_random="$(od -vAn -N4 -tx /dev/random | tr -d '[:space:]' | cut -c1-8)"
container_kubeconfig+="/config/${kubeconfig_random}:"
CONDITIONAL_HOST_MOUNTS+="--mount type=bind,source=${1},destination=/config/${kubeconfig_random},readonly "
CONDITIONAL_HOST_MOUNTS+="--mount type=bind,source=${local_config},destination=/config/${kubeconfig_random} "
fi
}