@@ -795,6 +795,7 @@ function kctf_cluster_resize_usage {
795795 echo -e " -h|--help print this help" >&2
796796 echo -e " --machine-type machine type to use" >&2
797797 echo -e " to list available types, run: gcloud compute machine-types list --zones=\" ${ZONE} \" " >&2
798+ echo -e " --spot use spot VMs (reduced cost but no availability guarantees)" >&2
798799 echo -e " --min-nodes (required) minimum number of nodes in the cluster" >&2
799800 echo -e " --max-nodes (required) maximum number of nodes in the cluster" >&2
800801 echo -e " --num-nodes (required) initial number of nodes in the cluster" >&2
@@ -809,7 +810,7 @@ function kctf_cluster_resize {
809810 fi
810811
811812 OPTS=" h"
812- LONGOPTS=" help,machine-type:,min-nodes:,max-nodes:,num-nodes:,pool-name:,old-pool:"
813+ LONGOPTS=" help,machine-type:,spot, min-nodes:,max-nodes:,num-nodes:,pool-name:,old-pool:"
813814 PARSED=$( ${GETOPT} --options=$OPTS --longoptions=$LONGOPTS --name " kctf cluster resize" -- " $@ " )
814815 if [[ $? -ne 0 ]]; then
815816 kctf_cluster_resize_usage
@@ -818,6 +819,7 @@ function kctf_cluster_resize {
818819 eval set -- " $PARSED "
819820
820821 MACHINE_TYPE=" n2-standard-4"
822+ SPOT=
821823 MIN_NODES=
822824 MAX_NODES=
823825 NUM_NODES=
@@ -833,6 +835,10 @@ function kctf_cluster_resize {
833835 MACHINE_TYPE=" $2 "
834836 shift 2
835837 ;;
838+ --spot)
839+ SPOT=1
840+ shift 1
841+ ;;
836842 --min-nodes)
837843 MIN_NODES=" $2 "
838844 shift 2
@@ -900,6 +906,7 @@ function kctf_cluster_resize {
900906 gcloud container node-pools create " ${NEW_POOL_NAME} " \
901907 --cluster=" ${CLUSTER_NAME} " \
902908 --machine-type=" ${MACHINE_TYPE} " \
909+ ${SPOT: +--spot} \
903910 --enable-autorepair \
904911 --enable-autoupgrade \
905912 --num-nodes=" ${NUM_NODES} " \
0 commit comments