An Executor Plugin for Argo Workflows that lets you interact with Argo CD servers. All you need is an Argo CD API token.
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: argocd-example-
spec:
entrypoint: main
templates:
- name: main
steps:
- - name: sync
template: sync
arguments:
parameters:
- name: apps
value: |
- name: guestbook-frontend
- name: guestbook-backend
- - name: diff
template: diff
- name: sync
inputs:
parameters:
- name: apps
plugin:
argocd:
app:
sync:
apps: "{{inputs.parameters.apps}}"
- name: diff
plugin:
argocd:
app:
diff:
app:
name: guestbook-frontend
The plugin requires a secret named argocd-token
with a key called token
containing the Argo CD token. See the Argo CD documentation for information about generating tokens.
apiVersion: v1
kind: Secret
metadata:
name: argocd-token
stringData:
token: <token>
After defining the secret, apply it to your cluster:
kubectl apply -f argocd-token.yaml
kubectl apply -n argo -f https://raw.githubusercontent.com/crenshaw-dev/argocd-executor-plugin/main/manifests/argocd-executor-plugin-configmap.yaml
Note: You will have to run the workflow using a service account with appropriate permissions. See examples/rbac.yaml for an example.
By default, the plugin uses argocd-server.argocd.svc.cluster.local
for ARGOCD_SERVER
. If you're using a different
server, you can set the ARGOCD_SERVER
environment variable in the plugin's configmap.
argo submit examples/argocd.yaml --serviceaccount my-service-account --watch
The actions
field of the plugin config accepts a nested list of actions. Parent lists are executed sequentially, and
child lists are executed in parallel. This allows you to run multiple actions in parallel, and multiple groups of
actions in sequence.
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: argocd-options-example-
spec:
entrypoint: main
templates:
- name: main
plugin:
argocd:
app:
sync:
apps: |
- name: guestbook-backend
options: |
- ServerSideApply=true
- Validate=true
Each sync action may be configured with a timeout. The default is no timeout.
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: argocd-timeout-example-
spec:
entrypoint: main
templates:
- name: main
plugin:
argocd:
app:
sync:
apps: |
- name: guestbook-backend
options: |
- ServerSideApply=true
- Validate=true
timeout: 30s
Starting in Argo CD v2.5, Applications may be installed outside the argocd
namespace (or whichever namespace Argo CD
installed in). To specify the namespace, use the namespace
field.
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: argocd-namespace-example-
spec:
entrypoint: main
templates:
- name: main
plugin:
argocd:
app:
sync:
apps: |
- name: guestbook-backend
namespace: my-apps-namespace
Head to the scripts directory to find out how to get the project up and running on your local machine for development and testing purposes.