@@ -201,10 +201,11 @@ func clusterUpGKE(gceZone, gceRegion string, numNodes int, numWindowsNodes int,
201
201
}
202
202
}
203
203
204
- var cmd * exec. Cmd
204
+ // Assemble parameters from passed in arguments.
205
205
cmdParams := []string {"container" , "clusters" , "create" , * gkeTestClusterName ,
206
206
locationArg , locationVal , "--num-nodes" , strconv .Itoa (numNodes ),
207
207
"--quiet" , "--machine-type" , "n1-standard-2" , "--no-enable-autoupgrade" }
208
+
208
209
if imageType == "win2019" || imageType == "win2022" {
209
210
cmdParams = append (cmdParams , "--image-type" , "WINDOWS_LTSC_CONTAINERD" )
210
211
if imageType == "win2019" {
@@ -215,17 +216,28 @@ func clusterUpGKE(gceZone, gceRegion string, numNodes int, numWindowsNodes int,
215
216
} else {
216
217
cmdParams = append (cmdParams , "--image-type" , imageType )
217
218
}
218
- if isVariableSet (gkeClusterVer ) {
219
- cmdParams = append (cmdParams , "--cluster-version" , * gkeClusterVer )
220
- } else {
219
+
220
+ if isVariableSet (gkeReleaseChannel ) {
221
221
cmdParams = append (cmdParams , "--release-channel" , * gkeReleaseChannel )
222
+
222
223
// Release channel based GKE clusters require autorepair to be enabled.
223
224
cmdParams = append (cmdParams , "--enable-autorepair" )
224
225
225
- // Extended channel clusters require autoupgrade to be enabled.
226
226
if * gkeReleaseChannel == "extended" {
227
+ // Extended channel clusters require autoupgrade to be enabled.
227
228
cmdParams = append (cmdParams , "--enable-autoupgrade" )
229
+
230
+ // We often leverage the extended channel to test the oldest
231
+ // versions. In that case, we specify both a release channel *and* a
232
+ // cluster version.
233
+ if isVariableSet (gkeClusterVer ) {
234
+ cmdParams = append (cmdParams , "--cluster-version" , * gkeClusterVer )
235
+ }
228
236
}
237
+ } else if isVariableSet (gkeClusterVer ) {
238
+ cmdParams = append (cmdParams , "--cluster-version" , * gkeClusterVer )
239
+ } else {
240
+ return fmt .Errorf ("must specify either release channel or cluster version" )
229
241
}
230
242
231
243
if isVariableSet (gkeNodeVersion ) {
@@ -236,7 +248,7 @@ func clusterUpGKE(gceZone, gceRegion string, numNodes int, numWindowsNodes int,
236
248
cmdParams = append (cmdParams , "--addons" , "GcePersistentDiskCsiDriver" )
237
249
}
238
250
239
- cmd = exec .Command ("gcloud" , cmdParams ... )
251
+ cmd : = exec .Command ("gcloud" , cmdParams ... )
240
252
err = runCommand ("Starting E2E Cluster on GKE" , cmd )
241
253
if err != nil {
242
254
return fmt .Errorf ("failed to bring up kubernetes e2e cluster on gke: %v" , err .Error ())
0 commit comments