@@ -33,12 +33,15 @@ interface TestConfig {
3333    CLOUD : string ; 
3434} 
3535
36+ const  k8s_version : string  =  randK8sVersion ( testConfig ) 
37+ const  os_version : string  =  randOsVersion ( )  // applicable only for k3s 
38+ 
3639// Each of the TEST_CONFIGURATIONS define an integration test end-to-end 
3740// It should be a combination of multiple INFRA_PHASES, order of PHASES slice is important 
3841const  TEST_CONFIGURATIONS : {  [ name : string ] : TestConfig  }  =  { 
3942    STANDARD_GKE_TEST : { 
4043        CLOUD : "gcp" , 
41-         DESCRIPTION : " Deploy Gitpod on GKE, with managed DNS, and run integration tests" , 
44+         DESCRIPTION : ` Deploy Gitpod on GKE(version  ${ k8s_version } )` , 
4245        PHASES : [ 
4346            "STANDARD_GKE_CLUSTER" , 
4447            "CERT_MANAGER" , 
@@ -52,8 +55,7 @@ const TEST_CONFIGURATIONS: { [name: string]: TestConfig } = {
5255    STANDARD_K3S_TEST : { 
5356        CLOUD : "gcp" ,  // the cloud provider is still GCP 
5457        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 } ${ os_version }  , 
5759        PHASES : [ 
5860            "STANDARD_K3S_CLUSTER_ON_GCP" , 
5961            "CERT_MANAGER" , 
@@ -65,7 +67,7 @@ const TEST_CONFIGURATIONS: { [name: string]: TestConfig } = {
6567    } , 
6668    STANDARD_AKS_TEST : { 
6769        CLOUD : "azure" , 
68-         DESCRIPTION : " Deploy Gitpod on AKS, with managed DNS, and run integration tests" , 
70+         DESCRIPTION : ` Deploy Gitpod on AKS(version  ${ k8s_version } )` , 
6971        PHASES : [ 
7072            "STANDARD_AKS_CLUSTER" , 
7173            "CERT_MANAGER" , 
@@ -79,7 +81,7 @@ const TEST_CONFIGURATIONS: { [name: string]: TestConfig } = {
7981    } , 
8082    STANDARD_EKS_TEST : { 
8183        CLOUD : "aws" , 
82-         DESCRIPTION : " Create an EKS cluster" , 
84+         DESCRIPTION : ` Create an EKS cluster(version  ${ k8s_version } )` , 
8385        PHASES : [ 
8486            "STANDARD_EKS_CLUSTER" , 
8587            "CERT_MANAGER" , 
@@ -110,23 +112,23 @@ const cloud: string = config.CLOUD;
110112const  INFRA_PHASES : {  [ name : string ] : InfraConfig  }  =  { 
111113    STANDARD_GKE_CLUSTER : { 
112114        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` , 
115117    } , 
116118    STANDARD_K3S_CLUSTER_ON_GCP : { 
117119        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` , 
120122    } , 
121123    STANDARD_AKS_CLUSTER : { 
122124        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 } )` , 
125127    } , 
126128    STANDARD_EKS_CLUSTER : { 
127129        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` , 
130132    } , 
131133    CERT_MANAGER : { 
132134        phase : "setup-cert-manager" , 
@@ -140,7 +142,7 @@ const INFRA_PHASES: { [name: string]: InfraConfig } = {
140142    } , 
141143    GENERATE_KOTS_CONFIG : { 
142144        phase : "generate-kots-config" , 
143-         makeTarget : `generate-kots-config storage=${ randomize ( ) } ${ randomize ( ) } ${ randomize ( ) }  , 
145+         makeTarget : `generate-kots-config storage=${ randDeps ( ) } ${ randDeps ( ) } ${ randDeps ( ) }  , 
144146        description : `Generate KOTS Config file` , 
145147    } , 
146148    CLUSTER_ISSUER : { 
@@ -335,7 +337,7 @@ function callMakeTargets(phase: string, description: string, makeTarget: string,
335337    werft . log ( phase ,  `Calling ${ makeTarget }  ) ; 
336338
337339    // exporting cloud env var is important for the make targets 
338-     const  response  =  exec ( `export cloud=${ cloud } ${ makefilePath } ${ makeTarget }  ,  { 
340+     const  response  =  exec ( `export TF_VAR_cluster_version= ${ k8s_version }   cloud=${ cloud } ${ makefilePath } ${ makeTarget }  ,  { 
339341        slice : phase , 
340342        dontCheckRc : true , 
341343    } ) ; 
@@ -347,24 +349,61 @@ function callMakeTargets(phase: string, description: string, makeTarget: string,
347349            werft . fail ( phase ,  "Operation failed" ) ; 
348350            return  response . code ; 
349351        } 
350-         werft . log ( phase ,  `Phase  failed` ) ; 
352+         werft . log ( phase ,  `' ${ description } '  failed` ) ; 
351353    }  else  { 
352-         werft . log ( phase ,  `Phase  succeeded` ) ; 
354+         werft . log ( phase ,  `' ${ description } '  succeeded` ) ; 
353355        werft . done ( phase ) ; 
354356    } 
355357
356358    return  response . code ; 
357359} 
358360
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  { 
362366    var  depOptions : string [ ]  =  [ "incluster" ,  "external" ] 
367+ 
363368    if ( deps  &&  depOptions . includes ( deps ) )  { 
364369        return  deps 
365370    } 
366371
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 ) 
368407} 
369408
370409function  cleanup ( )  { 
0 commit comments