1
1
apiVersion : argoproj.io/v1alpha1
2
2
kind : WorkflowTemplate
3
3
metadata :
4
- name : patch-application-automated-sync
4
+ name : patch-application-automated-sync-external
5
+ annotations :
6
+ workflows.argoproj.io/title : Temporarily disable autosync on an Application in production environment
7
+ workflows.argoproj.io/description : |
8
+ Defined in `workflows/argo-events/workflowtemplates/disable-autosync.yaml`
5
9
spec :
6
10
entrypoint : main
7
11
arguments :
8
12
parameters :
9
13
- name : name
10
- description : " Name of the Application resource to modify."
14
+ description : " Name of the Application resource to modify in the external cluster ."
11
15
- name : duration
12
16
description : " Duration in minutes to keep automated sync disabled."
13
17
value : " 30"
18
+ - name : kubeconfig-secret-name
19
+ description : " Name of the K8s Secret containing the kubeconfig for the external cluster."
20
+ - name : kubeconfig-secret-key
21
+ description : " Key within the K8s Secret that holds the kubeconfig data."
14
22
15
23
templates :
16
24
- name : main
24
32
value : " {{workflow.parameters.name}}"
25
33
- name : automated-value
26
34
value : " false"
35
+ - name : kubeconfig-secret-name
36
+ value : " {{workflow.parameters.kubeconfig-secret-name}}"
37
+ - name : kubeconfig-secret-key
38
+ value : " {{workflow.parameters.kubeconfig-secret-key}}"
27
39
28
40
- name : wait-for-duration
29
41
template : wait
@@ -42,18 +54,30 @@ spec:
42
54
value : " {{workflow.parameters.name}}"
43
55
- name : automated-value
44
56
value : " true"
57
+ - name : kubeconfig-secret-name
58
+ value : " {{workflow.parameters.kubeconfig-secret-name}}"
59
+ - name : kubeconfig-secret-key
60
+ value : " {{workflow.parameters.kubeconfig-secret-key}}"
45
61
46
62
- name : patch-automated-sync
47
63
inputs :
48
64
parameters :
49
65
- name : resource-name
50
66
- name : automated-value
67
+ - name : kubeconfig-secret-name
68
+ - name : kubeconfig-secret-key
51
69
resource :
52
70
action : patch
71
+ # The kubeconfig from the secret will dictate the target cluster.
72
+ # The group, version, kind, and name refer to the resource on that external cluster.
53
73
group : argoproj.io
54
74
version : v1alpha1
55
75
kind : Application
56
76
name : " {{inputs.parameters.resource-name}}"
77
+ # Namespace of the Application on the external cluster.
78
+ # If not specified, it will use the default namespace from the kubeconfig,
79
+ # or you can explicitly set it here if needed.
80
+ # namespace: "your-app-namespace-on-external-cluster"
57
81
patch : |
58
82
[
59
83
{
62
86
"value": {{inputs.parameters.automated-value}}
63
87
}
64
88
]
89
+ # Instruct Argo to use the kubeconfig from the specified secret
90
+ kubeconfig :
91
+ secretKeyRef :
92
+ name : " {{inputs.parameters.kubeconfig-secret-name}}"
93
+ key : " {{inputs.parameters.kubeconfig-secret-key}}"
65
94
- name : wait
66
95
inputs :
67
96
parameters :
68
97
- name : duration-minutes
69
98
suspend :
70
- duration : " {{=sprig.int(inputs.parameters.duration-minutes) * 60}}" # Convert minutes to seconds string for duration
99
+ # Here we convert minutes to seconds and ensure it's a string.
100
+ duration : " {{=sprig.int(inputs.parameters.duration-minutes) * 60}}"
0 commit comments