mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 03:11:40 +00:00
Merge pull request #27803 from fabioy/fix-multizone-groups
Automatic merge from submit-queue Fix NODE_INSTANCE_GROUPS resolution in GKE to only []() Fix NODE_INSTANCE_GROUPS resolution in GKE to only include single cluster groups. Add NODE_INSTANCE_GROUPS_URLS for multi-zone groups. fixes #27692
This commit is contained in:
commit
b9bc756aa9
@ -296,8 +296,10 @@ function detect-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
|
# Note that the NODE_INSTANCE_GROUPS var will only have instance groups in the
|
||||||
# cluster, meaning that it won't include all groups in a multi-zone cluster.
|
# 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:
|
# Assumed vars:
|
||||||
# GCLOUD
|
# GCLOUD
|
||||||
@ -306,15 +308,20 @@ function detect-node-names {
|
|||||||
# CLUSTER_NAME
|
# CLUSTER_NAME
|
||||||
# Vars set:
|
# Vars set:
|
||||||
# NODE_INSTANCE_GROUPS
|
# NODE_INSTANCE_GROUPS
|
||||||
|
# ALL_INSTANCE_GROUP_URLS
|
||||||
function detect-node-instance-groups {
|
function detect-node-instance-groups {
|
||||||
echo "... in gke:detect-node-instance-groups()" >&2
|
echo "... in gke:detect-node-instance-groups()" >&2
|
||||||
local urls=$("${GCLOUD}" ${CMD_GROUP:-} container clusters describe \
|
local urls=$("${GCLOUD}" ${CMD_GROUP:-} container clusters describe \
|
||||||
--project="${PROJECT}" --zone="${ZONE}" \
|
--project="${PROJECT}" --zone="${ZONE}" \
|
||||||
--format='value(instanceGroupUrls)' "${CLUSTER_NAME}")
|
--format='value(instanceGroupUrls)' "${CLUSTER_NAME}")
|
||||||
urls=(${urls//;/ })
|
urls=(${urls//;/ })
|
||||||
|
ALL_INSTANCE_GROUP_URLS=${urls[*]}
|
||||||
NODE_INSTANCE_GROUPS=()
|
NODE_INSTANCE_GROUPS=()
|
||||||
for url in "${urls[@]:-}"; do
|
for url in "${urls[@]:-}"; do
|
||||||
|
local igm_zone=$(expr match ${url} '.*/zones/\([a-z0-9-]*\)/')
|
||||||
|
if [[ "${igm_zone}" == "${ZONE}" ]]; then
|
||||||
NODE_INSTANCE_GROUPS+=("${url##*/}")
|
NODE_INSTANCE_GROUPS+=("${url##*/}")
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user