Merge pull request #8833 from cjcullen/mig

Fix detect-minion-names for gke provider
This commit is contained in:
Saad Ali 2015-05-26 14:33:08 -07:00
commit 94e2192f2c
2 changed files with 8 additions and 10 deletions

View File

@ -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.

View File

@ -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[*]}"
}