# Convert an Argo CD App-of-Apps Chart Into an ApplicationSet

Yes. An agent reads your app-of-apps chart, writes one ApplicationSet that generates the same Applications, checks it against the chart's render and opens a PR.

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

## What the agent does

The agent clones the repository into its own cloud sandbox and reads how Applications are produced today. In a GitOps repository laid out like argoproj/argocd-example-apps, the `apps` directory is a Helm chart named `applications` whose single template, `apps/templates/applications.yaml`, ranges over an `applications` list in `apps/values.yaml` and emits one `Application` per entry named `example.<name>`, in the `argocd` namespace unless the entry sets its own, with a `resources-finalizer.argocd.argoproj.io` finalizer, the shared `repoURL` and `targetRevision: master` from `config.spec`, `CreateNamespace=true`, and automated sync with `prune` and `selfHeal`. Fifteen entries use defaults, three set a `tool.helm.releaseName`, three set a `tool.plugin.name` with an explicit `path` under `plugins/`, and four `app-any-ns` entries set a per-team `namespace`, `project` and destination namespace, one of them deliberately invalid.

The repository already shows what an ApplicationSet looks like here: `applicationset/list.yaml` is a List generator with two elements, `applicationset/git.yaml` a Git directories generator over `lightweight/app-*`, and the three `appset-any-ns-team-*.yaml` files put an ApplicationSet named `services` in a team namespace so its Applications land there too. The agent follows those shapes rather than inventing one. It writes a single `apps/applicationset.yaml` with a List generator whose elements are the entries of `values.yaml` carried over field by field, `goTemplate: true` with `goTemplateOptions: ["missingkey=error"]` so the template can say `{{- if .helm }}` for the release name and `{{- if .plugin }}` for the plugin block the way the Helm template's `with .tool` does, and a template whose `metadata.name`, finalizer, `spec.destination`, `spec.project`, `spec.source` and `syncPolicy` match the chart's output line for line.

The four team-scoped entries are the part that needs a decision, because an ApplicationSet in `argocd` that sets `template.metadata.namespace` to `team-frontend` relies on Applications in any namespace being enabled, which `applicationset/README.md` already notes for the `services` sets, along with `AppProject.sourceNamespaces`. The agent keeps those four in the same ApplicationSet with a comment pointing at that requirement, and keeps the `app-any-ns-invalid` entry, whose `project` does not match its namespace, exactly as it is, since the repository carries it on purpose. It checks its work by running `helm template apps` and `kubectl apply --dry-run=client -f apps/applicationset.yaml` in the sandbox, then compares every Application the chart renders against the generator's elements by name, namespace, path, project and tool settings, and lists any difference in the pull request.

Cut-over is written down rather than done. The pull request keeps the chart in place and adds the ApplicationSet beside it, with a `README.md` row for it, and its description gives the order: register the ApplicationSet and confirm the generated Applications match the existing ones, then remove the `resources-finalizer` from the parent app-of-apps Application before deleting it, so its deletion does not cascade to the children it created. The agent pushes nothing to a cluster; everything it changes is a pull request against the repository Argo CD watches.

## Start it with one API call

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

