Skip to content

Commit

Permalink
AWS kube-up: Clean up distro handling
Browse files Browse the repository at this point in the history
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 kubernetes#21218
  • Loading branch information
justinsb committed Mar 10, 2016
1 parent d7a87c2 commit 562f7f1
Showing 1 changed file with 39 additions and 12 deletions.
51 changes: 39 additions & 12 deletions cluster/aws/util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,24 +49,51 @@ MASTER_DISK_ID=
# Well known tags
TAG_KEY_MASTER_IP="kubernetes.io/master-ip"

OS_DISTRIBUTION=${KUBE_OS_DISTRIBUTION}

# Defaults: ubuntu -> wily
if [[ "${KUBE_OS_DISTRIBUTION}" == "ubuntu" ]]; then
KUBE_OS_DISTRIBUTION=wily
if [[ "${OS_DISTRIBUTION}" == "ubuntu" ]]; then
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"
# 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%?}

Expand Down Expand Up @@ -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
;;
Expand All @@ -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
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 562f7f1

Please sign in to comment.