# Inflate a Helm Chart With Kustomize helmCharts

Yes. An agent replaces a helm template plus kustomize build pipeline with Kustomize's own helmCharts field, keeps your patches, and opens a PR with renders diffed.

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

## What the agent does

The agent reads the current pipeline before it replaces it. In a repository like argoproj/argocd-example-apps, `plugins/kustomized-helm` is the Helm-then-Kustomize pattern done the old way: a `Chart.yaml` named `guestbook` whose only dependency is `helm-guestbook` 0.1.0 at `file://../../helm-guestbook`, a `kustomization.yaml` with `namePrefix: kustomize-`, `resources: [./all.yaml]` and one patch in `overlays/guestbook-deployment.yaml` that sets the image of the `release-name-helm-guestbook` Deployment to `gcr.io/google-samples/gb-frontend:v5`, and a `.gitignore` for `all.yaml`, `charts` and `requirements.lock`. The README explains the glue: an Argo CD config management plugin whose `init` runs `helm dependency build` and whose `generate` runs `helm template . --name-template $ARGOCD_APP_NAME --namespace $ARGOCD_APP_NAMESPACE --kube-version $KUBE_VERSION > all.yaml && kustomize build`. `apps/values.yaml` registers it as `plugin-kustomized-helm` with `tool.plugin.name: kustomized-helm`. The chart it inflates, `helm-guestbook`, has `replicaCount: 1`, an image with `tag: v5`, `containerPort: 80`, a `ClusterIP` service and a `values-production.yaml` that switches the service to `LoadBalancer`. The repository also has `helm-dependency`, which pins `wordpress` 9.0.3 from `https://charts.helm.sh/stable` with a custom `values.yaml` and a `values-nomaria.yaml`.

The replacement is a `helmCharts` entry in the kustomization. For the local chart, the agent adds `helmGlobals` with `chartHome` pointing two directories up, so Kustomize finds `helm-guestbook/Chart.yaml` there and does not try to pull, and a `helmCharts` item with `name: helm-guestbook`, a `releaseName`, a `namespace`, `includeCRDs: true` and `valuesInline` carrying the image tag that the old patch set, which lets the `overlays/guestbook-deployment.yaml` patch go or stay as the reviewer prefers. The `resources: [./all.yaml]` line, the wrapper `Chart.yaml` and the `.gitignore` entries for generated files are removed, since nothing is generated into the tree any more. For the off-the-shelf case in `helm-dependency`, the same field takes `repo: https://charts.helm.sh/stable`, `version: 9.0.3` and `valuesFile: values.yaml`, with `values-nomaria.yaml` becoming a second overlay rather than a second values file.

Argo CD needs one setting for this to work, and the pull request includes it. Kustomize only runs Helm when invoked with `--enable-helm`, so the agent adds `kustomize.buildOptions: --enable-helm` to the `argocd-cm` ConfigMap data, as a manifest or as a documented change depending on where the repository keeps Argo CD's own configuration, and changes the `apps/values.yaml` entry to drop `tool.plugin` so the Application is rendered by Argo CD's built-in Kustomize support instead of the plugin sidecar. The plugin definition in the README is marked as superseded rather than deleted, so a reader finds the history.

The proof is a diff of renders. The agent runs the old pipeline once, `helm dependency build` then `helm template` into `all.yaml` then `kustomize build`, and the new one, `kustomize build --enable-helm plugins/kustomized-helm`, and diffs the two outputs. The expected difference is the release name in resource names and labels, which the `releaseName` field controls, and the description shows that diff and nothing else. It also runs `kubeconform` on the new render and `kustomize build --enable-helm` on the `helm-dependency` overlay with the pinned chart pulled from the repository, with the output included.

## Start it with one API call

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

