2018-07-27 23:51:44 +00:00
# Parameter Overrides
2020-11-16 20:34:44 +00:00
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
2019-01-12 23:50:38 +00:00
redeploying an application by changing application parameters via Argo CD, instead of making the
2019-04-05 22:12:27 +00:00
changes to the manifests in Git.
2018-07-27 23:51:44 +00:00
2019-04-05 22:12:27 +00:00
!!! tip
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.
2018-07-27 23:51:44 +00:00
To use parameter overrides, run the `argocd app set -p (COMPONENT=)PARAM=VALUE` command:
2019-04-05 22:12:27 +00:00
```bash
2020-11-02 22:16:09 +00:00
argocd app set guestbook -p image=example/guestbook:abcd123
2018-07-27 23:51:44 +00:00
argocd app sync guestbook
```
2019-01-04 15:41:17 +00:00
The `PARAM` is expected to be a normal YAML path
```bash
2020-11-02 22:16:09 +00:00
argocd app set guestbook -p ingress.enabled=true
argocd app set guestbook -p ingress.hosts[0]=guestbook.myclusterurl
2019-01-04 15:41:17 +00:00
```
2025-04-10 14:47:13 +00:00
The `argocd app set` [command ](./commands/argocd_app_set.md ) supports more tool-specific flags such as `--kustomize-image` , `--jsonnet-ext-var-str` , etc.
You can also specify overrides directly in the source field on the application spec. Read more about supported options in the corresponding tool [documentation ](./application_sources.md ).
2020-11-16 20:34:44 +00:00
## When To Use Overrides?
2018-11-05 19:29:01 +00:00
The following are situations where parameter overrides would be useful:
2018-07-27 23:51:44 +00:00
1. 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
2019-01-12 23:50:38 +00:00
case, the application would expose a parameter named `image` , whose value used in the `dev`
2018-07-27 23:51:44 +00:00
environment contains a placeholder value (e.g. `example/guestbook:replaceme` ). The placeholder value
2019-04-05 22:12:27 +00:00
would be determined externally (outside of Git) such as a build system. Then, as part of the build
2018-11-05 19:29:01 +00:00
pipeline, the parameter value of the `image` would be continually updated to the freshly built image
2020-11-02 22:16:09 +00:00
(e.g. `argocd app set guestbook -p image=example/guestbook:abcd123` ). A sync operation
2018-07-27 23:51:44 +00:00
would result in the application being redeployed with the new image.
2019-01-12 23:50:38 +00:00
2. A repository of Helm manifests is already publicly available (e.g. https://github.com/helm/charts).
2018-07-27 23:51:44 +00:00
Since commit access to the repository is unavailable, it is useful to be able to install charts from
2019-01-12 23:50:38 +00:00
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
2022-08-30 12:22:54 +00:00
repository and customize the database password, you would run:
2018-07-27 23:51:44 +00:00
2019-04-05 22:12:27 +00:00
```bash
2018-07-28 01:06:21 +00:00
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
2018-07-27 23:51:44 +00:00
```
2020-11-16 20:34:44 +00:00
## 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.
The `.argocd-source.yaml` file is used during manifest generation and overrides
application source fields, such as `kustomize` , `helm` etc.
Example:
```yaml
kustomize:
images:
2025-05-19 14:49:11 +00:00
- quay.io/argoprojlabs/argocd-e2e-container:0.2
2020-11-16 20:34:44 +00:00
```
The `.argocd-source` is trying to solve two following main use cases:
2021-07-13 17:02:03 +00:00
- Provide the unified way to "override" application parameters in Git and enable the "write back" feature
2020-11-16 20:34:44 +00:00
for projects like [argocd-image-updater ](https://github.com/argoproj-labs/argocd-image-updater ).
2022-01-26 11:18:23 +00:00
- Support "discovering" applications in the Git repository by projects like [applicationset ](https://github.com/argoproj/applicationset )
2022-04-04 15:22:42 +00:00
(see [git files generator ](https://github.com/argoproj/argo-cd/blob/master/applicationset/examples/git-generator-files-discovery/git-generator-files.yaml ))
2020-12-15 16:51:02 +00:00
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 `.argocd-source-<appname>.yaml` ,
where `<appname>` is the name of the application the overrides are valid for.
2025-04-10 14:47:13 +00:00
If there exists a non-application specific `.argocd-source.yaml` , parameters
2020-12-15 16:51:02 +00:00
included in that file will be merged first, and then the application specific
parameters are merged, which can also contain overrides to the parameters
2022-08-30 12:22:54 +00:00
stored in the non-application specific file.