# Add ignoreDifferences to Argo CD Applications

Yes. An agent adds ignoreDifferences and RespectIgnoreDifferences to the Argo CD Applications that self-heal, so scaling and webhooks stop showing as drift.

[Run this on Rush](https://cloud.getrush.ai/run/add-ignore-differences/argo-cd/). Opens the console with this prompt ready to send, in a Project that has your repository.

## What the agent does

The agent reads how the Applications are generated before it touches a spec. In a repository like argoproj/argocd-example-apps, the `apps` directory is a Helm chart (`Chart.yaml`, `applications` 0.1.0) whose `values.yaml` lists every example under `applications`, with `config.spec.source.repoURL` and `targetRevision: master` shared by all of them. `templates/applications.yaml` ranges over that list and renders one `Application` per entry, named `example.<name>` in the `argocd` namespace with the `resources-finalizer.argocd.argoproj.io` finalizer, a `project` defaulting to `default`, a `path` defaulting to the entry's name, an optional `tool` block passed through with `toYaml`, and a `syncPolicy` that is the same for all of them: `CreateNamespace=true` plus `automated` with `prune: true` and `selfHeal: true`. That last pair is what makes the job matter: with `selfHeal` on, a `kubectl scale` or a horizontal pod autoscaler changing `replicas` is reverted on the next sync and the app shows as out of sync until then.

It then reads the workloads those Applications own. `guestbook/guestbook-ui-deployment.yaml` is a plain Deployment with `replicas: 1` running `gcr.io/google-samples/gb-frontend:v5`; `kustomize-guestbook` wraps the same two files with a `kustomize-` name prefix; `helm-guestbook/templates/deployment.yaml` takes `replicas` from `.Values.replicaCount`; `sock-shop/kustomization.yaml` lists twenty-eight manifests, fourteen of them Deployments at `replicas: 1` such as `front-end` on `weaveworksdemos/front-end:0.3.12`; and `blue-green` is an Argo Rollouts `Rollout` with a `blueGreen` strategy, whose `replicas` the Rollout controller changes while it promotes. Each of these is a place where a controller or a person writes a field Git also declares.

The change goes into the chart, not into nineteen hand-edited files. The template gains an optional `ignoreDifferences` block rendered from each entry, with a chart-wide default under `config.spec.ignoreDifferences`, and adds `RespectIgnoreDifferences=true` to `syncOptions` whenever the list is non-empty, because without that option Argo CD ignores the field in the diff but still writes Git's value on sync. The default entry covers `apps/Deployment` at `jsonPointers: [/spec/replicas]`, so `guestbook`, `kustomize-guestbook`, `helm-guestbook` and `sock-shop` keep whatever replica count a scaler set; `blue-green` gets its own entry for `argoproj.io/Rollout` on the same pointer. For Applications whose charts carry admission webhooks, the pull request shows the `managedFieldsManagers` form that ignores what `kube-controller-manager` or a cert injector writes rather than a path, and leaves it commented in `values.yaml` for the entries that need it.

The proof is the rendered output. The agent runs `helm lint apps` and `helm template apps` before and after, diffs the two renders, and shows that only the entries given an `ignoreDifferences` list changed and that each changed Application now carries both the list and the `RespectIgnoreDifferences=true` option. Where the Argo CD `Application` CRD schema is reachable, it validates the rendered manifests with `kubeconform` against it. It does not add ignore rules for fields nobody else writes: a rule that hides a real drift is worse than none, and the description says which entries it deliberately left without one.

## Start it with one API call

`POST https://api.phoenix.so/o/{org}/sessions`

```json
{
  "agent": "claude",
  "input": "Add ignoreDifferences to the Argo CD Applications in this repository. Read the chart or manifests that generate the Application resources, every syncPolicy, and the Deployments, Rollouts and other workloads each Application owns. Where an Application uses automated selfHeal and owns a workload whose replicas a scaler or a person changes, add an ignoreDifferences entry for /spec/replicas on that kind and add RespectIgnoreDifferences=true to its syncOptions. Make the list configurable per Application and provide a sensible default, show the managedFieldsManagers form for admission-webhook fields where relevant, and do not add rules for fields nothing else writes. Render the Applications before and after, diff them, lint the chart, validate against the Application CRD schema if available, and include that output. Open a pull request.",
  "resources": [
    {
      "url": "https://github.com/your-org/your-app"
    }
  ]
}
```

1. **Get an API key.** In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
2. **Send the request.** POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
3. **Read what came back.** Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.

## What comes back

What comes back is a pull request that changes `apps/templates/applications.yaml` and `apps/values.yaml`: a rendered `ignoreDifferences` block, a default entry for Deployment replicas, per-entry overrides for the Rollout, and `RespectIgnoreDifferences=true` added to `syncOptions` only on the Applications that got a list. Nothing changes under `guestbook`, `sock-shop` or the other workload directories.

The description carries the `helm lint` result, the diff of the two renders showing exactly which Applications changed and how, and the schema validation output when it ran. It lists the Applications left without a rule and why. The commands and full output are in the transcript at `GET /o/{org}/sessions/{id}/messages`.

Before merging, a reviewer confirms that no entry hides a field the team wants Git to own, decides whether the replica rule should be the chart-wide default or opt-in per Application, and plans the first sync, after which the Applications show `Synced` with the live replica counts left as they are. A follow-up message to the same session can add `jqPathExpressions` rules for a chart whose webhook rewrites a list.

## Run it on every repository that defines Argo CD Applications

A platform team with one Argo CD repository per cluster starts one run per repository with one `POST /o/{org}/sessions` each, the repository in `resources` and this prompt as `input`. Each run reads its own Application generator, an app-of-apps chart, an `ApplicationSet` or plain manifests, and opens its own pull request.

Send a `request_id`, a UUID v5 of the repository's full name, so a retried call returns the run it already started. The key's `webhook_url` reports when each run the key starts finishes, with the run's final answer in `result`, so a handler on your server can post the links to the team channel.

## Why run it on Rush?

The hard part of `ignoreDifferences` is not the YAML; it is knowing which Applications self-heal, which workloads a controller rewrites, and that `RespectIgnoreDifferences` must be set or the rule only hides the diff. The agent reads the generator template and every owned workload, writes the rule once in the chart and renders the whole set to show the effect.

The before-and-after render in the pull request is the review. Nothing is applied to a cluster: the proof is the diff of generated manifests, kept in the sandbox's transcript, and the first real sync happens when a reviewer merges.

## Frequently asked questions

### Why is RespectIgnoreDifferences needed as well?

`ignoreDifferences` alone removes a field from the diff, so the Application shows as synced, but a sync still applies the manifest from Git, including that field. `RespectIgnoreDifferences=true` in `syncOptions` makes the sync patch leave the ignored field alone, which is what a scaled Deployment needs.

### Will this hide real drift?

Only on the fields you list. The agent adds a rule only where something other than Git legitimately writes the field, such as `replicas` under a scaler or a webhook-injected `caBundle`, and names the Applications it left untouched. A rule on a field nobody else writes would hide a real change, so it does not add those.

### Does it work when the Applications come from an ApplicationSet?

Yes. The block goes into the `template.spec` of the `ApplicationSet` in the same way, and the agent renders the generator's output where it can to show the result. In an app-of-apps chart like this one it goes into the chart template with a per-entry override.

### What about the managed-fields form?

`managedFieldsManagers` ignores every field a named field manager wrote, such as `kube-controller-manager` for an autoscaled Deployment, instead of a single path. The pull request shows it for the cases where a path list would be long or brittle, and leaves it commented out where the team has not asked for it.

## More Argo CD jobs

- [Set Up Argo CD Image Updater for Your Applications](https://getrush.ai/run/add-image-updater/argo-cd/)
- [Add Kubeconform Validation to CI for an Argo CD Repo](https://getrush.ai/run/add-kubeconform-to-ci/argo-cd/)
- [Post a Rendered Manifest Diff on Every PR to an Argo CD Repository](https://getrush.ai/run/add-manifest-diff-to-ci/argo-cd/)

## More jobs like this: Hand off a long task

- [Add Image Update Automation to a Flux Repository](https://getrush.ai/run/add-image-automation/flux/)
- [Sign Docker Images with Cosign in CI](https://getrush.ai/run/add-image-signing/docker/)
- [Add Infracost to CI for a Terraform Module](https://getrush.ai/run/add-infracost-to-ci/terraform/)

## Keep reading

- [How a Rush run works on your repository, from request to pull request](https://getrush.ai/cloud/)
- [Compare cloud agents, agent sandboxes and AI code review](https://getrush.ai/compare/)
- [Rush pricing: Free, Pro and Max](https://getrush.ai/pricing/)
