From 8cf93288fad47756932cbf2a3fcacf8758be30fe Mon Sep 17 00:00:00 2001 From: Zach Loafman Date: Wed, 14 Jan 2015 12:17:12 -0800 Subject: [PATCH] GKE: Fix unbound variable when pd.sh fails In the other providers, MINION_NAMES is bound early and detect_minions is actually only used to detect the IPs of the minions, which is why I didn't expect to need to call it. Move the initialization to config-common.sh in GKE as well. This follows the pattern of cluster/gce/config-{default,test}.sh --- cluster/gke/config-common.sh | 1 + cluster/gke/util.sh | 7 +------ 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/cluster/gke/config-common.sh b/cluster/gke/config-common.sh index 911891e9153..394147c2d57 100644 --- a/cluster/gke/config-common.sh +++ b/cluster/gke/config-common.sh @@ -21,6 +21,7 @@ MASTER_NAME="k8s-${CLUSTER_NAME}-master" ZONE="${ZONE:-us-central1-f}" NUM_MINIONS="${NUM_MINIONS:-2}" +MINION_NAMES=($(eval echo "k8s-${CLUSTER_NAME}-node-{1..${NUM_MINIONS}}")) CLUSTER_API_VERSION="${CLUSTER_API_VERSION:-}" # TODO(mbforbes): Actually plumb this through; this currently only works # because we use the 'default' network by default. diff --git a/cluster/gke/util.sh b/cluster/gke/util.sh index 3754caf468f..2b92efed561 100644 --- a/cluster/gke/util.sh +++ b/cluster/gke/util.sh @@ -188,14 +188,9 @@ function detect-master() { # NUM_MINIONS # CLUSTER_NAME # Vars set: -# MINION_NAMES (array) +# (none) function detect-minions() { echo "... in detect-minions()" >&2 - # Just get the minion names. - MINION_NAMES=() - for (( i=1; i<=${NUM_MINIONS}; i++)); do - MINION_NAMES+=("k8s-${CLUSTER_NAME}-node-${i}") - done } # SSH to a node by name ($1) and run a command ($2).