diff --git a/cluster/gce/config-default.sh b/cluster/gce/config-default.sh index 68ea3239a34..6fa4e4be4f4 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=${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 bed62216851..316d59f2349 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=${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 b41a754a3a5..e0f54ab427a 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" \ @@ -409,6 +413,7 @@ function create-node-template { --image "${MINION_IMAGE}" \ --tags "${MINION_TAG}" \ --network "${NETWORK}" \ + ${preemptible_minions} \ $2 \ --can-ip-forward \ --metadata-from-file "$3","$4" >&2; then