Skip to content

Commit 42cb1c7

Browse files
committed
improve docs
1 parent ab5caed commit 42cb1c7

File tree

1 file changed

+105
-17
lines changed

1 file changed

+105
-17
lines changed

README.md

Lines changed: 105 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<p align="center">An <a href="https://github.com/argoproj/argo-workflows/blob/master/docs/executor_plugins.md">Executor Plugin</a> for <a href="https://argoproj.github.io/argo-workflows/">Argo Workflows</a> that lets you interact with Argo CD servers.</p>
44
</div>
55

6-
## Example Usage
6+
## Example
77

88
```yaml
99
apiVersion: argoproj.io/v1alpha1
@@ -17,40 +17,128 @@ spec:
1717
plugin:
1818
argocd:
1919
actions:
20-
- - sync:
21-
apps:
22-
- name: guestbook
23-
- name: guestbook-backend
20+
- - app:
21+
sync:
22+
apps:
23+
- name: guestbook
24+
- name: guestbook-backend
2425
```
2526
2627
## Getting Started
2728
28-
### Prerequisites
29+
### Step 1: Get an Argo CD token
2930
30-
You will need to have a working [Argo Workflows](https://argoproj.github.io/argo-workflows/) and [Argo CD](https://argo-cd.readthedocs.io/en/stable/) instances to be able to deploy the plugin and use it.
31+
The plugin requires a secret named `argocd-sync-token` with a key called `jwt.txt` containing the Argo CD token. See the [Argo CD documentation](https://argo-cd.readthedocs.io/en/stable/user-guide/projects/#project-roles) for information about generating tokens.
32+
33+
```yaml
34+
apiVersion: v1
35+
kind: Secret
36+
metadata:
37+
name: argocd-sync-token
38+
stringData:
39+
jwt.txt: <token>
40+
```
41+
42+
After defining the secret, apply it to your cluster:
43+
44+
```shell
45+
kubectl apply -f argocd-sync-token.yaml
46+
```
3147

32-
### Installing
48+
### Step 2: Install the plugin
3349

3450
```shell
3551
kubectl apply -n argo -f https://raw.githubusercontent.com/crenshaw-dev/argocd-executor-plugin/main/manifests/argocd-executor-plugin-configmap.yaml
3652
```
3753

38-
You will have to run the workflow using a service account with appropriate permissions. See [examples/rbac.yaml](examples/rbac.yaml) for an example.
54+
**Note:** You will have to run the workflow using a service account with appropriate permissions. See [examples/rbac.yaml](examples/rbac.yaml) for an example.
3955

40-
The plugin requires a secret named `argocd-sync-token` with a key called `jwt.txt` containing the Argo CD token. See the [Argo CD documentation](https://argo-cd.readthedocs.io/en/stable/user-guide/projects/#project-roles) for information about generating tokens.
56+
### Step 3: Set your `ARGOCD_SERVER` environment variable
57+
58+
By default, the plugin uses `argocd-server.argocd.svc.cluster.local` for `ARGOCD_SERVER`. If you're using a different
59+
server, you can set the `ARGOCD_SERVER` environment variable in the plugin's configmap.
60+
61+
### Step 4: Run a workflow
62+
63+
```shell
64+
argo submit examples/argocd.yaml --serviceaccount my-service-account --watch
65+
```
66+
67+
## Usage
68+
69+
The `actions` field of the plugin config accepts a nested list of actions. Parent lists are executed sequentially, and
70+
child lists are executed in parallel. This allows you to run multiple actions in parallel, and multiple groups of
71+
actions in sequence.
72+
73+
### Running syncs in sequence
4174

4275
```yaml
43-
apiVersion: v1
44-
kind: Secret
76+
apiVersion: argoproj.io/v1alpha1
77+
kind: Workflow
4578
metadata:
46-
name: argocd-sync-token
47-
stringData:
48-
jwt.txt: <token>
79+
generateName: argocd-sequence-example-
80+
spec:
81+
entrypoint: main
82+
templates:
83+
- name: main
84+
plugin:
85+
argocd:
86+
actions:
87+
- - app:
88+
sync:
89+
apps:
90+
- name: guestbook-backend
91+
- - app:
92+
sync:
93+
apps:
94+
- name: guestbook-frontend
95+
```
96+
97+
### Setting sync options
98+
99+
```yaml
100+
apiVersion: argoproj.io/v1alpha1
101+
kind: Workflow
102+
metadata:
103+
generateName: argocd-options-example-
104+
spec:
105+
entrypoint: main
106+
templates:
107+
- name: main
108+
plugin:
109+
argocd:
110+
actions:
111+
- - app:
112+
sync:
113+
apps:
114+
- name: guestbook-backend
115+
options:
116+
- ServerSideApply=true
117+
- Validate=true
49118
```
50119

51-
The plugin also assumes the Argo CD API server is accessible on a server at this address: `argocd-server.argocd.svc.cluster.local`.
120+
### Setting a timeout
121+
122+
Each sync action may be configured with a timeout. The default is no timeout.
52123

53-
To change the address, edit the value of the ARGOCD_SERVER environment variable in the configmap.
124+
```yaml
125+
apiVersion: argoproj.io/v1alpha1
126+
kind: Workflow
127+
metadata:
128+
generateName: argocd-timeout-example-
129+
spec:
130+
entrypoint: main
131+
templates:
132+
- name: main
133+
plugin:
134+
argocd:
135+
actions:
136+
- - app:
137+
sync:
138+
apps:
139+
- name: guestbook-backend
140+
timeout: 30s
141+
```
54142

55143
## Contributing
56144

0 commit comments

Comments
 (0)