In ArgoCD how to target a deployment into a specific cluster or a group of clusters in a multi-cluster environment ?
I found that the right way to deploy to multiple clusters is by using generators, clusters with selectors like below:
generators:
- clusters:
selector:
matchLabels:
staging: true
Full Example:
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
name: bgd
namespace: openshift-gitops
spec:
generators:
- clusters:
selector:
matchLabels:
bgd: dev
template:
metadata:
name: '{{name}}-bgd'
spec:
project: default
syncPolicy:
automated:
prune: true
selfHeal: true
source:
repoURL: https://github.com/christianh814/gitops-examples
targetRevision: master
path: applicationsets/cluster-generator/overlays/dev/
destination:
server: '{{server}}'
namespace: bgd
More details can be found here: https://cloud.redhat.com/blog/getting-started-with-applicationsets