Argo CD provides a mechanism to override the parameters of Argo CD applications that leverages config management tools. This provides flexibility in having most of the application manifests defined in Git, while leaving room for some parts of the k8s manifests determined dynamically, or outside of Git. It also serves as an alternative way of redeploying an application by changing application parameters via Argo CD, instead of making the changes to the manifests in Git.
Many consider this mode of operation as an anti-pattern to GitOps, since the source of truth becomes a union of the Git repository, and the application overrides. The Argo CD parameter overrides feature is provided mainly as a convenience to developers and is intended to be used in dev/test environments, vs. production environments.
To use parameter overrides, run the
argocd app set -p (COMPONENT=)PARAM=VALUE command:
argocd app set guestbook -p image=example/guestbook:abcd123 argocd app sync guestbook
PARAM is expected to be a normal YAML path
argocd app set guestbook -p ingress.enabled=true argocd app set guestbook -p ingress.hosts=guestbook.myclusterurl
argocd app set command supports more tool-specific flags such as
flags. You can also specify overrides directly in the source field on application spec. Read more about supported options in corresponded tool documentation.
When To Use Overrides?¶
The following are situations where parameter overrides would be useful:
A team maintains a "dev" environment, which needs to be continually updated with the latest version of their guestbook application after every build in the tip of master. To address this use case, the application would expose a parameter named
image, whose value used in the
devenvironment contains a placeholder value (e.g.
example/guestbook:replaceme). The placeholder value would be determined externally (outside of Git) such as a build system. Then, as part of the build pipeline, the parameter value of the
imagewould be continually updated to the freshly built image (e.g.
argocd app set guestbook -p image=example/guestbook:abcd123). A sync operation would result in the application being redeployed with the new image.
A repository of Helm manifests is already publicly available (e.g. https://github.com/helm/charts). Since commit access to the repository is unavailable, it is useful to be able to install charts from the public repository and customize the deployment with different parameters, without resorting to forking the repository to make the changes. For example, to install Redis from the Helm chart repository and customize the database password, you would run:
argocd app create redis --repo https://github.com/helm/charts.git --path stable/redis --dest-server https://kubernetes.default.svc --dest-namespace default -p password=abc123
Store Overrides In Git¶
The config management tool specific overrides can be specified in
.argocd-source.yaml file stored in the source application
directory in the Git repository.
.argocd-source.yaml file is used during manifest generation and overrides
application source fields, such as
kustomize: images: - gcr.io/heptio-images/ks-guestbook-demo:0.2
.argocd-source is trying to solve two following main use cases:
- Provide the unified way to "override" application parameters in Git and enable the "write back" feature for projects like argocd-image-updater.
- Support "discovering" applications in the Git repository by projects like applicationset (see git files generator)
You can also store parameter overrides in an application specific file, if you are sourcing multiple applications from a single path in your repository.
The application specific file must be named
<appname> is the name of the application the overrides are valid for.
If there exists an non-application specific
included in that file will be merged first, and then the application specific
parameters are merged, which can also contain overrides to the parameters
stored in the non-application specific file.