From 562f7f1f71aee0d8fbfa35864597c3d4e589a8ac Mon Sep 17 00:00:00 2001 From: Justin Santa Barbara Date: Thu, 10 Mar 2016 06:15:58 -0500 Subject: [PATCH] AWS kube-up: Clean up distro handling The only tested-working distros are vivid, wily & jessie. vivid should not really be used because it is no longer supported, so recommend wily or jessie instead. For other distros, recommend jessie instead. Fix #21218 --- cluster/aws/util.sh | 53 ++++++++++++++++++++++++++++++++++----------- 1 file changed, 40 insertions(+), 13 deletions(-) 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