```json
{
  "agent": "claude",
  "input": "Convert this repository's app-of-apps Helm chart into an ApplicationSet. Read the chart's template and values, and any ApplicationSet already in the repository, first. Write one ApplicationSet with a List generator carrying every entry from the values file, using Go templating so optional Helm and plugin settings render only where an entry has them, and a template whose Applications match the chart's rendered output in name, namespace, finalizer, destination, project, source and sync policy. Keep entries that are intentionally invalid as they are. Render the chart and the ApplicationSet in your sandbox and list every difference. Keep the chart; add the ApplicationSet beside it and document the cut-over order, including removing the parent Application's finalizer before deleting it. Do not apply anything to a cluster. 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 on its own branch that adds `apps/applicationset.yaml` and a row in `README.md`, and changes nothing else. The description has the comparison table: one row per Application the chart renders, with the generated name, namespace, path, project and tool settings on both sides and a tick or the difference, followed by the `kubectl --dry-run=client` output showing the ApplicationSet is valid against the CRD schema the sandbox's `kubectl` knows.

The run's record keeps the `helm template` output and the comparison, so a reviewer can see the agent matched against the chart as rendered and not against the values file alone, which matters for the defaults the template fills in, such as `path` defaulting to the entry's `name` and `namespace` defaulting to `argocd`.

Before merging, a reviewer decides whether the team-scoped entries belong in this ApplicationSet or in the per-team `services` sets the repository already has, confirms that the ApplicationSet controller is configured for the namespaces those entries name, and follows the cut-over order in the description when the time comes rather than deleting the chart in the same change.

## Run it on every GitOps repository

This is a one-time conversion per repository, started from a terminal with `POST /o/{org}/sessions`, this body and the repository in `resources`. The run keeps working in its sandbox after you close the window, and a follow-up through `POST /o/{org}/sessions/{id}/messages` can switch the generator to Git directories or split the team-scoped entries out before you review again, without starting over.

A platform team with many Argo CD repositories starts one run per repository from a script with the same body, each with its own `request_id`, a UUID, so a retry returns the run it already began. The key's `webhook_url` receives `run.completed` for each with a `session_url`, from which the handler reads the pull request link.

## Why run it on Rush?

An app-of-apps chart and an ApplicationSet say the same thing in two languages, and the mistakes in a hand conversion are the quiet ones: a release name dropped on one entry, a namespace default that the Helm template filled in and the new template does not. The agent renders both sides in its sandbox and compares them Application by Application, so the pull request shows the match rather than asking the reviewer to trust it.

The sandbox has `helm` and `kubectl`, the full record of every render and comparison stays with the run, and nothing touches a cluster. Several repositories can be converted at once in separate sandboxes, each ending in its own pull request with its own comparison table.

## Frequently asked questions

### Will the ApplicationSet take over my existing Applications or create duplicates?

The generated names match the chart's output exactly, so there are no duplicates by name. Adoption of an Application that another controller created is the step the cut-over notes cover: register the ApplicationSet, confirm what it reports, then retire the parent Application with its finalizer removed so nothing is pruned. The pull request does not perform that step.

### Why a List generator and not a Git directories generator?

Because the values file carries per-entry settings a directory scan cannot see: Helm release names, plugin names, explicit paths under `plugins/`, and per-team namespaces and projects. A List generator keeps those as data. A follow-up message can switch to a Git generator for the plain entries if you want new directories to appear without editing a list.

### What happens to entries that are broken on purpose?

They stay broken. The repository keeps an entry whose project does not match its namespace to show a failure mode, and the prompt tells the agent to carry such entries over as they are and name them in the pull request rather than fix them.

### Does the agent need access to my Argo CD instance?

No. Everything happens against the repository: `helm template` for the chart, `kubectl apply --dry-run=client` for the ApplicationSet, and a comparison of the two. The ApplicationSet is applied by whatever syncs your `argocd` namespace once the pull request merges.

## More Argo CD jobs

- [Convert a Blue-Green Argo Rollout to a Canary With Analysis in an Argo CD App](https://getrush.ai/run/add-canary-rollouts/argo-cd/)
- [Add ignoreDifferences to Argo CD Applications](https://getrush.ai/run/add-ignore-differences/argo-cd/)
- [Set Up Argo CD Image Updater for Your Applications](https://getrush.ai/run/add-image-updater/argo-cd/)

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

- [Add Argument Specs to an Ansible Role](https://getrush.ai/run/add-argument-specs/ansible/)
- [Run Molecule Tests for an Ansible Role on arm64 in CI](https://getrush.ai/run/add-arm64-ci/ansible/)
- [Add Build Provenance Attestations to a Rust CLI's Release Workflow](https://getrush.ai/run/add-artifact-attestations/rust-cli/)

## 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/)
