Sub topic 11
A verification workflow for chart changes
This chapter assumes you know Helm 3 basics (install, upgrade, release), can read Go templates, and have already declared dependencies, hooks, and a chart test in a chart called webapp. Here you combine them into one repeatable check you run before every merge.
Why a fixed order matters
Each Helm command catches a different class of mistake. Running them cheapest first gives you fast feedback and keeps a broken chart away from the cluster.
| Step | Command | Needs a cluster? | Catches |
|---|---|---|---|
| 1 | `helm dependency build` | No | Missing or drifted subcharts |
| 2 | `helm lint` | No | Bad Chart.yaml, template syntax errors, missing fields |
| 3 | `helm template` | No | Wrong rendered YAML, bad conditions and values |
| 4 | `helm install --wait` | Yes | Rejected manifests, failing hooks, pods that never become ready |
| 5 | `helm test` | Yes | A running release that does not actually work |
Step 1: restore dependencies
Lint and template fail if charts/ is missing or does not match Chart.yaml. Use helm dependency build in a verification run because it reads Chart.lock and downloads the exact locked versions. Use helm dependency update only when you intend to change versions, since it rewrites Chart.lock.
Step 2 and 3: lint and render
The sequence from the spine looks like this:
helm lint ./webapp
helm template demo ./webapp --set cache.enabled=false
helm install demo ./webapp --wait
helm test demo --logshelm lint checks the chart structure and templates. It also lints subcharts. It does not talk to the cluster, so it cannot tell you whether Kubernetes will accept a manifest.
helm template renders every manifest locally and prints it. Read the output, because lint passing does not mean the YAML is what you wanted. Check three things:
- With
cache.enabled=false, no cache resources appear. This confirms theconditioninChart.yamlworks. - Your hook Job appears with the
helm.sh/hookannotations you expect. Hooks are rendered like other templates, so they show up in the output. - Values under
globaland under the subchart key reach the right resources.
Render once with defaults and once with each important override. A chart that renders only in its default configuration is not verified.
Step 4: install and wait
helm install demo ./webapp --wait creates the release and blocks until Pods, Deployments, and similar resources are ready, or until the timeout expires. Without --wait, Helm reports success as soon as the API server accepts the manifests, even if the Pods crash afterward.
Pre-install hooks run during this step. A failing migration Job stops the install, so a failure here often comes from a hook rather than the main workload. Inspect hook resources if the command hangs or fails.
helm status demo
kubectl get jobs,pods
kubectl logs job/demo-webapp-db-migrateIf you set hook-succeeded in the delete policy, a Job that worked is already gone. A Job that failed stays, so its logs remain available.
Step 5: run the chart tests
helm test demo --logs runs every resource annotated helm.sh/hook: test and prints the container logs. A test passes when its container exits with code 0. Run it only after --wait has returned, because a test that starts while Pods are still booting fails for the wrong reason.
Helm does not delete test Pods by default. If you rerun the tests and get a name conflict, add helm.sh/hook-delete-policy: before-hook-creation to the test Pod.
Cleaning up and repeating
After a run, remove the release so the next run starts clean:
helm uninstall demoFor a change that affects upgrades, such as a new hook or a renamed value, also test the upgrade path. Install the previous version of the chart, then run helm upgrade demo ./webapp --wait and helm test demo. The pre-upgrade hooks run only on this path, so a fresh install never exercises them.
Common mistakes
- Running
helm dependency updatein CI. It can change versions between runs. Usebuildso the lock file decides. - Treating a clean
helm lintas proof of correctness. Lint does not validate against a live API server. - Skipping
--wait, then runninghelm testagainst Pods that are not ready. - Testing only the default values. Conditional dependencies need a render with each flag value.
- Leaving old releases or test Pods in the namespace, which causes name conflicts in the next run.
Exercise
You changed the cache.enabled condition in Chart.yaml and added a pre-upgrade hook. Which commands do you run to check the condition without a cluster, and why is a fresh helm install not enough to verify the hook?
Show answer
Run helm dependency build ./webapp, then helm template demo ./webapp --set cache.enabled=false and again with cache.enabled=true, and compare the output to confirm the cache resources appear and disappear. A fresh install does not run pre-upgrade hooks, because they fire only on helm upgrade. Install the previous chart version, then run helm upgrade demo ./webapp --wait and helm test demo.
Exercise
A teammate's CI script runs helm install demo ./webapp followed immediately by helm test demo, and the test fails intermittently even though the chart is fine. What change fixes this?
Show answer
Add --wait to the install command. Without it, Helm returns once the API server accepts the manifests, so the test can start before the Pods are ready.