mirror of https://github.com/k3s-io/k3s
Merge pull request #27803 from fabioy/fix-multizone-groups
Automatic merge from submit-queue Fix NODE_INSTANCE_GROUPS resolution in GKE to only [![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/.github/PULL_REQUEST_TEMPLATE.md?pixel)]() Fix NODE_INSTANCE_GROUPS resolution in GKE to only include single cluster groups. Add NODE_INSTANCE_GROUPS_URLS for multi-zone groups. fixes #27692pull/6/head
commit
b9bc756aa9
|
@ -296,8 +296,10 @@ function detect-node-names {
|
|||
|
||||
# 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.
|
||||
# Note that the NODE_INSTANCE_GROUPS var will only have instance groups in the
|
||||
# same zone as the cluster, meaning that it won't include all groups in a
|
||||
# multi-zone cluster. The ALL_INSTANCE_GROUP_URLS will contain all the
|
||||
# instance group URLs, which include multi-zone groups.
|
||||
#
|
||||
# Assumed vars:
|
||||
# GCLOUD
|
||||
|
@ -306,15 +308,20 @@ function detect-node-names {
|
|||
# CLUSTER_NAME
|
||||
# Vars set:
|
||||
# NODE_INSTANCE_GROUPS
|
||||
# ALL_INSTANCE_GROUP_URLS
|
||||
function detect-node-instance-groups {
|
||||
echo "... in gke:detect-node-instance-groups()" >&2
|
||||
local urls=$("${GCLOUD}" ${CMD_GROUP:-} container clusters describe \
|
||||
--project="${PROJECT}" --zone="${ZONE}" \
|
||||
--format='value(instanceGroupUrls)' "${CLUSTER_NAME}")
|
||||
urls=(${urls//;/ })
|
||||
ALL_INSTANCE_GROUP_URLS=${urls[*]}
|
||||
NODE_INSTANCE_GROUPS=()
|
||||
for url in "${urls[@]:-}"; do
|
||||
NODE_INSTANCE_GROUPS+=("${url##*/}")
|
||||
local igm_zone=$(expr match ${url} '.*/zones/\([a-z0-9-]*\)/')
|
||||
if [[ "${igm_zone}" == "${ZONE}" ]]; then
|
||||
NODE_INSTANCE_GROUPS+=("${url##*/}")
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue