I have a single argocd repository which contains all the configuration for the Kubernetes cluster. Now I want to work with PRs and only want to merge things which were tested on our continuous integration system before they can be merged. To do so, my idea was to have another cluster which I then deploy the branch to. Sadly, argocd defines the revision
and targetRevision
inside its yaml files – therefore, this is “hard-coded” inside git.
What is the best way to switch the revision, so I can “apply” any feature branch and still link it to a cluster?
Target
GIT - Branch master -> prod-Cluster
- Branch dev -> dev-Cluster
- Branch feature.. -> feature-Cluster using kind
ArgoCD Config
Application (root) -> ApplicationSet (app-of-appset) -> apps/* directory containing kustomization files
Example argo config for application set
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
name: cluster-addons
spec:
generators:
- git:
repoURL: https://github.com/argoproj-labs/applicationset.git
revision: HEAD <--------- Thats what I want to adjust for testing
directories:
- path: examples/git-generator-directory/cluster-addons/*
template:
metadata:
name: '{{path.basename}}'
spec:
project: default
source:
repoURL: https://github.com/argoproj-labs/applicationset.git
targetRevision: HEAD <--------- Thats what I want to adjust for testing
path: '{{path}}'
destination:
server: https://kubernetes.default.svc
namespace: '{{path.basename}}'