-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7f8b0d2
commit 3301091
Showing
2 changed files
with
54 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* eslint-disable max-len */ | ||
const Command = require('../../Command'); | ||
const unInstallRoot = require('../root/uninstall.cmd'); | ||
const { downloadArgo } = require('../hybrid/helper'); | ||
const { Runner, components } = require('../../../../binary'); | ||
|
||
|
||
const unInstallAgentCmd = new Command({ | ||
root: false, | ||
parent: unInstallRoot, | ||
command: 'argo', | ||
description: 'Uninstall argo agent', | ||
webDocs: { | ||
category: 'Argo', | ||
title: 'Uninstall', | ||
weight: 100, | ||
}, | ||
builder: yargs => yargs | ||
.env('CF_ARG_') // this means that every process.env.CF_ARG_* will be passed to argv | ||
.option('kube-context-name', { | ||
describe: 'Name of the kubernetes context on which monitor should be uninstalled [$CF_ARG_KUBE_CONTEXT_NAME]', | ||
}) | ||
.option('kube-namespace', { | ||
describe: 'Name of the namespace on which monitor should be uninstalled [$CF_ARG_KUBE_NAMESPACE]', | ||
}), | ||
handler: async (argv) => { | ||
const { | ||
'kube-namespace': kubeNamespace, | ||
'kube-context-name': kubeContextName, | ||
} = argv; | ||
|
||
const binLocation = await downloadArgo(); | ||
const componentRunner = new Runner(binLocation); | ||
|
||
const commands = [ | ||
'uninstall', | ||
]; | ||
|
||
if (kubeContextName) { | ||
commands.push('--kube-context-name'); | ||
commands.push(kubeContextName); | ||
} | ||
|
||
if (kubeNamespace) { | ||
commands.push('--kube-namespace'); | ||
commands.push(kubeNamespace); | ||
} | ||
|
||
await componentRunner.run(components.argo, commands); | ||
}, | ||
}); | ||
|
||
module.exports = unInstallAgentCmd; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters