From c5683eb7f1c7b3451e4ac33f61eaa1b7b23682a8 Mon Sep 17 00:00:00 2001 From: Joe Beda Date: Fri, 6 Jun 2014 22:17:55 -0700 Subject: [PATCH 1/3] Don't use scopes we don't need when creating VMs --- cluster/kube-up.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cluster/kube-up.sh b/cluster/kube-up.sh index 34770379586..89633dcce81 100755 --- a/cluster/kube-up.sh +++ b/cluster/kube-up.sh @@ -78,7 +78,7 @@ gcloud compute instances create ${MASTER_NAME}\ --machine-type ${MASTER_SIZE} \ --image ${IMAGE} \ --tags ${MASTER_TAG} \ - --scopes compute-rw storage-full \ + --no-scopes \ --metadata-from-file startup-script=${KUBE_TEMP}/master-start.sh & for (( i=0; i<${#MINION_NAMES[@]}; i++)); do @@ -95,6 +95,7 @@ for (( i=0; i<${#MINION_NAMES[@]}; i++)); do --machine-type ${MINION_SIZE} \ --image ${IMAGE} \ --tags ${MINION_TAG} \ + --no-scopes \ --can-ip-forward \ --metadata-from-file startup-script=${KUBE_TEMP}/minion-start-${i}.sh & From 156ebe2ce25a82ec21453cf2a4ed70b70418e847 Mon Sep 17 00:00:00 2001 From: Joe Beda Date: Sun, 8 Jun 2014 07:31:12 -0700 Subject: [PATCH 2/3] Set 'auto restart' bit on VMs. --- cluster/kube-up.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cluster/kube-up.sh b/cluster/kube-up.sh index 89633dcce81..dcf021debd8 100755 --- a/cluster/kube-up.sh +++ b/cluster/kube-up.sh @@ -79,6 +79,7 @@ gcloud compute instances create ${MASTER_NAME}\ --image ${IMAGE} \ --tags ${MASTER_TAG} \ --no-scopes \ + --restart-on-failure \ --metadata-from-file startup-script=${KUBE_TEMP}/master-start.sh & for (( i=0; i<${#MINION_NAMES[@]}; i++)); do @@ -96,6 +97,7 @@ for (( i=0; i<${#MINION_NAMES[@]}; i++)); do --image ${IMAGE} \ --tags ${MINION_TAG} \ --no-scopes \ + --restart-on-failure \ --can-ip-forward \ --metadata-from-file startup-script=${KUBE_TEMP}/minion-start-${i}.sh & From 81629733e13f3c3c9b7535bac7cafde30b098aec Mon Sep 17 00:00:00 2001 From: Joe Beda Date: Sun, 8 Jun 2014 08:07:34 -0700 Subject: [PATCH 3/3] Handle breaking change in 'gcloud compute routes create' with version check. --- cluster/kube-up.sh | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/cluster/kube-up.sh b/cluster/kube-up.sh index dcf021debd8..75113490b50 100755 --- a/cluster/kube-up.sh +++ b/cluster/kube-up.sh @@ -82,6 +82,8 @@ gcloud compute instances create ${MASTER_NAME}\ --restart-on-failure \ --metadata-from-file startup-script=${KUBE_TEMP}/master-start.sh & +GCLOUD_VERSION=$(gcloud version | grep compute | cut -f 2 -d ' ') + for (( i=0; i<${#MINION_NAMES[@]}; i++)); do ( echo "#! /bin/bash" @@ -101,10 +103,20 @@ for (( i=0; i<${#MINION_NAMES[@]}; i++)); do --can-ip-forward \ --metadata-from-file startup-script=${KUBE_TEMP}/minion-start-${i}.sh & - gcloud compute routes create ${MINION_NAMES[$i]} \ - --project ${PROJECT} \ - --destination-range ${MINION_IP_RANGES[$i]} \ - --next-hop-instance ${ZONE}/instances/${MINION_NAMES[$i]} & + # 'gcloud compute' past 2014.06.08 breaks the way we are specifying + # --next-hop-instance and there is no way to be compatible with both versions. + if [[ $GCLOUD_VERSION < "2014.06.08" ]]; then + gcloud compute routes create ${MINION_NAMES[$i]} \ + --project ${PROJECT} \ + --destination-range ${MINION_IP_RANGES[$i]} \ + --next-hop-instance ${ZONE}/instances/${MINION_NAMES[$i]} & + else + gcloud compute routes create ${MINION_NAMES[$i]} \ + --project ${PROJECT} \ + --destination-range ${MINION_IP_RANGES[$i]} \ + --next-hop-instance ${MINION_NAMES[$i]} \ + --next-hop-instance-zone ${ZONE} & + fi done FAIL=0