Argo CD With Helm: Charts, Values, and Versioned Releases
Using Multiple Sources for a Single Application
Overriding a value or two with parameters is fine. The problem is what happens as the list grows: every override lives inline in the Application manifest, so the thing that should be reviewable configuration ends up buried in a Kubernetes resource that nobody wants to read.
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: todo-app
namespace: argocd
spec:
destination:
namespace: default
server: https://kubernetes.default.svc
project: default
source:
chart: todo
repoURL: $HELM_REPO_URL
targetRevision: 0.2.0
helm:
parameters:
- name: replicaCount
value: '5'
- name: service.port
value: '5000'
- name: resources.limits.memory
value: '256Mi'
# ...and so on for every value you need to change
valueFiles:
- values.yaml
syncPolicy:
automated:
prune: true
selfHeal: true
allowEmpty: true
This is where Applications turn unmanageable. The better approach is to pull the overrides out of the Application and into a values file in Git, then point the Application at two sources: the chart from the Helm registry, and the values file from your Git repo. The overrides become a normal file you can diff, review in a merge request, and roll back, instead of inline YAML.
The mechanism is Argo CD's multi-source support (spec.sources, plural). One source is tagged with a ref name and contributes no manifests of its own; it just exposes its files. The Helm source then reads a values file out of it using $.
Here is how we proceed:
- Create a
values-override.yamlin the Git repository. - Put the values we want to override in that file.
- List two sources on the Application: the Git repo (as a
ref) and the Helm chart.
Copy the chart's values as a starting point:
cp $HOME/todo/app/manifests/helm/todo/values.yaml \
$HOME/todo/app/manifests/values-override.yaml
Set replicaCount to 2 so we can see the override take effect:
cat < $HOME/todo/app/manifests/values-override.yaml
replicaCount: 2
EOF
GitOps the Hard Way, with Argo CD
Build Real GitOps Pipelines From Empty Clusters to Automated DeploysEnroll now to unlock all content and receive all future updates for free.
