Code change:
cc:
It was broken by . I'll send a fix in a sec.
Sorry & thanks for fixing.

Related discussion:
text: --project "${PROJECT}" || true; } <ins> # Assumes: # - NUM_MIGS # - NODE_INSTANCE_PREFIX # - PROJECT # - ZONE # - ENABLE_NODE_AUTOSCALER # - TARGET_NODE_UTILIZATION # - AUTOSCALER_MAX_NODES # - AUTOSCALER_MIN_NODES </ins> function create-autoscaler() { # Create autoscaler for nodes if requested if [[ "${ENABLE_NODE_AUTOSCALER}" == "true" ]]; then <del> METRICS="" </del> <ins> local metrics="" </ins> # Current usage <del> METRICS+="--custom-metric-utilization metric=custom.cloudmonitoring.googleapis.com/kubernetes.io/cpu/node_utilization," METRICS+="utilization-target=${TARGET_NODE_UTILIZATION},utilization-target-type=GAUGE " METRICS+="--custom-metric-utilization metric=custom.cloudmonitoring.googleapis.com/kubernetes.io/memory/node_utilization," METRICS+="utilization-target=${TARGET_NODE_UTILIZATION},utilization-target-type=GAUGE " </del> <ins> metrics+="--custom-metric-utilization metric=custom.cloudmonitoring.googleapis.com/kubernetes.io/cpu/node_utilization," metrics+="utilization-target=${TARGET_NODE_UTILIZATION},utilization-target-type=GAUGE " metrics+="--custom-metric-utilization metric=custom.cloudmonitoring.googleapis.com/kubernetes.io/memory/node_utilization," metrics+="utilization-target=${TARGET_NODE_UTILIZATION},utilization-target-type=GAUGE " </ins> # Reservation <del> METRICS+="--custom-metric-utilization metric=custom.cloudmonitoring.googleapis.com/kubernetes.io/cpu/node_reservation," METRICS+="utilization-target=${TARGET_NODE_UTILIZATION},utilization-target-type=GAUGE " METRICS+="--custom-metric-utilization metric=custom.cloudmonitoring.googleapis.com/kubernetes.io/memory/node_reservation," METRICS+="utilization-target=${TARGET_NODE_UTILIZATION},utilization-target-type=GAUGE " </del> <ins> metrics+="--custom-metric-utilization metric=custom.cloudmonitoring.googleapis.com/kubernetes.io/cpu/node_reservation," metrics+="utilization-target=${TARGET_NODE_UTILIZATION},utilization-target-type=GAUGE " metrics+="--custom-metric-utilization metric=custom.cloudmonitoring.googleapis.com/kubernetes.io/memory/node_reservation," metrics+="utilization-target=${TARGET_NODE_UTILIZATION},utilization-target-type=GAUGE " </ins> echo "Creating node autoscalers." <del> local max_instances_per_mig=$(((${AUTOSCALER_MAX_NODES} + ${num_migs} - 1) / ${num_migs})) local last_max_instances=$((${AUTOSCALER_MAX_NODES} - (${num_migs} - 1) * ${max_instances_per_mig})) local min_instances_per_mig=$(((${AUTOSCALER_MIN_NODES} + ${num_migs} - 1) / ${num_migs})) local last_min_instances=$((${AUTOSCALER_MIN_NODES} - (${num_migs} - 1) * ${min_instances_per_mig})) </del> <ins> local max_instances_per_mig=$(((${AUTOSCALER_MAX_NODES} + ${NUM_MIGS} - 1) / ${NUM_MIGS})) local last_max_instances=$((${AUTOSCALER_MAX_NODES} - (${NUM_MIGS} - 1) * ${max_instances_per_mig})) local min_instances_per_mig=$(((${AUTOSCALER_MIN_NODES} + ${NUM_MIGS} - 1) / ${NUM_MIGS})) local last_min_instances=$((${AUTOSCALER_MIN_NODES} - (${NUM_MIGS} - 1) * ${min_instances_per_mig})) </ins> <del> for i in $(seq $((${num_migs} - 1))); do </del> <ins> for i in $(seq $((${NUM_MIGS} - 1))); do </ins> gcloud compute instance-groups managed set-autoscaling "${NODE_INSTANCE_PREFIX}-group-$i" --zone "${ZONE}" --project "${PROJECT}"  <del> --min-num-replicas "${min_instances_per_mig}" --max-num-replicas "${max_instances_per_mig}" ${METRICS} || true </del> <ins> --min-num-replicas "${min_instances_per_mig}" --max-num-replicas "${max_instances_per_mig}" ${metrics} || true </ins> done gcloud compute instance-groups managed set-autoscaling "${NODE_INSTANCE_PREFIX}-group" --zone "${ZONE}" --project "${PROJECT}"  <del> --min-num-replicas "${last_min_instances}" --max-num-replicas "${last_max_instances}" ${METRICS} || true </del> <ins> --min-num-replicas "${last_min_instances}" --max-num-replicas "${last_max_instances}" ${metrics} || true </ins> fi }