is it possible that argocd manage multiple git branches? #8500
Replies: 1 comment 5 replies
-
I usually use helm charts for such configurations. Under "argocd/workload" you would create a new Helm chart: argocd/workload/
Chart.yaml # A YAML file containing information about the chart
values.yaml # The default configuration values for this chart
templates/ # A directory of templates that, when combined with values,
# will generate valid Kubernetes manifest files. In the "templates/" folder of the Helm chart you would put your ArgoCD Application (Istio in your example) argocd/workload/templates/
istio.application.yaml
# other applications In values.yaml you would define your parameter: targetRevision: 'HEAD' # default value would be HEAD Your Istio application (istio.application.yaml) would use that new parameter: apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: istio
namespace: argocd
finalizers:
- resources-finalizer.argocd.argoproj.io
spec:
project: default
destination:
name: in-cluster
namespace: default
source:
repoURL: 'https://github.com/dev-cluster.git'
targetRevision: {{ .Values.targetRevision }} # <------------- new parameter is used here
path: argocd/workload/istio
syncPolicy:
automated:
selfHeal: true
prune: true And finally, your root application "workload" would be installing not just the folder but your new Helm chart: apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name:workload
namespace: argocd
finalizers:
- resources-finalizer.argocd.argoproj.io
spec:
project: default
destination:
name: in-cluster
namespace: argocd
source:
repoURL: 'https://github.com/dev-cluster.git'
targetRevision: HEAD
path: argocd/workload
helm:
valueFiles:
- values.yaml
values: |
targetRevision: 'HEAD'
syncPolicy:
automated:
selfHeal: true
prune: true So in the result, by default, you would be installing from HEAD, but if a developer needs to try something, he/she would be able to use ArgoCD UI to overwrite "targetRevision" value to anything else. |
Beta Was this translation helpful? Give feedback.
-
we have the below situation.
gitlab pipeline to build images and helm charts.
in github repo, we define the argocd managed application. The configuration is like below
and under path
argocd/workload
we define again with the application's configand then the HEAD targetRevision will synced by argocd.
However in this case, if we want to test something like new images/new helm charts. we need to always modify the main branch's targetRevision. It is not convenient for developers to test app in k8s.
Do we have a way e.g. argocd can manage multiple git branches, and based on the settings in the git branch, it can deploy another application in the cluster?
or does someone have some other good solutions for it?
many thanks
Beta Was this translation helpful? Give feedback.
All reactions