Skip to content

Commit 1078150

Browse files
added support to install app-proxy ingress (#566)
1 parent 1d27802 commit 1078150

File tree

4 files changed

+58
-9
lines changed

4 files changed

+58
-9
lines changed

lib/binary/runner.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class Runner {
2828

2929
runAndAttach(component, args) {
3030
const dir = join(this.location, component.local.dir);
31-
const path = join(dir, component.local.binary);
31+
const path = component.local.alternateBinary || join(dir, component.local.binary);
3232
const cp = spawn(path, args, {
3333
stdio: [process.stdin, process.stdout, process.stderr, 'pipe'],
3434
});

lib/interface/cli/commands/hybrid/helper.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -626,6 +626,8 @@ async function installAppProxy({
626626
verbose, // --verbose
627627
logFormatting = DefaultLogFormatter, // --log-formtter
628628
valuesFile, // --values
629+
appProxyHost, // --app-proxy-host
630+
appProxyIngressClass, // --app-proxy-ingress-class
629631
}) {
630632
const binLocation = await downloadVeonona();
631633
const componentRunner = new Runner(binLocation);
@@ -652,6 +654,13 @@ async function installAppProxy({
652654
if (valuesFile) {
653655
cmd.push(`--values=${valuesFile}`);
654656
}
657+
if (appProxyHost) {
658+
cmd.push(`--host=${appProxyHost}`);
659+
}
660+
if (appProxyIngressClass) {
661+
cmd.push(`--ingress-class=${appProxyIngressClass}`);
662+
}
663+
655664
const cp = componentRunner.runAndAttach(components.venona, cmd, true);
656665
const chunks = [];
657666
let ingressIp;

lib/interface/cli/commands/hybrid/init.cmd.js

Lines changed: 47 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -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

7178
const 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,

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "codefresh",
3-
"version": "0.73.2",
3+
"version": "0.73.3",
44
"description": "Codefresh command line utility",
55
"main": "index.js",
66
"preferGlobal": true,

0 commit comments

Comments
 (0)