@@ -24,13 +24,31 @@ const command = new Command({
24
24
. option ( 'kube-config-path' , {
25
25
describe : 'Path to kubeconfig file (default is $HOME/.kube/config)' ,
26
26
} )
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
+ } )
27
38
. example (
28
- 'codefresh upgrade gitops' ,
39
+ 'codefresh upgrade gitops argocd-agent ' ,
29
40
'Update gitops agent' ,
30
41
) ;
31
42
} ,
32
43
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
+
34
52
const binLocation = await downloadProvider ( { provider } ) ;
35
53
const componentRunner = new Runner ( binLocation ) ;
36
54
@@ -42,9 +60,22 @@ const command = new Command({
42
60
commands . push ( '--kubeconfig' ) ;
43
61
commands . push ( kubeConfigPath ) ;
44
62
}
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
+ }
45
75
46
76
await componentRunner . run ( components . gitops [ provider ] , commands ) ;
47
77
} ,
48
78
} ) ;
49
79
50
80
module . exports = command ;
81
+
0 commit comments