# Add Kubeconform Validation to CI for a Helm Chart

Yes. An agent renders your Helm charts with helm template, validates the manifests with kubeconform against several Kubernetes versions in CI, and opens a PR.

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

## What the agent does

The agent clones the chart repository into its own cloud sandbox and reads what CI already checks. In a repository like helm/examples, `ct.yaml` points chart-testing at `charts`, and `.github/workflows/lint-test.yaml` runs on every pull request: `actions/checkout@v2` with full history, `azure/setup-helm@v1`, `actions/setup-python@v2` on Python 3.7, `helm/chart-testing-action@v2.0.1`, then `ct list-changed`, `ct lint`, and only when a chart changed, a kind cluster from `helm/kind-action@v1.0.0` and `ct install`. `release.yaml` packages charts to GitHub Pages with `helm/chart-releaser-action@v1.2.0` on every push to `main`. The one chart, `charts/hello-world`, is an `apiVersion: v2` application chart at version `0.1.0` with `appVersion: "1.16.0"`, rendering a Deployment, a Service and an optional ServiceAccount from `values.yaml` defaults of one replica, the `nginx` image and a `ClusterIP` service on port 80.

What is missing is a check that the rendered manifests are valid Kubernetes objects. `ct lint` checks chart metadata, `values.yaml` and that templates render; `ct install` proves a chart installs on one kind cluster, but only for changed charts and only after a cluster boots. Neither tells a maintainer that a field is misspelled, that `apiVersion: apps/v1` is wrong for a resource, or that a chart still renders a kind removed in a newer Kubernetes. Kubeconform does that in seconds from the rendered YAML, with no cluster.

The agent adds a `kubeconform` job to `lint-test.yaml`. It installs a pinned kubeconform release, then for every directory under `charts` runs `helm template` with the default values and once more with each `ci/*-values.yaml` file when a chart has them, pipes the output into `kubeconform -strict -summary -kubernetes-version <version> -schema-location default`, and repeats across a small matrix of Kubernetes versions, the oldest and newest the team supports. `-strict` rejects unknown fields, which is what catches a typo in a probe or a resource block. For a chart with custom resources the job adds the CRD catalog as a second `-schema-location` so those kinds are not reported as missing schemas. The job runs on every pull request and on pushes to `main`, independent of `ct list-changed`, because a schema change in a shared helper affects every chart.

It proves the job in the sandbox before opening the pull request: it installs Helm and kubeconform there, renders `hello-world` with the defaults and validates it against each version in the matrix, and then introduces a deliberate typo in `templates/deployment.yaml` to show the exact error kubeconform prints, before reverting it. While reading the workflow it notes that `::set-output` in the `list-changed` step is a deprecated command and that every action is several majors behind, and lists both in the pull request as findings rather than silently changing them. The pull request shows the passing and the failing kubeconform output side by side.

## Start it with one API call

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

```json
{
  "agent": "claude",
  "input": "Add kubeconform validation to CI for the Helm charts in this repository. Read ct.yaml, every chart under charts and the existing workflows first, and say what ct lint and ct install already cover. Add a job that renders each chart with helm template, with default values and with any ci values files, and validates the output with kubeconform in strict mode against a matrix of the oldest and newest Kubernetes versions this repository should support; include the CRD schema catalog if any chart renders custom resources. Install Helm and kubeconform in your sandbox, run the validation on every chart, show one deliberately broken template failing and revert it, and open a pull request with both outputs. Note any deprecated workflow commands or outdated actions you see as findings; do not upgrade them unless they block the new job.",
  "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 changing `.github/workflows/lint-test.yaml`, with a new `kubeconform` job and a matrix of Kubernetes versions, and a short section in the repository README on running the same validation locally. The description explains what each existing step covers and what the new job adds, lists the versions in the matrix and why, and includes the kubeconform summary for every chart plus the error it printed for the deliberately broken template.

The run's record keeps every `helm template` and `kubeconform` invocation from the sandbox, so a reviewer can see the flags that were tried, that `-strict` passed on the real charts, and that the failing example was a real failure and not a copied one.

Before merging, a reviewer confirms the version matrix matches what the team actually runs, decides whether the new job should be required for merge, and looks at the findings about the deprecated `set-output` command and the old action versions, which are a separate change the reviewer can ask for next.

## Run it on every chart repository without schema validation

A platform team with several chart repositories hands this off from the terminal once per repository: one `POST /o/{org}/sessions` with this body and the repository in `resources`. The key's `webhook_url` reports each finished run with its pull request, and a `request_id` that is a UUID v5 of the repository name makes a retried call return the run it already started instead of opening a second pull request.

Each run reads that repository's own `ct.yaml`, charts and workflows, so a repository that already renders with `ci/*-values.yaml` files gets those included, and one with custom resources gets the CRD catalog added, without the prompt changing.

## Why run it on Rush?

Schema validation is a small change that touches a workflow nobody wants to break, and the only way to know the job is right is to run the same commands it runs. The agent installs Helm and kubeconform in its own sandbox, renders every chart, validates it against each Kubernetes version, and shows a real failure before the pull request exists, so the reviewer reads output rather than guessing whether the pipe and the flags are correct.

The same body runs across every chart repository an organisation keeps, each pull request carrying its own matrix and output, and each run's record showing exactly which versions were checked. That is how a team gets one answer, do our charts still render valid objects on the cluster versions we run, across repositories maintained by different people.

## Frequently asked questions

### Does this replace ct lint or ct install?

No. `ct lint` still checks chart metadata, version bumps and that templates render; `ct install` still proves an install on a kind cluster for changed charts. Kubeconform sits between them: it checks that what rendered is a valid object for a given Kubernetes version, in seconds and for every chart, and runs even when `ct list-changed` finds nothing.

### What does strict mode catch that a kind install does not?

Unknown fields. The API server drops a misspelled field in a Deployment or probe without an error, so `ct install` can pass while the setting silently does nothing. `kubeconform -strict` fails the manifest on any field the schema does not know, which is how a typo in `templates/deployment.yaml` shows up in the pull request's broken example.

### Which Kubernetes versions go in the matrix?

The oldest and newest the team supports, which the agent asks for in the pull request if the repository does not say. Each extra version adds seconds, not minutes, so a third version in the middle is fine. The matrix is a plain list in the workflow and is the one place to edit when a version is dropped.

### Our charts render custom resources. Will kubeconform fail on them?

Not with the second `-schema-location` the job adds, which points at the community CRD schema catalog. A kind with no schema in either location is reported as skipped by the summary rather than failed; the agent names any such kinds in the pull request so a maintainer can add the schema or accept the gap.

### Why run it on every chart instead of only changed ones?

Because `ct list-changed` works per chart directory, and a shared `_helpers.tpl` or a values change can alter what every chart renders. Validating all of them costs a few seconds per chart and makes the job's result independent of git history, which also makes it easy to run locally with the README snippet.

## More Helm jobs

- [Add a NetworkPolicy Option to a Helm Chart](https://getrush.ai/run/add-network-policy/helm/)
- [Add a Pod Disruption Budget to a Helm Chart](https://getrush.ai/run/add-pod-disruption-budgets/helm/)
- [Add Resource Requests and Limits to a Helm Chart](https://getrush.ai/run/add-resource-limits/helm/)

## The same job on other stacks

- [Validate Every Kustomize Build With kubeconform in CI](https://getrush.ai/run/add-kubeconform-to-ci/kustomize/)
- [Add Kubeconform Validation to CI for an Argo CD Repo](https://getrush.ai/run/add-kubeconform-to-ci/argo-cd/)

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

- [Split Kubernetes Manifests into Kustomize Overlays for Dev and Prod](https://getrush.ai/run/add-kustomize-overlays/kubernetes/)

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