```json
{
  "agent": "claude",
  "input": "Replace the Helm-then-Kustomize pipeline in this repository with Kustomize's native helmCharts field. Read every kustomization.yaml, any wrapper Chart.yaml, the patches, the plugin or script that currently runs helm template, and the Argo CD Application definitions first. Add helmCharts entries with the chart name, release name, namespace, version and values, using helmGlobals chartHome for a local chart and repo for a remote one, keep the existing patches working, and remove the generated-file plumbing. Add the --enable-helm build option to the Argo CD configuration and switch the Application off the plugin. Render with the old pipeline and with kustomize build --enable-helm, diff the two, validate the new render with kubeconform, and include the 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 rewrites `plugins/kustomized-helm/kustomization.yaml` around a `helmCharts` entry, removes the wrapper `Chart.yaml` and the `.gitignore` for generated files, keeps or folds the image patch, adds the `--enable-helm` build option to the Argo CD configuration, updates the `apps/values.yaml` entry to drop the plugin, and updates the README. A second overlay for `helm-dependency` shows the remote-chart form with `repo` and `version`.

The description carries the diff between the plugin's render and the `helmCharts` render, which should show only the release-name difference, the `kubeconform` summary, and the `kustomize build --enable-helm` output for the remote chart. The full commands and output are in the transcript at `GET /o/{org}/sessions/{id}/messages`.

Before merging, a reviewer confirms the Argo CD version in use supports `kustomize.buildOptions` with `--enable-helm`, decides whether the old patch should stay as a patch or become `valuesInline`, and checks that the Kustomize binary in CI is a version with `helmCharts`. A follow-up message to the same session can convert the remaining plugin-based Applications.

## Run it on every overlay that still shells out to helm template

A platform team with several GitOps repositories starts one run per repository with one `POST /o/{org}/sessions` each, the repository in `resources` and this prompt as `input`. Each run finds its own plugin definitions and overlays, so a repository that uses a shell script instead of an Argo CD plugin gets the script removed, and each 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`.

## Why run it on Rush?

The risk in this change is a render that differs from the old one in a way nobody notices until a sync. The agent runs both pipelines in a sandbox of its own, diffs the output line by line, and shows the one expected difference, so the reviewer sees proof instead of a promise. It also knows the two settings outside the overlay, Argo CD's `--enable-helm` build option and the Application's `tool`, without which the overlay renders locally and fails in the cluster.

The pull request carries the diff and the validation output, and nothing is applied to a cluster. Several repositories can be converted at once, each in its own sandbox, each with its own pull request.

## Frequently asked questions

### Why is --enable-helm needed?

Kustomize treats running Helm as an external process and refuses to do it unless `kustomize build` is passed `--enable-helm`. Locally that is a flag; in Argo CD it is `kustomize.buildOptions: --enable-helm` in the `argocd-cm` ConfigMap, which the pull request adds. Without it the overlay works on a laptop and fails in the cluster.

### Can it inflate a chart that lives in the same repository?

Yes. `helmGlobals.chartHome` points Kustomize at the directory holding the chart, and when `<chartHome>/<name>/Chart.yaml` exists it uses that chart instead of pulling one. The agent sets it to the relative path of the chart directory, as it does for the local `helm-guestbook` chart here.

### Do my existing patches still apply?

Yes. `helmCharts` produces resources that the rest of the kustomization then transforms, so `patches`, `namePrefix` and the other fields work as before. Where a patch only set a value the chart exposes, the agent offers `valuesInline` as the simpler form and leaves the choice to the reviewer.

### What about the chart version?

For a remote chart, `version` in the `helmCharts` entry pins it, as the `dependencies` block in the wrapper chart did, and Kustomize pulls that exact version. For a local chart the version is whatever is in the tree, and the pull request notes that the pin now lives in the chart's own `Chart.yaml`.

## More Kustomize jobs

- [Add a Horizontal Pod Autoscaler to Kustomize Deployments](https://getrush.ai/run/add-horizontal-pod-autoscaler/kustomize/)
- [Add an Ingress to a Kustomize App from a Linear Issue](https://getrush.ai/run/add-ingress/kustomize/)
- [Validate Every Kustomize Build With kubeconform in CI](https://getrush.ai/run/add-kubeconform-to-ci/kustomize/)

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

- [Generate a Helm Chart README With helm-docs and Fail CI When It Is Stale](https://getrush.ai/run/add-helm-docs/helm/)
- [Add a Horizontal Pod Autoscaler to a Helm Chart](https://getrush.ai/run/add-horizontal-pod-autoscaler/helm/)
- [Add HTTP Timeouts to a Go CLI](https://getrush.ai/run/add-http-timeouts/go-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/)
