ApplicationSet with Cluster Generator — automatic deployment to all clusters.
Example (deploy to all clusters):
1apiVersion: argoproj.io/v1alpha12kind: ApplicationSet3metadata:4 name: myapp-clusters5 namespace: argocd6spec:7 generators:8 - clusters:9 selector:10 matchLabels:11 env: production12 values:13 revision: main14 template:15 metadata:16 name: "myapp-{{name}}"17 spec:18 project: default19 source:20 repoURL: https://github.com/org/k8s-manifests21 targetRevision: "{{values.revision}}"22 path: "overlays/production"23 destination:24 server: "{{server}}"25 namespace: production26 syncPolicy:27 automated:28 prune: true29 selfHeal: true30 syncOptions:31 - CreateNamespace=true
Git Generator (by directories):
1generators:2 - git:3 repoURL: https://github.com/org/apps4 revision: main5 directories:6 - path: apps/*
Each folder in apps/ creates an Application with the folder name.
Matrix Generator (cluster × application):
1generators:2 - matrix:3 generators:4 - clusters:5 selector:6 matchLabels:7 env: production8 - list:9 elements:10 - app: frontend11 path: apps/frontend12 - app: backend13 path: apps/backend
Creates an Application for each combination: frontend-prod-us, frontend-prod-eu, backend-prod-us, etc.