Skip to content

Commit

Permalink
Add a facility for custom user startup scripts via env variable
Browse files Browse the repository at this point in the history
  • Loading branch information
brendandburns committed Dec 5, 2015
1 parent d8c1a9a commit 15aa0c4
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion cluster/gce/configure-vm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function set-good-motd() {
}

function curl-metadata() {
curl --fail --silent -H 'Metadata-Flavor: Google' "http://metadata/computeMetadata/v1/instance/attributes/${1}"
curl --fail --retry 5 --silent -H 'Metadata-Flavor: Google' "http://metadata/computeMetadata/v1/instance/attributes/${1}"
}

function set-kube-env() {
Expand Down Expand Up @@ -661,6 +661,15 @@ if [[ -z "${is_push}" ]]; then
remove-docker-artifacts
run-salt
set-good-motd

if curl-metadata k8s-user-startup-script > "${INSTALL_DIR}/k8s-user-script.sh"; then
user_script=$(cat "${INSTALL_DIR}/k8s-user-script.sh")
fi
if [[ ! -z ${user_script:-} ]]; then
chmod u+x "${INSTALL_DIR}/k8s-user-script.sh"
echo "== running user startup script =="
"${INSTALL_DIR}/k8s-user-script.sh"
fi
echo "== kube-up node config done =="
else
echo "== kube-push node config starting =="
Expand Down

0 comments on commit 15aa0c4

Please sign in to comment.