Skip to content

Commit 34f164a

Browse files
committed
Merge pull request kubernetes#12384 from Hokutosei/master
added preemptible flag in gcloud compute instance-templates create
2 parents 933c855 + eaacc1e commit 34f164a

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

cluster/gce/config-default.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ MASTER_DISK_SIZE=${MASTER_DISK_SIZE:-20GB}
2626
MINION_DISK_TYPE=pd-standard
2727
MINION_DISK_SIZE=${MINION_DISK_SIZE:-100GB}
2828
REGISTER_MASTER_KUBELET=${REGISTER_MASTER:-true}
29+
PREEMPTIBLE_MINION=${PREEMPTIBLE_MINION:-false}
2930

3031
OS_DISTRIBUTION=${KUBE_OS_DISTRIBUTION:-debian}
3132
MASTER_IMAGE=${KUBE_GCE_MASTER_IMAGE:-container-vm-v20150806}

cluster/gce/config-test.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ MINION_DISK_TYPE=pd-standard
2727
MINION_DISK_SIZE=${MINION_DISK_SIZE:-100GB}
2828
REGISTER_MASTER_KUBELET=${REGISTER_MASTER:-false}
2929
KUBE_APISERVER_REQUEST_TIMEOUT=300
30+
PREEMPTIBLE_MINION=${PREEMPTIBLE_MINION:-false}
3031

3132
OS_DISTRIBUTION=${KUBE_OS_DISTRIBUTION:-debian}
3233
MASTER_IMAGE=${KUBE_GCE_MASTER_IMAGE:-container-vm-v20150806}

cluster/gce/util.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,10 @@ function create-node-template {
398398
fi
399399

400400
local attempt=1
401+
local preemptible_minions=""
402+
if [[ "${PREEMPTIBLE_MINION}" == "true" ]]; then
403+
preemptible_minions="--preemptible --maintenance-policy TERMINATE"
404+
fi
401405
while true; do
402406
echo "Attempt ${attempt} to create ${1}" >&2
403407
if ! gcloud compute instance-templates create "$1" \
@@ -409,6 +413,7 @@ function create-node-template {
409413
--image "${MINION_IMAGE}" \
410414
--tags "${MINION_TAG}" \
411415
--network "${NETWORK}" \
416+
${preemptible_minions} \
412417
$2 \
413418
--can-ip-forward \
414419
--metadata-from-file "$3","$4" >&2; then

0 commit comments

Comments
 (0)