@@ -57,15 +57,22 @@ function printInstallationOptionsSummary({
5757 shouldExecutePipeline,
5858 httpProxy,
5959 httpsProxy,
60+ appProxy,
61+ appProxyHost,
6062} ) {
61- console . log ( `\n${ colors . green ( 'Installation options summary:' ) }
63+ let summary = `\n${ colors . green ( 'Installation options summary:' ) }
6264 1. Kubernetes Context: ${ colors . cyan ( kubeContextName ) }
6365 2. Kubernetes Namespace: ${ colors . cyan ( kubeNamespace ) }
6466 3. Set this as default account runtime-environment: ${ colors . cyan ( ! ! shouldMakeDefaultRe ) }
6567 4. Execute demo pipeline after install: ${ colors . cyan ( ! ! shouldExecutePipeline ) }
6668 5. HTTP proxy: ${ httpProxy ? colors . cyan ( httpProxy ) : 'none' }
6769 6. HTTPS proxy: ${ httpsProxy ? colors . cyan ( httpsProxy ) : 'none' }
68- ` ) ;
70+ ` ;
71+
72+ if ( appProxy ) {
73+ summary += `7. App-Proxy hostname: ${ colors . cyan ( appProxyHost ) } \n` ;
74+ }
75+ console . log ( summary ) ;
6976}
7077
7178const initCmd = new Command ( {
@@ -164,6 +171,14 @@ const initCmd = new Command({
164171 describe : 'install app proxy component (default false)' ,
165172 default : false ,
166173 type : 'boolean' ,
174+ } )
175+ . option ( 'app-proxy-host' , {
176+ describe : 'the hostname that will be used by the app-proxy ingress' ,
177+ type : 'string' ,
178+ } )
179+ . option ( 'app-proxy-ingress-class' , {
180+ describe : 'the ingress class that will be used by the app-proxy ingress' ,
181+ type : 'string' ,
167182 } ) ,
168183 handler : async ( argv ) => {
169184 let resumedInstallation = false ;
@@ -199,7 +214,7 @@ const initCmd = new Command({
199214 'set-file' : setFile ,
200215 'skip-cluster-test' : skipClusterTest ,
201216 'docker-registry' : dockerRegistry ,
202- 'app-proxy' : appProxy ,
217+ 'app-proxy-ingress-class ' : appProxyIngressClass ,
203218 } = _argv ;
204219 let {
205220 yes : noQuestions ,
@@ -213,6 +228,8 @@ const initCmd = new Command({
213228 url,
214229 token,
215230 name,
231+ 'app-proxy' : appProxy ,
232+ 'app-proxy-host' : appProxyHost ,
216233 'install-monitor' : installMonitor ,
217234 } = _argv ;
218235
@@ -240,6 +257,15 @@ const initCmd = new Command({
240257 if ( typeof _ . get ( valuesObj , 'Monitor.Enabled' ) !== 'undefined' ) {
241258 installMonitor = _ . get ( valuesObj , 'Monitor.Enabled' ) ;
242259 }
260+ if ( _ . get ( valuesObj , 'AppProxy' ) ) {
261+ appProxy = true ;
262+ }
263+ if ( ! appProxyHost && _ . get ( valuesObj , 'AppProxy.Host' ) ) {
264+ appProxyHost = _ . get ( valuesObj , 'AppProxy.Host' ) ;
265+ }
266+ if ( appProxy && ! appProxyHost ) {
267+ handleError ( new Error ( 'no hostname provided' ) , 'cannot install app-proxy component without a hostname' , undefined , undefined , true ) ;
268+ }
243269 }
244270 if ( ! url ) {
245271 url = DEFAULTS . URL ;
@@ -296,7 +322,7 @@ const initCmd = new Command({
296322 type : 'input' ,
297323 name : 'httpProxy' ,
298324 default : httpProxy ,
299- message : 'HTTP proxy to be used by runner inside Kubernetes ?' ,
325+ message : 'HTTP proxy to be used by runner inside Kubernetes?' ,
300326 } ) ;
301327 }
302328
@@ -305,8 +331,17 @@ const initCmd = new Command({
305331 type : 'input' ,
306332 name : 'httpsProxy' ,
307333 default : httpsProxy ,
308- message : 'HTTPS proxy to be used by runner inside Kubernetes ?' ,
334+ message : 'HTTPS proxy to be used by runner inside Kubernetes?' ,
335+
336+ } ) ;
337+ }
309338
339+ if ( appProxy && ! appProxyHost ) {
340+ // will only be asked if you want to install app-proxy but you give no host in the options
341+ questions . push ( {
342+ type : 'input' ,
343+ name : 'appProxyHost' ,
344+ message : 'The hostname that will be used by the app-proxy ingress' ,
310345 } ) ;
311346 }
312347
@@ -343,7 +378,7 @@ const initCmd = new Command({
343378 kubeNamespace = kubeNamespace || answers . namespace ;
344379 shouldMakeDefaultRe = _ . isUndefined ( shouldMakeDefaultRe ) ? answers . shouldMakeDefaultRe : shouldMakeDefaultRe ;
345380 shouldExecutePipeline = _ . isUndefined ( shouldExecutePipeline ) ? answers . shouldExecutePipeline : shouldExecutePipeline ;
346- ( { httpProxy, httpsProxy } = answers ) ;
381+ ( { httpProxy, httpsProxy, appProxyHost } = answers ) ;
347382 }
348383
349384 printInstallationOptionsSummary ( {
@@ -353,6 +388,8 @@ const initCmd = new Command({
353388 shouldExecutePipeline,
354389 httpProxy,
355390 httpsProxy,
391+ appProxy,
392+ appProxyHost,
356393 } ) ;
357394
358395 if ( token ) {
@@ -402,6 +439,7 @@ const initCmd = new Command({
402439 _argv [ 'set-default-runtime' ] = shouldMakeDefaultRe ;
403440 _argv [ 'exec-demo-pipeline' ] = shouldExecutePipeline ;
404441 _argv [ 'env-vars' ] = envVars ;
442+ _argv [ 'app-proxy-host' ] = appProxyHost ;
405443 installationPlan . addContext ( 'argv' , _argv ) ;
406444
407445 // run cluster acceptance tests
@@ -602,8 +640,10 @@ const initCmd = new Command({
602640 verbose,
603641 kubeConfigPath,
604642 valuesFile,
643+ appProxyHost,
644+ appProxyIngressClass,
605645 } ) ;
606- installationPlan . addContext ( 'appProxyIP' , `http:// ${ appProxyIP } ` ) ;
646+ installationPlan . addContext ( 'appProxyIP' , `${ appProxyIP } ` ) ;
607647 } ,
608648 installationEvent : installationProgress . events . APP_PROXY_INSTALLED ,
609649 condition : ! ! appProxy ,
0 commit comments