File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,15 +9,21 @@ void createCluster(String CLUSTER_SUFFIX) {
99 export KUBECONFIG=/tmp/$CLUSTER_NAME -${ CLUSTER_SUFFIX}
1010 gcloud auth activate-service-account --key-file $CLIENT_SECRET_FILE
1111 gcloud config set project $GCP_PROJECT
12+ GKE_VERSION=\$ (gcloud container get-server-config --zone ${ region} --flatten='channels[].validVersions[]' --filter='channels.channel=STABLE' --format='value(channels.validVersions)' | sort -V | head -n1)
13+ if [ -z "\$ {GKE_VERSION}" ]; then
14+ echo "Failed to detect the minimum Kubernetes version from the GKE stable release channel"
15+ exit 1
16+ fi
1217 ret_num=0
1318 while [ \$ {ret_num} -lt 15 ]; do
1419 ret_val=0
1520 gcloud container clusters list --filter $CLUSTER_NAME -${ CLUSTER_SUFFIX} --zone ${ region} --format='csv[no-heading](name)' | xargs -r gcloud container clusters delete --zone ${ region} --quiet || true
21+ echo "Creating GKE cluster $CLUSTER_NAME -${ CLUSTER_SUFFIX} with Kubernetes version \$ {GKE_VERSION} from the stable release channel"
1622 gcloud container clusters create $CLUSTER_NAME -${ CLUSTER_SUFFIX} \
1723 --preemptible \
1824 --zone ${ region} \
1925 --machine-type=c2d-standard-4 \
20- --cluster-version=1.33 \
26+ --cluster-version=" \$ {GKE_VERSION}" \
2127 --num-nodes=3 \
2228 --labels delete-cluster-after-hours=6 \
2329 --disk-size 30 \
You can’t perform that action at this time.
0 commit comments