Skip to content

Commit 03e3943

Browse files
committed
argocd: first draft of a workflow to disable autosync temporarily
1 parent 0d9d868 commit 03e3943

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
apiVersion: argoproj.io/v1alpha1
2+
kind: WorkflowTemplate
3+
metadata:
4+
name: patch-application-automated-sync
5+
spec:
6+
entrypoint: main
7+
arguments:
8+
parameters:
9+
- name: name
10+
description: "Name of the Application resource to modify."
11+
- name: duration
12+
description: "Duration in minutes to keep automated sync disabled."
13+
value: "30"
14+
15+
templates:
16+
- name: main
17+
dag:
18+
tasks:
19+
- name: disable-automated-sync
20+
template: patch-automated-sync
21+
arguments:
22+
parameters:
23+
- name: resource-name
24+
value: "{{workflow.parameters.name}}"
25+
- name: automated-value
26+
value: "false"
27+
28+
- name: wait-for-duration
29+
template: wait
30+
dependencies: [disable-automated-sync]
31+
arguments:
32+
parameters:
33+
- name: duration-minutes
34+
value: "{{workflow.parameters.duration}}"
35+
36+
- name: enable-automated-sync
37+
template: patch-automated-sync
38+
dependencies: [wait-for-duration]
39+
arguments:
40+
parameters:
41+
- name: resource-name
42+
value: "{{workflow.parameters.name}}"
43+
- name: automated-value
44+
value: "true"
45+
46+
- name: patch-automated-sync
47+
inputs:
48+
parameters:
49+
- name: resource-name
50+
- name: automated-value
51+
resource:
52+
action: patch
53+
group: argoproj.io
54+
version: v1alpha1
55+
kind: Application
56+
name: "{{inputs.parameters.resource-name}}"
57+
patch: |
58+
[
59+
{
60+
"op": "replace",
61+
"path": "/spec/syncPolicy/automated",
62+
"value": {{inputs.parameters.automated-value}}
63+
}
64+
]
65+
- name: wait
66+
inputs:
67+
parameters:
68+
- name: duration-minutes
69+
suspend:
70+
duration: "{{=sprig.int(inputs.parameters.duration-minutes) * 60}}" # Convert minutes to seconds string for duration

0 commit comments

Comments
 (0)