@@ -3,7 +3,13 @@ const Command = require('../../Command');
33const unInstallRoot = require ( '../root/uninstall.cmd' ) ;
44const { downloadProvider } = require ( '../hybrid/helper' ) ;
55const { Runner, components } = require ( '../../../../binary' ) ;
6+ const codefreshProvider = require ( './codefresh/uninstall' ) ;
7+ const argocdAgentProvider = require ( './argocd/uninstall' ) ;
68
9+ const PROVIDERS = {
10+ codefresh : codefreshProvider ,
11+ 'argocd-agent' : argocdAgentProvider ,
12+ } ;
713
814const unInstallAgentCmd = new Command ( {
915 root : false ,
@@ -19,27 +25,31 @@ const unInstallAgentCmd = new Command({
1925 . env ( 'CF_ARG_' )
2026 . positional ( 'provider' , {
2127 describe : 'Gitops provider' ,
22- choices : [ 'argocd-agent' ] ,
28+ choices : Object . keys ( PROVIDERS ) ,
2329 required : true ,
2430 } )
2531 . option ( 'kube-config-path' , {
2632 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' ,
2748 } ) ,
2849 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 ) ;
4353 } ,
4454} ) ;
4555
0 commit comments