Skip to content

Commit 2a46cee

Browse files
added option to disable monitor installation (#506)
1 parent a7de550 commit 2a46cee

File tree

5 files changed

+40
-16
lines changed

5 files changed

+40
-16
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,11 @@ const deleteCmd = new Command({
100100
const [listAgentsErr, agents] = await to(sdk.agents.list({ }));
101101
await handleError(listAgentsErr, 'Failed to get agents');
102102

103+
if (!agents.length) {
104+
console.log('No runners found on your codefresh account');
105+
process.exit(0);
106+
}
107+
103108
console.log(colors.green('This uninstaller will guide you through the runner uninstallation process'));
104109

105110
if (!kubeContextName) {

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

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,11 @@ const initCmd = new Command({
108108
describe: 'Run a demo pipeline after the installation completes',
109109
type: 'boolean',
110110
})
111+
.option('install-monitor', {
112+
describe: 'Install a monitoring component that will help provide valueable data about your cluster to Codefresh',
113+
type: 'boolean',
114+
default: true,
115+
})
111116
.option('kube-namespace', {
112117
describe: 'Name of the namespace on which venona should be installed [$CF_ARG_KUBE_NAMESPACE]',
113118
})
@@ -164,6 +169,7 @@ const initCmd = new Command({
164169
'set-value': setValue,
165170
'set-file': setFile,
166171
'skip-cluster-test': skipClusterTest,
172+
'install-monitor': installMonitor,
167173
} = _argv;
168174
let {
169175
'kube-context-name': kubeContextName,
@@ -214,11 +220,11 @@ const initCmd = new Command({
214220
}
215221

216222
if (_.isUndefined(shouldMakeDefaultRe)) {
217-
if (_.get(sdk, 'config.context.isNoAuth') || await isNewAccount()) {
223+
if (!_.get(sdk, 'config.context.isNoAuth') && await isNewAccount()) {
218224
// don't ask and set this runtime as default if it's a new account
219225
shouldMakeDefaultRe = true;
220226
} else {
221-
let message = 'Set this as the default runtime environment for your Codefresh account? (Y/N)';
227+
let message = 'Set this as the default runtime environment for your Codefresh account?';
222228
const [, defaultRe] = await to(getDefaultRuntime());
223229
if (defaultRe) {
224230
message = `Change the current default runtime "${colors.cyan(defaultRe.metadata.name)}" to new runtime ?`;
@@ -494,6 +500,7 @@ const initCmd = new Command({
494500
},
495501
successMessage: 'Successfully installed cluster monitoring',
496502
installationEvent: installationProgress.events.MONITOR_INSTALLED,
503+
condition: installMonitor,
497504
});
498505

499506
// Post Installation
@@ -545,7 +552,9 @@ const initCmd = new Command({
545552

546553
console.log(colors.green('\nRunner Status:'));
547554
await getAgents.handler({});
548-
console.log(colors.green(`\nGo to ${colors.blue('https://g.codefresh.io/kubernetes/monitor/services')} to view your cluster in codefresh dashbaord`));
555+
if (installMonitor) {
556+
console.log(colors.green(`\nGo to ${colors.blue('https://g.codefresh.io/kubernetes/monitor/services')} to view your cluster in codefresh dashbaord`));
557+
}
549558
console.log(colors.green(`\nDocumenation link: ${colors.blue('https://codefresh.io/docs/docs/enterprise/codefresh-runner/#codefresh-runner-preview-release')}`));
550559
console.log(colors.green(`If you had any issues with the installation please report them at: ${colors.blue('https://github.com/codefresh-io/cli/issues/new')}`));
551560
await to(progressReporter.report(installationProgress.events.FINISHED, installationProgress.status.SUCCESS));

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

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ async function migrate({
4949
runtimeName,
5050
kubeContextName,
5151
kubeNamespace,
52+
installMonitor,
5253
agentName,
5354
handleError,
5455
kubeConfigPath,
@@ -151,18 +152,20 @@ async function migrate({
151152
handleError(agentInstallErr, 'Failed to install new agent and runtime');
152153

153154
// Install new monitoring components
154-
console.log('Installing monitoring components');
155-
const monitorInstallOptions = {
156-
'kube-config-path': kubeConfigPath,
157-
'cluster-id': kubeContextName,
158-
'kube-context-name': kubeContextName,
159-
'kube-namespace': kubeNamespace,
160-
token: _.get(sdk, 'config.context.token'),
161-
verbose,
162-
noExit: true, // to prevent if from calling inner: process.exit()
163-
};
164-
const [monitorErr] = await to(installMonitoring.handler(monitorInstallOptions));
165-
await handleError(monitorErr, 'Monitor installation failed');
155+
if (installMonitor) {
156+
console.log('Installing monitoring components');
157+
const monitorInstallOptions = {
158+
'kube-config-path': kubeConfigPath,
159+
'cluster-id': kubeContextName,
160+
'kube-context-name': kubeContextName,
161+
'kube-namespace': kubeNamespace,
162+
token: _.get(sdk, 'config.context.token'),
163+
verbose,
164+
noExit: true, // to prevent if from calling inner: process.exit()
165+
};
166+
const [monitorErr] = await to(installMonitoring.handler(monitorInstallOptions));
167+
await handleError(monitorErr, 'Monitor installation failed');
168+
}
166169

167170
// Execute test pipeline on new runner
168171
await createAndRunTestPipeline(runtimeName, handleError);

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,19 @@ const upgradeCmd = new Command({
6262
.option('kube-config-path', {
6363
describe: 'Path to kubeconfig file (default is $HOME/.kube/config)',
6464
})
65+
.option('install-monitor', {
66+
describe: 'Install a monitoring component that will help provide valueable data about your cluster to Codefresh (only useable when running migration)',
67+
type: 'boolean',
68+
default: true,
69+
})
6570
.option('verbose', {
6671
describe: 'Print logs',
6772
}),
6873
handler: async (argv) => {
6974
const {
7075
'kube-config-path': kubeConfigPath,
7176
'agent-name': agentName,
77+
'install-monitor': installMonitor,
7278
verbose,
7379
} = argv;
7480
let {
@@ -162,6 +168,7 @@ const upgradeCmd = new Command({
162168
agentName,
163169
agents,
164170
runtimeName,
171+
installMonitor,
165172
verbose,
166173
handleError,
167174
}));

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

0 commit comments

Comments
 (0)