I'm experiencing an issue with Argo CD in a multi-service Helm chart setup and seeking guidance.
Setup:
- A single repository (
service-configuration) contains Helm charts for multiple services. - Each service has a dedicated directory in this repo with its own Helm chart and values (like image tags, resources, env vars).
- Each service's source code is in a separate repository.
- Our CI pipeline updates the
service-configurationrepository with new image tags when a service is updated.
Issue:
- Each service is represented as a separate Argo CD application, each tracking its own directory within the
service-configurationrepo. - However, when one service is updated (and its respective directory in the Helm chart repo is updated), all Argo CD applications sync, not just the one related to the updated service.
Question: How can I configure Argo CD to only sync the specific application related to the updated service, avoiding unnecessary updates to all applications, while maintaining our current workflow?
apps manifests (using helm templating)
{{- range .Values.services }}
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: {{ .serviceName }}-{{ $.Values.environment }}
namespace: argocd
spec:
project: {{ $.Values.project }}
source:
repoURL: {{ $.Values.repoUrl }}
targetRevision: {{ .branch }}
path: services/{{ .path }}/{{ $.Values.environment }}
helm:
releaseName: {{ .serviceName }}
valueFiles:
- ../shared/values.yaml
- overrides.yaml
- ../../../global-values/{{ $.Values.environment }}-global-values.yaml #TODO: move this back to the top when we have all environments
destination:
server: {{ $.Values.clusterUrl }}
namespace: {{ .namespace }}
syncPolicy:
automated:
prune: false
selfHeal: true
syncOptions:
- CreateNamespace=true
- Refresh=1m
- ServerSideApply=true
---
{{- end }}
app of apps:
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: legit-services-{{ .Values.environment }}
namespace: argocd
spec:
project: {{ .Values.project }}
source:
repoURL: {{ .Values.repoUrl }}
targetRevision: HEAD
path: applications/argocd-apps
helm:
releaseName: legit-services-{{ .Values.environment }}
destination:
server: "https://kubernetes.default.svc"
namespace: argocd
syncPolicy:
automated:
prune: false
selfHeal: true
syncOptions:
- CreateNamespace=true
- Refresh=1m
example values:
repoUrl: "<repo url>"
clusterUrl: "<cluster url>"
environment: "dev"
project: "services"
services:
- serviceName: first-service
namespace: default
branch: HEAD
path: slack-service
- serviceName: second-service
namespace: default
branch: HEAD
Any insights or suggestions to remedy this would be greatly appreciated!
also any suggestions to improve the setup would be appreciated.
Thank you!