@@ -3,7 +3,13 @@ const Command = require('../../Command');
3
3
const unInstallRoot = require ( '../root/uninstall.cmd' ) ;
4
4
const { downloadProvider } = require ( '../hybrid/helper' ) ;
5
5
const { Runner, components } = require ( '../../../../binary' ) ;
6
+ const codefreshProvider = require ( './codefresh/uninstall' ) ;
7
+ const argocdAgentProvider = require ( './argocd/uninstall' ) ;
6
8
9
+ const PROVIDERS = {
10
+ codefresh : codefreshProvider ,
11
+ 'argocd-agent' : argocdAgentProvider ,
12
+ } ;
7
13
8
14
const unInstallAgentCmd = new Command ( {
9
15
root : false ,
@@ -19,27 +25,31 @@ const unInstallAgentCmd = new Command({
19
25
. env ( 'CF_ARG_' )
20
26
. positional ( 'provider' , {
21
27
describe : 'Gitops provider' ,
22
- choices : [ 'argocd-agent' ] ,
28
+ choices : Object . keys ( PROVIDERS ) ,
23
29
required : true ,
24
30
} )
25
31
. option ( 'kube-config-path' , {
26
32
describe : 'Path to kubeconfig file (default is $HOME/.kube/config)' ,
33
+ } )
34
+ . option ( 'kube-context-name' , {
35
+ describe : 'Name of Kubernetes context' ,
36
+ } )
37
+ . option ( 'kube-namespace' , {
38
+ describe : 'Namespace in Kubernetes cluster' ,
39
+ } )
40
+ . option ( 'install-manifest' , {
41
+ describe : 'Url of argocd install manifest' ,
42
+ default : 'https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml' ,
43
+ } )
44
+ . option ( 'in-cluster' , {
45
+ type : 'boolean' ,
46
+ default : false ,
47
+ describe : 'Use this option if Argo agent is been updated from inside a cluster' ,
27
48
} ) ,
28
49
handler : async ( argv ) => {
29
- const { 'kube-config-path' : kubeConfigPath , provider } = argv ;
30
-
31
- const binLocation = await downloadProvider ( { provider } ) ;
32
- const componentRunner = new Runner ( binLocation ) ;
33
- const commands = [
34
- 'uninstall' ,
35
- ] ;
36
-
37
- if ( kubeConfigPath ) {
38
- commands . push ( '--kubeconfig' ) ;
39
- commands . push ( kubeConfigPath ) ;
40
- }
41
-
42
- await componentRunner . run ( components . gitops [ provider ] , commands ) ;
50
+ const { provider } = argv ;
51
+ const providerInstaller = PROVIDERS [ provider ] ;
52
+ return providerInstaller . uninstall ( argv ) ;
43
53
} ,
44
54
} ) ;
45
55
0 commit comments