@@ -95,6 +95,7 @@ const TEST_CONFIGURATIONS: { [name: string]: TestConfig } = {
95
95
96
96
const config : TestConfig = TEST_CONFIGURATIONS [ testConfig ] ;
97
97
const cloud : string = config . CLOUD ;
98
+ const k8s_version : string = randK8sVersion ( testConfig )
98
99
99
100
// `INFRA_PHASES` describe the phases that can be mixed
100
101
// and matched to form a test configuration
@@ -103,22 +104,22 @@ const cloud: string = config.CLOUD;
103
104
const INFRA_PHASES : { [ name : string ] : InfraConfig } = {
104
105
STANDARD_GKE_CLUSTER : {
105
106
phase : "create-std-gke-cluster" ,
106
- makeTarget : " gke-standard-cluster" ,
107
+ makeTarget : ` gke-standard-cluster` ,
107
108
description : "Creating a GKE cluster with 1 nodepool each for workspace and server" ,
108
109
} ,
109
110
STANDARD_K3S_CLUSTER_ON_GCP : {
110
111
phase : "create-std-k3s-cluster" ,
111
- makeTarget : " k3s-standard-cluster" ,
112
+ makeTarget : ` k3s-standard-cluster os_version= ${ randOsVersion ( ) } ` ,
112
113
description : "Creating a k3s cluster on GCP with 1 node" ,
113
114
} ,
114
115
STANDARD_AKS_CLUSTER : {
115
116
phase : "create-std-aks-cluster" ,
116
- makeTarget : " aks-standard-cluster" ,
117
+ makeTarget : ` aks-standard-cluster` ,
117
118
description : "Creating an aks cluster(azure)" ,
118
119
} ,
119
120
STANDARD_EKS_CLUSTER : {
120
121
phase : "create-std-eks-cluster" ,
121
- makeTarget : " eks-standard-cluster" ,
122
+ makeTarget : ` eks-standard-cluster` ,
122
123
description : "Creating a EKS cluster with 1 nodepool each for workspace and server" ,
123
124
} ,
124
125
CERT_MANAGER : {
@@ -133,7 +134,7 @@ const INFRA_PHASES: { [name: string]: InfraConfig } = {
133
134
} ,
134
135
GENERATE_KOTS_CONFIG : {
135
136
phase : "generate-kots-config" ,
136
- makeTarget : `generate-kots-config storage=${ randomize ( ) } registry=${ randomize ( ) } db=${ randomize ( ) } ` ,
137
+ makeTarget : `generate-kots-config storage=${ randDeps ( ) } registry=${ randDeps ( ) } db=${ randDeps ( ) } ` ,
137
138
description : `Generate KOTS Config file` ,
138
139
} ,
139
140
CLUSTER_ISSUER : {
@@ -318,7 +319,7 @@ function callMakeTargets(phase: string, description: string, makeTarget: string,
318
319
werft . log ( phase , `Calling ${ makeTarget } ` ) ;
319
320
320
321
// exporting cloud env var is important for the make targets
321
- const response = exec ( `export cloud=${ cloud } && make -C ${ makefilePath } ${ makeTarget } ` , {
322
+ const response = exec ( `export TF_VAR_cluster_version= ${ k8s_version } cloud=${ cloud } && make -C ${ makefilePath } ${ makeTarget } ` , {
322
323
slice : phase ,
323
324
dontCheckRc : true ,
324
325
} ) ;
@@ -339,15 +340,52 @@ function callMakeTargets(phase: string, description: string, makeTarget: string,
339
340
return response . code ;
340
341
}
341
342
342
- function randomize ( ) : string {
343
- // in the follow-up PR we will add `${platform}-${resource}` as an option here to
344
- // test against resource dependencies(storage, db, registry) for each cloud platform
343
+ function randomize ( options : string [ ] ) : string {
344
+ return options [ Math . floor ( Math . random ( ) * options . length ) ] ;
345
+ }
346
+
347
+ function randDeps ( ) : string {
345
348
var depOptions : string [ ] = [ "incluster" , "external" ]
349
+
346
350
if ( deps && depOptions . includes ( deps ) ) {
347
351
return deps
348
352
}
349
353
350
- return depOptions [ Math . floor ( Math . random ( ) * depOptions . length ) ] ;
354
+ return randomize ( depOptions )
355
+ }
356
+
357
+ function randK8sVersion ( config : string ) : string {
358
+ var options : string [ ] = [ ]
359
+ switch ( cloud ) {
360
+ case "STANDARD_GKE_TEST" : {
361
+ options = [ "1.21" , "1.22" , "1.23" ]
362
+ break ;
363
+ }
364
+ case "STANDARD_AKS_TEST" : {
365
+ options = [ "1.21" , "1.22" , "1.23" ]
366
+ break ;
367
+ }
368
+ case "STANDARD_EKS_TEST" : {
369
+ options = [ "1.20" , "1.21" , "1.22" ]
370
+ break ;
371
+ }
372
+ case "STANDARD_K3S_TEST" : {
373
+ options = [ "1.22.12+k3s1" , "v1.23.9+k3s1" , "1.24.3+k3s1" ]
374
+ break ;
375
+ }
376
+ }
377
+ // in the follow-up PR we will add `${platform}-${resource}` as an option here to
378
+ // test against resource dependencies(storage, db, registry) for each cloud platform
379
+
380
+ return randomize ( options )
381
+ }
382
+
383
+ function randOsVersion ( ) : string {
384
+ // in the follow-up PR we will add `${platform}-${resource}` as an option here to
385
+ // test against resource dependencies(storage, db, registry) for each cloud platform
386
+ var options : string [ ] = [ "2204" , "2004" , "1804" ]
387
+
388
+ return randomize ( options )
351
389
}
352
390
353
391
function cleanup ( ) {
0 commit comments