@@ -6,6 +6,17 @@ import { Database } from './database';
66import { Registry } from './registry' ;
77import { importCluster } from './charts/cluster-utils' ;
88
9+ var createNestedObject = function ( base : any , names : any , value : any ) {
10+ var lastName = arguments . length === 3 ? names . pop ( ) : false ;
11+ for ( var i = 0 ; i < names . length ; i ++ ) {
12+ base = base [ names [ i ] ] = base [ names [ i ] ] || { } ;
13+ }
14+
15+ if ( lastName ) {
16+ base = base [ lastName ] = value ;
17+ }
18+ } ;
19+
920// TODO: switch to official gitpod.io build.
1021const version = "aledbf-mk3.29" ;
1122
@@ -42,14 +53,22 @@ export class GitpodStack extends cdk.Stack {
4253
4354 replace ( / { { issuerName} } / g, 'ca-issuer' ) ;
4455
56+ const values = loadYaml ( doc ) ;
57+ if ( process . env . IMAGE_PULL_SECRET ) {
58+ createNestedObject ( values , [ "components" , "workspace" , "templates" , "default" , "spec" , "imagePullSecrets" ] , [ ] ) ;
59+ createNestedObject ( values , [ "components" , "imageBuilderMk3" , "registry" ] , { } ) ;
60+ values . components . workspace . templates . default . spec . imagePullSecrets . push ( { "name" : `${ process . env . IMAGE_PULL_SECRET } ` } ) ;
61+ values . components . imageBuilderMk3 . registry . secretName = `${ process . env . IMAGE_PULL_SECRET } ` ;
62+ }
63+
4564 const helmChart = cluster . addHelmChart ( 'GitpodChart' , {
4665 chart : 'gitpod' ,
4766 release : 'gitpod' ,
4867 repository : 'https://aledbf.github.io/gitpod-chart-cleanup/' ,
4968 namespace : 'default' ,
50- version : '1.2.14 ' ,
69+ version : '1.2.15 ' ,
5170 wait : true ,
52- values : loadYaml ( doc ) ,
71+ values,
5372 } ) ;
5473
5574 doc = readYamlDocument ( __dirname + '/charts/assets/ingress.yaml' ) ;
@@ -61,11 +80,19 @@ export class GitpodStack extends cdk.Stack {
6180 manifest . metadata . annotations [ "alb.ingress.kubernetes.io/ssl-policy" ] = "ELBSecurityPolicy-FS-1-2-Res-2020-10" ;
6281 }
6382
83+ manifest . metadata . annotations [ "alb.ingress.kubernetes.io/load-balancer-name" ] = `${ process . env . CLUSTER_NAME } -${ props . env ?. region } ` ;
84+
6485 // if we have a route53 zone ID, enable external-dns.
6586 if ( process . env . ROUTE53_ZONEID ) {
6687 manifest . metadata . annotations [ "external-dns.alpha.kubernetes.io/hostname" ] = `${ props . domain } , *.${ props . domain } , *.ws.${ props . domain } ` ;
6788 }
6889
90+ if ( process . env . USE_INTERNAL_ALB && process . env . USE_INTERNAL_ALB . toLowerCase ( ) === 'true' ) {
91+ manifest . metadata . annotations [ "alb.ingress.kubernetes.io/scheme" ] = 'internal' ;
92+ } else {
93+ manifest . metadata . annotations [ "alb.ingress.kubernetes.io/scheme" ] = 'internet-facing' ;
94+ }
95+
6996 const gitpodIngress = new KubernetesManifest ( this , "gitpod-ingress" , {
7097 cluster,
7198 overwrite : true ,
0 commit comments