@@ -24,13 +24,31 @@ const command = new Command({
2424 . option ( 'kube-config-path' , {
2525 describe : 'Path to kubeconfig file (default is $HOME/.kube/config)' ,
2626 } )
27+ . option ( 'kube-namespace' , {
28+ describe : 'Name of the namespace on which Argo agent should be updated' ,
29+ } )
30+ . option ( 'kube-context-name' , {
31+ describe : 'Name of the kubernetes context where Argo agent should be updated (default is current-context)' ,
32+ } )
33+ . option ( 'in-cluster' , {
34+ type : 'boolean' ,
35+ default : false ,
36+ describe : 'Use this option if Argo agent is been updated from inside a cluster' ,
37+ } )
2738 . example (
28- 'codefresh upgrade gitops' ,
39+ 'codefresh upgrade gitops argocd-agent ' ,
2940 'Update gitops agent' ,
3041 ) ;
3142 } ,
3243 handler : async ( argv ) => {
33- const { 'kube-config-path' : kubeConfigPath , provider } = argv ;
44+ const {
45+ provider,
46+ 'kube-config-path' : kubeConfigPath ,
47+ 'kube-namespace' : kubeNamespace ,
48+ 'kube-context-name' : kubeContextName ,
49+ 'in-cluster' : inCluster ,
50+ } = argv ;
51+
3452 const binLocation = await downloadProvider ( { provider } ) ;
3553 const componentRunner = new Runner ( binLocation ) ;
3654
@@ -42,9 +60,22 @@ const command = new Command({
4260 commands . push ( '--kubeconfig' ) ;
4361 commands . push ( kubeConfigPath ) ;
4462 }
63+ if ( kubeNamespace ) {
64+ commands . push ( '--kube-namespace' ) ;
65+ commands . push ( kubeNamespace ) ;
66+ }
67+ if ( kubeContextName ) {
68+ commands . push ( '--kube-context-name' ) ;
69+ commands . push ( kubeContextName ) ;
70+ }
71+ if ( inCluster ) {
72+ commands . push ( '--in-cluster' ) ;
73+ commands . push ( 'true' ) ;
74+ }
4575
4676 await componentRunner . run ( components . gitops [ provider ] , commands ) ;
4777 } ,
4878} ) ;
4979
5080module . exports = command ;
81+
0 commit comments