Commit 1186f4bf authored by k8s-merge-robot's avatar k8s-merge-robot

Merge pull request #24177 from a-robinson/gke

Automatic merge from submit-queue Fix GKE kube-up to correctly find an IGM from a multi-zone cluster I've confirmed that this successfully brings up a cluster, fixing the immediate issue with the new e2e test. Sorry about not properly vetting it in the original PR (#24075). This does cause a warning message to be printed based on the handling of the NUM_NODES variable though, which I could fix if you guys think it's worth it: ``` Detected 6 ready nodes, found 6 nodes out of expected 3. Found more nodes than expected, your cluster may not behave correctly. ``` @quinton-hoole
parents 9c0a0833 b30c4d49
......@@ -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:
......@@ -242,7 +257,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
......@@ -255,7 +273,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).
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment