Skip to content

Commit 93d2f26

Browse files
removed runnerType option and added runtime service account (#580)
* removed runnerType option and added runtime service account * fixed app-proxy installation from runner init
1 parent 76cff30 commit 93d2f26

File tree

6 files changed

+19
-23
lines changed

6 files changed

+19
-23
lines changed

lib/interface/cli/commands/agent/install.cmd.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,6 @@ const installAgentCmd = new Command({
4545
.option('kube-namespace', {
4646
describe: 'Name of the namespace on which runner should be installed [$CF_ARG_KUBE_NAMESPACE]',
4747
})
48-
.option('kubernetes-runner-type', {
49-
describe: 'Set the runner type to kubernetes (alpha feature)',
50-
})
5148
.option('tolerations', {
5249
describe: 'The kubernetes tolerations as path to a JSON file to be used by runner resources (default is no tolerations) (string)',
5350
})
@@ -90,7 +87,6 @@ const installAgentCmd = new Command({
9087
'build-node-selector': buildNodeSelector,
9188
'dry-run': dryRun,
9289
'in-cluster': inCluster,
93-
'kubernetes-runner-type': kubernetesRunnerType,
9490
tolerations,
9591
'kube-config-path': kubeConfigPath,
9692
'skip-version-check': skipVersionCheck,
@@ -169,7 +165,6 @@ const installAgentCmd = new Command({
169165
inCluster,
170166
kubeNodeSelector,
171167
dockerRegistry,
172-
kubernetesRunnerType,
173168
tolerations,
174169
kubeConfigPath,
175170
skipVersionCheck,

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ const deleteCmd = new Command({
8989
describe: 'Print logs',
9090
}),
9191
handler: async (argv) => {
92+
const {
93+
verbose,
94+
} = argv;
9295
let {
9396
'kube-config-path': kubeConfigPath,
9497
url, force,
@@ -226,13 +229,15 @@ const deleteCmd = new Command({
226229
'agent-kube-namespace': kubeNamespace,
227230
name: reName,
228231
terminateProcess: false,
232+
verbose,
229233
};
230234
const re = runtimes.find(runtime => runtime.metadata.name === reName);
231235
if (re.appProxy) {
232236
await unInstallAppProxy({
233237
kubeConfigPath,
234238
kubeContextName,
235239
kubeNamespace,
240+
verbose,
236241
});
237242
}
238243
const [uninstallReErr] = await to(unInstallRuntime.handler(uninstallRuntimeOptions));
@@ -244,13 +249,15 @@ const deleteCmd = new Command({
244249
'kube-context-name': kubeContextName,
245250
name: agentName,
246251
terminateProcess: false,
252+
verbose,
247253
};
248254
const [uninstallAgentErr] = await to(unInstallAgent.handler(uninstallAgentOptions));
249255
handleError(uninstallAgentErr, 'Failed to uninstall agent');
250256

251257
const uninstallMonitorOptions = {
252258
'kube-namespace': kubeNamespace,
253259
'kube-context-name': kubeContextName,
260+
verbose,
254261
noExit: true, // to prevent if from calling: process.exit()
255262
};
256263
const [uninstallMonitorErr] = await to(unInstallMonitor.handler(uninstallMonitorOptions));

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

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ const INSTALLATION_DEFAULTS = {
2727
PROJECT_NAME: 'Runner',
2828
CF_CONTEXT_NAME: 'cf-runner',
2929
STORAGE_CLASS_PREFIX: 'dind-local-volumes-runner',
30+
RUNTIME_SERVICE_ACCOUNT: 'codefresh-engine',
3031
RESUME_OLD_INSTALLATION: true,
3132
COMPONENTS_FOLDER: 'components',
3233
KUBECONFIG_PATH: path.join(homedir(), '.kube', 'config'),
@@ -460,7 +461,6 @@ async function installAgent({
460461
kubeNodeSelector, // --kube-node-selector
461462
dryRun, // --dryRun
462463
inCluster, // -inCluster
463-
kubernetesRunnerType, // --kubernetes-runner-type
464464
tolerations, // --tolerations
465465
venonaVersion, // --venona-version
466466
kubeConfigPath, // --kube-config-path
@@ -506,9 +506,6 @@ async function installAgent({
506506
if (inCluster) {
507507
cmd.push('--in-cluster');
508508
}
509-
if (kubernetesRunnerType) {
510-
cmd.push(`--kubernetes-runner-type=${kubernetesRunnerType}`);
511-
}
512509
if (tolerations) {
513510
cmd.push(`--tolerations=${tolerations}`);
514511
}
@@ -549,7 +546,6 @@ async function installRuntime({
549546
dockerRegistry, // --docker-registry
550547
dryRun, // --dryRun
551548
inCluster, // -inCluster
552-
kubernetesRunnerType, // --kubernetes-runner-type
553549
kubeConfigPath, // --kube-config-path
554550
verbose, // --verbose
555551
name, // --runtimeEnvironmentName
@@ -587,9 +583,6 @@ async function installRuntime({
587583
if (inCluster) {
588584
cmd.push('--in-cluster');
589585
}
590-
if (kubernetesRunnerType) {
591-
cmd.push(`--kubernetes-runner-type=${kubernetesRunnerType}`);
592-
}
593586
if (kubeConfigPath) {
594587
cmd.push(`--kube-config-path=${kubeConfigPath}`);
595588
}

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ const initCmd = new Command({
235235
name,
236236
'app-proxy': appProxy,
237237
'app-proxy-host': appProxyHost,
238+
'app-proxy-path-prefix': appProxyPathPrefix,
238239
'install-monitor': installMonitor,
239240
'docker-daemon-access': dockerDaemonAccess,
240241
} = _argv;
@@ -269,6 +270,9 @@ const initCmd = new Command({
269270
if (!appProxyHost && _.get(valuesObj, 'AppProxy.Host')) {
270271
appProxyHost = _.get(valuesObj, 'AppProxy.Host');
271272
}
273+
if (!appProxyPathPrefix && _.get(valuesObj, 'AppProxy.PathPrefix')) {
274+
appProxyPathPrefix = _.get(valuesObj, 'AppProxy.PathPrefix');
275+
}
272276
if (appProxy && !appProxyHost) {
273277
handleError(new Error('no hostname provided'), 'cannot install app-proxy component without a hostname', undefined, undefined, true);
274278
}
@@ -531,6 +535,7 @@ const initCmd = new Command({
531535
const runtimeCreateOpt = {
532536
namespace: kubeNamespace,
533537
storageClassName: storageClassName || `${INSTALLATION_DEFAULTS.STORAGE_CLASS_PREFIX}-${kubeNamespace}`,
538+
serviceAccount: INSTALLATION_DEFAULTS.RUNTIME_SERVICE_ACCOUNT,
534539
clusterName: kubeContextName,
535540
runtimeEnvironmentName: reName,
536541
agent: true,
@@ -646,7 +651,7 @@ const initCmd = new Command({
646651
installationPlan.addStep({
647652
name: 'install app-proxy',
648653
func: async () => {
649-
const appProxyIP = await installAppProxy({
654+
await installAppProxy({
650655
apiHost: sdk.config.context.url,
651656
kubeContextName,
652657
kubeNamespace,
@@ -657,7 +662,8 @@ const initCmd = new Command({
657662
appProxyHost,
658663
appProxyIngressClass,
659664
});
660-
installationPlan.addContext('appProxyIP', `${appProxyIP}`);
665+
const appProxyUrl = `https://${appProxyHost}${appProxyPathPrefix || ''}`;
666+
installationPlan.addContext('appProxyIP', `${appProxyUrl}`);
661667
},
662668
installationEvent: installationProgress.events.APP_PROXY_INSTALLED,
663669
condition: !!appProxy,

lib/interface/cli/commands/runtimeEnvironments/install.cmd.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const cliProgress = require('cli-progress');
99
const createClusterCmd = require('../cluster/create.cmd');
1010
const colors = require('colors');
1111
const _ = require('lodash');
12-
const { DefaultLogFormatter } = require('./../hybrid/helper');
12+
const { DefaultLogFormatter, INSTALLATION_DEFAULTS } = require('./../hybrid/helper');
1313

1414
const defaultNamespace = 'codefresh';
1515
const defaultStorageClassPrefix = 'dind-local-volumes-runner';
@@ -85,9 +85,6 @@ const installRuntimeCmd = new Command({
8585
.option('runtime-kube-namespace', {
8686
describe: 'Name of the namespace on which runtime should be installed [$CF_ARG_KUBE_NAMESPACE]',
8787
})
88-
.option('kubernetes-runner-type', {
89-
describe: 'Set the runner type to kubernetes (alpha feature)',
90-
})
9188
.option('build-annotations', {
9289
describe: 'The kubernetes metadata.annotations as "key=value" to be used by runner build resources (default is no node selector)',
9390
})
@@ -127,7 +124,6 @@ const installRuntimeCmd = new Command({
127124
'dry-run': dryRun,
128125
'in-cluster': inCluster,
129126
'kube-node-selector': kubeNodeSelector,
130-
'kubernetes-runner-type': kubernetesRunnerType,
131127
'runtime-kube-config-path': kubeConfigPath,
132128
'set-value': setValue,
133129
'set-file': setFile,
@@ -186,7 +182,7 @@ const installRuntimeCmd = new Command({
186182
await sdk.cluster.create({
187183
namespace: kubeNamespace,
188184
storageClassName: storageClassName || `${defaultStorageClassPrefix}-${kubeNamespace}`,
189-
runnerType: kubernetesRunnerType,
185+
serviceAccount: INSTALLATION_DEFAULTS.RUNTIME_SERVICE_ACCOUNT,
190186
nodeSelector: kubeNodeSelectorObj,
191187
annotations: buildAnnotations,
192188
clusterName,
@@ -255,7 +251,6 @@ const installRuntimeCmd = new Command({
255251
token,
256252
dryRun,
257253
inCluster,
258-
kubernetesRunnerType,
259254
kubeConfigPath,
260255
dockerRegistry,
261256
verbose,

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.12",
3+
"version": "0.73.13",
44
"description": "Codefresh command line utility",
55
"main": "index.js",
66
"preferGlobal": true,

0 commit comments

Comments
 (0)