Fix GKE kube-up to correctly find an IGM from a multi-zone cluster.

This commit is contained in:
Alex Robinson 2016-04-12 19:34:07 -07:00
parent bc8738c280
commit b30c4d4975

View File

@ -104,6 +104,18 @@ function verify-prereqs() {
${sudo_prefix} gcloud ${gcloud_prompt:-} components update || true
}
# Validate a kubernetes cluster
function validate-cluster {
# Simply override the NUM_NODES variable if we've spread nodes across multiple
# zones before calling into the generic validate-cluster logic.
local EXPECTED_NUM_NODES="${NUM_NODES}"
for zone in $(echo "${ADDITIONAL_ZONES}" | sed "s/,/ /g")
do
(( EXPECTED_NUM_NODES += NUM_NODES ))
done
NUM_NODES=${EXPECTED_NUM_NODES} bash -c "${KUBE_ROOT}/cluster/validate-cluster.sh"
}
# Instantiate a kubernetes cluster
#
# Assumed vars:
@ -224,6 +236,9 @@ function detect-nodes() {
# Detect minions created in the minion group
#
# Note that this will only return the nodes from one of the cluster's instance
# groups, regardless of how many the cluster has.
#
# Assumed vars:
# none
# Vars set:
@ -239,7 +254,10 @@ function detect-node-names {
echo "NODE_NAMES=${NODE_NAMES[*]}"
}
# Detect instance group name generated by gke
# Detect instance group name generated by gke.
#
# Note that this will only select instance groups in the same zone as the
# cluster, meaning that it won't include all groups in a multi-zone cluster.
#
# Assumed vars:
# GCLOUD
@ -252,7 +270,7 @@ function detect-node-instance-group {
echo "... in gke:detect-node-instance-group()" >&2
NODE_INSTANCE_GROUP=$("${GCLOUD}" ${CMD_GROUP:-} container clusters describe \
--project="${PROJECT}" --zone="${ZONE}" "${CLUSTER_NAME}" \
| grep instanceGroupManagers | cut -d '/' -f 11)
| grep instanceGroupManagers | grep "${ZONE}" | cut -d '/' -f 11)
}
# SSH to a node by name ($1) and run a command ($2).