diff --git a/cluster/gke/config-common.sh b/cluster/gke/config-common.sh index ff8d000b1a1..6dcc9deb7b6 100644 --- a/cluster/gke/config-common.sh +++ b/cluster/gke/config-common.sh @@ -21,7 +21,6 @@ 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 51352b6908c..91dd8cf806e 100755 --- a/cluster/gke/util.sh +++ b/cluster/gke/util.sh @@ -217,12 +217,12 @@ function detect-master() { } # Assumed vars: -# NUM_MINIONS -# CLUSTER_NAME +# none # Vars set: -# (none) +# MINION_NAMES function detect-minions() { echo "... in detect-minions()" >&2 + detect-minion-names } # Detect minions created in the minion group @@ -233,12 +233,11 @@ function detect-minions() { # MINION_NAMES function detect-minion-names { detect-project - export MINION_NAMES="" - count=$("${GCLOUD}" alpha container clusters describe --project="${PROJECT}" --zone="${ZONE}" "${CLUSTER_NAME}" | grep numNodes | cut -f 2 -d ' ') - for x in $(seq 1 $count); do - export MINION_NAMES="${MINION_NAMES} k8s-${CLUSTER_NAME}-node-${x} "; - done - MINION_NAMES=(${MINION_NAMES}) + GROUP_NAME=($(gcloud preview --project "${PROJECT}" instance-groups \ + --zone "${ZONE}" list | grep -o "k8s-${CLUSTER_NAME}-.\{8\}-group")) + MINION_NAMES=($(gcloud preview --project "${PROJECT}" instance-groups \ + --zone "${ZONE}" instances --group "${GROUP_NAME}" list \ + | cut -d'/' -f11)) echo "MINION_NAMES=${MINION_NAMES[*]}" }