Skip to content

Commit

Permalink
Automator: update common-files@master in istio/community@master (#1304)
Browse files Browse the repository at this point in the history
  • Loading branch information
istio-testing authored Jan 18, 2024
1 parent af3c1a8 commit f1a94af
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion common/.commonfiles.sha
Original file line number Diff line number Diff line change
@@ -1 +1 @@
372be4999661538e00683895441a643f792f965b
531a8c76730d2adb82f0813313971704b1e72442
9 changes: 7 additions & 2 deletions common/scripts/setup_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit f1a94af

Please sign in to comment.