mirror of https://github.com/k3s-io/k3s
Add a facility for custom user startup scripts via env variable
parent
d8c1a9a4fb
commit
15aa0c4415
|
@ -65,7 +65,7 @@ function set-good-motd() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function curl-metadata() {
|
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() {
|
function set-kube-env() {
|
||||||
|
@ -661,6 +661,15 @@ if [[ -z "${is_push}" ]]; then
|
||||||
remove-docker-artifacts
|
remove-docker-artifacts
|
||||||
run-salt
|
run-salt
|
||||||
set-good-motd
|
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 =="
|
echo "== kube-up node config done =="
|
||||||
else
|
else
|
||||||
echo "== kube-push node config starting =="
|
echo "== kube-push node config starting =="
|
||||||
|
|
Loading…
Reference in New Issue