From 3bcfdab649d1360253509a8581c61595de317a05 Mon Sep 17 00:00:00 2001 From: hokutosei Date: Fri, 7 Aug 2015 06:47:10 +0000 Subject: [PATCH 1/3] added preemptible flag in gcloud compute instance-templates create --- cluster/gce/config-default.sh | 1 + cluster/gce/util.sh | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/cluster/gce/config-default.sh b/cluster/gce/config-default.sh index 68ea3239a34..f76f83819b2 100755 --- a/cluster/gce/config-default.sh +++ b/cluster/gce/config-default.sh @@ -26,6 +26,7 @@ MASTER_DISK_SIZE=${MASTER_DISK_SIZE:-20GB} MINION_DISK_TYPE=pd-standard MINION_DISK_SIZE=${MINION_DISK_SIZE:-100GB} REGISTER_MASTER_KUBELET=${REGISTER_MASTER:-true} +PREEMPTIBLE_MINION=false OS_DISTRIBUTION=${KUBE_OS_DISTRIBUTION:-debian} MASTER_IMAGE=${KUBE_GCE_MASTER_IMAGE:-container-vm-v20150806} diff --git a/cluster/gce/util.sh b/cluster/gce/util.sh index 6d5119eb2b9..08c37d2017b 100755 --- a/cluster/gce/util.sh +++ b/cluster/gce/util.sh @@ -398,6 +398,10 @@ function create-node-template { fi local attempt=1 + local preemptible_minions="" + if [[ "${PREEMPTIBLE_MINION}" == "true" ]]; then + preemptible_minions="--preemptible --maintenance-policy TERMINATE" + fi while true; do echo "Attempt ${attempt} to create ${1}" >&2 if ! gcloud compute instance-templates create "$1" \ @@ -408,7 +412,7 @@ function create-node-template { --image-project="${MINION_IMAGE_PROJECT}" \ --image "${MINION_IMAGE}" \ --tags "${MINION_TAG}" \ - --network "${NETWORK}" \ + --network "${NETWORK}" ${preemptible_minions} \ $2 \ --can-ip-forward \ --metadata-from-file "$3","$4" >&2; then From a68f0a853ff6f814de9308699cd1dc9f1b1fc581 Mon Sep 17 00:00:00 2001 From: Hokutosei Date: Fri, 7 Aug 2015 10:13:43 +0000 Subject: [PATCH 2/3] add missing preemptibel var --- cluster/gce/config-test.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/cluster/gce/config-test.sh b/cluster/gce/config-test.sh index bed62216851..9999804f6e9 100755 --- a/cluster/gce/config-test.sh +++ b/cluster/gce/config-test.sh @@ -27,6 +27,7 @@ MINION_DISK_TYPE=pd-standard MINION_DISK_SIZE=${MINION_DISK_SIZE:-100GB} REGISTER_MASTER_KUBELET=${REGISTER_MASTER:-false} KUBE_APISERVER_REQUEST_TIMEOUT=300 +PREEMPTIBLE_MINION=false OS_DISTRIBUTION=${KUBE_OS_DISTRIBUTION:-debian} MASTER_IMAGE=${KUBE_GCE_MASTER_IMAGE:-container-vm-v20150806} From eaacc1e5c1ed27b7b6a902316b2275d7cc88a920 Mon Sep 17 00:00:00 2001 From: jeanepaul Date: Sun, 9 Aug 2015 01:07:12 +0900 Subject: [PATCH 3/3] refactor coding style --- cluster/gce/config-default.sh | 2 +- cluster/gce/config-test.sh | 2 +- cluster/gce/util.sh | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/cluster/gce/config-default.sh b/cluster/gce/config-default.sh index f76f83819b2..6fa4e4be4f4 100755 --- a/cluster/gce/config-default.sh +++ b/cluster/gce/config-default.sh @@ -26,7 +26,7 @@ MASTER_DISK_SIZE=${MASTER_DISK_SIZE:-20GB} MINION_DISK_TYPE=pd-standard MINION_DISK_SIZE=${MINION_DISK_SIZE:-100GB} REGISTER_MASTER_KUBELET=${REGISTER_MASTER:-true} -PREEMPTIBLE_MINION=false +PREEMPTIBLE_MINION=${PREEMPTIBLE_MINION:-false} OS_DISTRIBUTION=${KUBE_OS_DISTRIBUTION:-debian} MASTER_IMAGE=${KUBE_GCE_MASTER_IMAGE:-container-vm-v20150806} diff --git a/cluster/gce/config-test.sh b/cluster/gce/config-test.sh index 9999804f6e9..316d59f2349 100755 --- a/cluster/gce/config-test.sh +++ b/cluster/gce/config-test.sh @@ -27,7 +27,7 @@ MINION_DISK_TYPE=pd-standard MINION_DISK_SIZE=${MINION_DISK_SIZE:-100GB} REGISTER_MASTER_KUBELET=${REGISTER_MASTER:-false} KUBE_APISERVER_REQUEST_TIMEOUT=300 -PREEMPTIBLE_MINION=false +PREEMPTIBLE_MINION=${PREEMPTIBLE_MINION:-false} OS_DISTRIBUTION=${KUBE_OS_DISTRIBUTION:-debian} MASTER_IMAGE=${KUBE_GCE_MASTER_IMAGE:-container-vm-v20150806} diff --git a/cluster/gce/util.sh b/cluster/gce/util.sh index 08c37d2017b..c4f2f21396a 100755 --- a/cluster/gce/util.sh +++ b/cluster/gce/util.sh @@ -401,7 +401,7 @@ function create-node-template { local preemptible_minions="" if [[ "${PREEMPTIBLE_MINION}" == "true" ]]; then preemptible_minions="--preemptible --maintenance-policy TERMINATE" - fi + fi while true; do echo "Attempt ${attempt} to create ${1}" >&2 if ! gcloud compute instance-templates create "$1" \ @@ -412,7 +412,8 @@ function create-node-template { --image-project="${MINION_IMAGE_PROJECT}" \ --image "${MINION_IMAGE}" \ --tags "${MINION_TAG}" \ - --network "${NETWORK}" ${preemptible_minions} \ + --network "${NETWORK}" \ + ${preemptible_minions} \ $2 \ --can-ip-forward \ --metadata-from-file "$3","$4" >&2; then