Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Apr 14, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 20 additions & 2 deletions cluster/gke/util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -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).
Expand Down