@@ -33,12 +33,15 @@ interface TestConfig {
33
33
CLOUD : string ;
34
34
}
35
35
36
+ const k8s_version : string = randK8sVersion ( testConfig )
37
+ const os_version : string = randOsVersion ( ) // applicable only for k3s
38
+
36
39
// Each of the TEST_CONFIGURATIONS define an integration test end-to-end
37
40
// It should be a combination of multiple INFRA_PHASES, order of PHASES slice is important
38
41
const TEST_CONFIGURATIONS : { [ name : string ] : TestConfig } = {
39
42
STANDARD_GKE_TEST : {
40
43
CLOUD : "gcp" ,
41
- DESCRIPTION : " Deploy Gitpod on GKE, with managed DNS, and run integration tests" ,
44
+ DESCRIPTION : ` Deploy Gitpod on GKE(version ${ k8s_version } )` ,
42
45
PHASES : [
43
46
"STANDARD_GKE_CLUSTER" ,
44
47
"CERT_MANAGER" ,
@@ -52,8 +55,7 @@ const TEST_CONFIGURATIONS: { [name: string]: TestConfig } = {
52
55
STANDARD_K3S_TEST : {
53
56
CLOUD : "gcp" , // the cloud provider is still GCP
54
57
DESCRIPTION :
55
- "Deploy Gitpod on a K3s cluster, created on a GCP instance," +
56
- " with managed DNS and run integrations tests" ,
58
+ `Deploy Gitpod on a K3s cluster(version ${ k8s_version } ), on a GCP instance with ubuntu ${ os_version } ` ,
57
59
PHASES : [
58
60
"STANDARD_K3S_CLUSTER_ON_GCP" ,
59
61
"CERT_MANAGER" ,
@@ -65,7 +67,7 @@ const TEST_CONFIGURATIONS: { [name: string]: TestConfig } = {
65
67
} ,
66
68
STANDARD_AKS_TEST : {
67
69
CLOUD : "azure" ,
68
- DESCRIPTION : " Deploy Gitpod on AKS, with managed DNS, and run integration tests" ,
70
+ DESCRIPTION : ` Deploy Gitpod on AKS(version ${ k8s_version } )` ,
69
71
PHASES : [
70
72
"STANDARD_AKS_CLUSTER" ,
71
73
"CERT_MANAGER" ,
@@ -79,7 +81,7 @@ const TEST_CONFIGURATIONS: { [name: string]: TestConfig } = {
79
81
} ,
80
82
STANDARD_EKS_TEST : {
81
83
CLOUD : "aws" ,
82
- DESCRIPTION : " Create an EKS cluster" ,
84
+ DESCRIPTION : ` Create an EKS cluster(version ${ k8s_version } )` ,
83
85
PHASES : [
84
86
"STANDARD_EKS_CLUSTER" ,
85
87
"CERT_MANAGER" ,
@@ -110,23 +112,23 @@ const cloud: string = config.CLOUD;
110
112
const INFRA_PHASES : { [ name : string ] : InfraConfig } = {
111
113
STANDARD_GKE_CLUSTER : {
112
114
phase : "create-std-gke-cluster" ,
113
- makeTarget : " gke-standard-cluster" ,
114
- description : " Creating a GKE cluster with 1 nodepool each for workspace and server" ,
115
+ makeTarget : ` gke-standard-cluster` ,
116
+ description : ` Creating a GCP GKE cluster(version: ${ k8s_version } ) with 1 nodepool each for workspace and server` ,
115
117
} ,
116
118
STANDARD_K3S_CLUSTER_ON_GCP : {
117
119
phase : "create-std-k3s-cluster" ,
118
- makeTarget : " k3s-standard-cluster" ,
119
- description : " Creating a k3s cluster on GCP with 1 node" ,
120
+ makeTarget : ` k3s-standard-cluster os_version= ${ os_version } ` ,
121
+ description : ` Creating a k3s(version: ${ k8s_version } ) cluster on GCP with 1 node` ,
120
122
} ,
121
123
STANDARD_AKS_CLUSTER : {
122
124
phase : "create-std-aks-cluster" ,
123
- makeTarget : " aks-standard-cluster" ,
124
- description : " Creating an aks cluster(azure)" ,
125
+ makeTarget : ` aks-standard-cluster` ,
126
+ description : ` Creating an Azure AKS cluster(version: ${ k8s_version } )` ,
125
127
} ,
126
128
STANDARD_EKS_CLUSTER : {
127
129
phase : "create-std-eks-cluster" ,
128
- makeTarget : " eks-standard-cluster" ,
129
- description : " Creating a EKS cluster with 1 nodepool each for workspace and server" ,
130
+ makeTarget : ` eks-standard-cluster` ,
131
+ description : ` Creating a AWS EKS cluster(version: ${ k8s_version } ) with 1 nodepool each for workspace and server` ,
130
132
} ,
131
133
CERT_MANAGER : {
132
134
phase : "setup-cert-manager" ,
@@ -140,7 +142,7 @@ const INFRA_PHASES: { [name: string]: InfraConfig } = {
140
142
} ,
141
143
GENERATE_KOTS_CONFIG : {
142
144
phase : "generate-kots-config" ,
143
- makeTarget : `generate-kots-config storage=${ randomize ( ) } registry=${ randomize ( ) } db=${ randomize ( ) } ` ,
145
+ makeTarget : `generate-kots-config storage=${ randDeps ( ) } registry=${ randDeps ( ) } db=${ randDeps ( ) } ` ,
144
146
description : `Generate KOTS Config file` ,
145
147
} ,
146
148
CLUSTER_ISSUER : {
@@ -335,7 +337,7 @@ function callMakeTargets(phase: string, description: string, makeTarget: string,
335
337
werft . log ( phase , `Calling ${ makeTarget } ` ) ;
336
338
337
339
// exporting cloud env var is important for the make targets
338
- const response = exec ( `export cloud=${ cloud } && make -C ${ makefilePath } ${ makeTarget } ` , {
340
+ const response = exec ( `export TF_VAR_cluster_version= ${ k8s_version } cloud=${ cloud } && make -C ${ makefilePath } ${ makeTarget } ` , {
339
341
slice : phase ,
340
342
dontCheckRc : true ,
341
343
} ) ;
@@ -347,24 +349,61 @@ function callMakeTargets(phase: string, description: string, makeTarget: string,
347
349
werft . fail ( phase , "Operation failed" ) ;
348
350
return response . code ;
349
351
}
350
- werft . log ( phase , `Phase failed` ) ;
352
+ werft . log ( phase , `' ${ description } ' failed` ) ;
351
353
} else {
352
- werft . log ( phase , `Phase succeeded` ) ;
354
+ werft . log ( phase , `' ${ description } ' succeeded` ) ;
353
355
werft . done ( phase ) ;
354
356
}
355
357
356
358
return response . code ;
357
359
}
358
360
359
- function randomize ( ) : string {
360
- // in the follow-up PR we will add `${platform}-${resource}` as an option here to
361
- // test against resource dependencies(storage, db, registry) for each cloud platform
361
+ function randomize ( options : string [ ] ) : string {
362
+ return options [ Math . floor ( Math . random ( ) * options . length ) ] ;
363
+ }
364
+
365
+ function randDeps ( ) : string {
362
366
var depOptions : string [ ] = [ "incluster" , "external" ]
367
+
363
368
if ( deps && depOptions . includes ( deps ) ) {
364
369
return deps
365
370
}
366
371
367
- return depOptions [ Math . floor ( Math . random ( ) * depOptions . length ) ] ;
372
+ return randomize ( depOptions )
373
+ }
374
+
375
+ function randK8sVersion ( config : string ) : string {
376
+ var options : string [ ] = [ ]
377
+ switch ( config ) {
378
+ case "STANDARD_GKE_TEST" : {
379
+ options = [ "1.21" , "1.22" , "1.23" ]
380
+ break ;
381
+ }
382
+ case "STANDARD_AKS_TEST" : {
383
+ options = [ "1.21" , "1.22" , "1.23" ]
384
+ break ;
385
+ }
386
+ case "STANDARD_EKS_TEST" : {
387
+ options = [ "1.20" , "1.21" , "1.22" ]
388
+ break ;
389
+ }
390
+ case "STANDARD_K3S_TEST" : {
391
+ options = [ "v1.22.12+k3s1" , "v1.23.9+k3s1" , "v1.24.3+k3s1" ]
392
+ break ;
393
+ }
394
+ }
395
+ // in the follow-up PR we will add `${platform}-${resource}` as an option here to
396
+ // test against resource dependencies(storage, db, registry) for each cloud platform
397
+
398
+ return randomize ( options )
399
+ }
400
+
401
+ function randOsVersion ( ) : string {
402
+ // in the follow-up PR we will add `${platform}-${resource}` as an option here to
403
+ // test against resource dependencies(storage, db, registry) for each cloud platform
404
+ var options : string [ ] = [ "2204" , "2004" , "1804" ]
405
+
406
+ return randomize ( options )
368
407
}
369
408
370
409
function cleanup ( ) {
0 commit comments