Skip to content
This repository was archived by the owner on Sep 6, 2022. It is now read-only.

Commit 72c92b9

Browse files
authored
Merge pull request #18 from gitpod-io/tarun/preemptable-nodes-false
use `--preemptable` appropriately when set to false Currently, As we seem to use the `{PREEMPTABLE}` env directly, It causes the following error when set to `false`: ``` ERROR: (gcloud.container.clusters.create) unrecognized arguments: false ``` This PR updates to use a separate variable, which is set `--preemptable` when `PREEMPTABLE` is set to true, **empty otherwise**. Thus, preventing `false` to mistakenly passed as an argument. This PR also updates the usage at `gcloud.container.node-pools.create` to not pass empty argument when the value is `false`.
2 parents 964cedf + eaa5287 commit 72c92b9

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

setup.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,11 @@ function check_prerequisites() {
6161
export REGION
6262
fi
6363

64+
PREEMPTIBLE_NODES=
6465
if [ -n "${PREEMPTIBLE}" ] && [ "${PREEMPTIBLE}" == "true" ]; then
65-
PREEMPTIBLE="--preemptible"
66-
export PREEMPTIBLE
66+
PREEMPTIBLE_NODES="--preemptible"
6767
fi
68+
export PREEMPTIBLE_NODES
6869

6970
NODES_LOCATIONS=
7071
if [ -n "${ZONES}" ]; then
@@ -90,7 +91,7 @@ function create_node_pool() {
9091
--node-labels="${NODES_LABEL}" \
9192
--max-pods-per-node=110 --min-nodes=1 --max-nodes=50 \
9293
--region="${REGION}" \
93-
"${PREEMPTIBLE}"
94+
${PREEMPTIBLE_NODES}
9495
}
9596

9697
function create_secrets() {
@@ -362,7 +363,7 @@ function install() {
362363
--max-pods-per-node=110 --default-max-pods-per-node=110 \
363364
--min-nodes=0 --max-nodes=1 \
364365
--addons=HorizontalPodAutoscaling,NodeLocalDNS,NetworkPolicy \
365-
${NODES_LOCATIONS} ${PREEMPTIBLE}
366+
${NODES_LOCATIONS} ${PREEMPTIBLE_NODES}
366367

367368
# delete default node pool (is not possible to create a cluster without nodes)
368369
gcloud --quiet container node-pools delete default-pool --cluster="${CLUSTER_NAME}" --region="${REGION}"

0 commit comments

Comments
 (0)