diff --git a/cluster/aws/util.sh b/cluster/aws/util.sh index 8a68e9d810..01fbd8041a 100755 --- a/cluster/aws/util.sh +++ b/cluster/aws/util.sh @@ -49,24 +49,51 @@ MASTER_DISK_ID= # Well known tags TAG_KEY_MASTER_IP="kubernetes.io/master-ip" -# Defaults: ubuntu -> wily -if [[ "${KUBE_OS_DISTRIBUTION}" == "ubuntu" ]]; then - KUBE_OS_DISTRIBUTION=wily -fi - -# For GCE script compatibility OS_DISTRIBUTION=${KUBE_OS_DISTRIBUTION} -case "${KUBE_OS_DISTRIBUTION}" in - trusty|wheezy|jessie|vivid|wily|coreos) - source "${KUBE_ROOT}/cluster/aws/${KUBE_OS_DISTRIBUTION}/util.sh" +# Defaults: ubuntu -> wily +if [[ "${OS_DISTRIBUTION}" == "ubuntu" ]]; then + OS_DISTRIBUTION=wily +fi + +# Loads the distro-specific utils script. +# If the distro is not recommended, prints warnings or exits. +function load_distro_utils () { +case "${OS_DISTRIBUTION}" in + jessie) + ;; + wily) + ;; + vivid) + echo "vivid is currently end-of-life and does not get updates." >&2 + echo "Please consider using wily or jessie instead" >&2 + echo "(will continue in 10 seconds)" >&2 + sleep 10 + ;; + coreos) + echo "coreos is no longer supported by kube-up; please use jessie instead" >&2 + exit 2 + ;; + trusty) + echo "trusty is no longer supported by kube-up; please use jessie or wily instead" >&2 + exit 2 + ;; + wheezy) + echo "wheezy is no longer supported by kube-up; please use jessie instead" >&2 + exit 2 ;; *) - echo "Cannot start cluster using os distro: ${KUBE_OS_DISTRIBUTION}" >&2 + echo "Cannot start cluster using os distro: ${OS_DISTRIBUTION}" >&2 + echo "The current recommended distro is jessie" >&2 exit 2 ;; esac +source "${KUBE_ROOT}/cluster/aws/${OS_DISTRIBUTION}/util.sh" +} + +load_distro_utils + # This removes the final character in bash (somehow) AWS_REGION=${ZONE%?} @@ -266,7 +293,7 @@ function detect-security-groups { # Vars set: # AWS_IMAGE function detect-image () { -case "${KUBE_OS_DISTRIBUTION}" in +case "${OS_DISTRIBUTION}" in trusty|coreos) detect-trusty-image ;; @@ -283,7 +310,7 @@ case "${KUBE_OS_DISTRIBUTION}" in detect-jessie-image ;; *) - echo "Please specify AWS_IMAGE directly (distro ${KUBE_OS_DISTRIBUTION} not recognized)" + echo "Please specify AWS_IMAGE directly (distro ${OS_DISTRIBUTION} not recognized)" exit 2 ;; esac @@ -834,7 +861,7 @@ function subnet-setup { } function kube-up { - echo "Starting cluster using os distro: ${KUBE_OS_DISTRIBUTION}" >&2 + echo "Starting cluster using os distro: ${OS_DISTRIBUTION}" >&2 get-tokens