From 19cf622e886b97b0f4d40ab16ffbca44577fdfd3 Mon Sep 17 00:00:00 2001 From: Justin Santa Barbara Date: Fri, 12 Feb 2016 10:52:59 -0500 Subject: [PATCH] AWS kube-up: make the bootstrap script run every boot This is so we have the same behaviour as on GCE. This also lets us change the bootstrap script or the config, which is nice. Instance data is immutable on AWS once it is booted. Fix #21150 --- cluster/aws/templates/configure-vm-aws.sh | 2 +- cluster/aws/util.sh | 22 ++++++++++++++++++++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/cluster/aws/templates/configure-vm-aws.sh b/cluster/aws/templates/configure-vm-aws.sh index 774da61e0c9..beb8f6b2a1b 100755 --- a/cluster/aws/templates/configure-vm-aws.sh +++ b/cluster/aws/templates/configure-vm-aws.sh @@ -34,7 +34,7 @@ ensure-packages() { } set-kube-env() { - local kube_env_yaml="${INSTALL_DIR}/kube_env.yaml" + local kube_env_yaml="/etc/kubernetes/kube_env.yaml" # kube-env has all the environment variables we care about, in a flat yaml format eval "$(python -c ' diff --git a/cluster/aws/util.sh b/cluster/aws/util.sh index 3a18e744a2f..9b43b5d5e45 100755 --- a/cluster/aws/util.sh +++ b/cluster/aws/util.sh @@ -982,7 +982,16 @@ function start-master() { echo "" echo "wget -O bootstrap ${BOOTSTRAP_SCRIPT_URL}" echo "chmod +x bootstrap" - echo "./bootstrap" + echo "mkdir -p /etc/kubernetes" + echo "mv kube_env.yaml /etc/kubernetes" + echo "mv bootstrap /etc/kubernetes/" + echo "cat > /etc/rc.local << EOF_RC_LOCAL" + echo "#!/bin/sh -e" + # We want to be sure that we don't pass an argument to bootstrap + echo "/etc/kubernetes/bootstrap" + echo "exit 0" + echo "EOF_RC_LOCAL" + echo "/etc/kubernetes/bootstrap" ) > "${KUBE_TEMP}/master-user-data" # Compress the data to fit under the 16KB limit (cloud-init accepts compressed data) @@ -1067,7 +1076,16 @@ function start-minions() { echo "" echo "wget -O bootstrap ${BOOTSTRAP_SCRIPT_URL}" echo "chmod +x bootstrap" - echo "./bootstrap" + echo "mkdir -p /etc/kubernetes" + echo "mv kube_env.yaml /etc/kubernetes" + echo "mv bootstrap /etc/kubernetes/" + echo "cat > /etc/rc.local << EOF_RC_LOCAL" + echo "#!/bin/sh -e" + # We want to be sure that we don't pass an argument to bootstrap + echo "/etc/kubernetes/bootstrap" + echo "exit 0" + echo "EOF_RC_LOCAL" + echo "/etc/kubernetes/bootstrap" ) > "${KUBE_TEMP}/node-user-data" # Compress the data to fit under the 16KB limit (cloud-init accepts compressed data)