Validating helm chart content

Jan Hudec picture Jan Hudec · Feb 7, 2018 · Viewed 19.8k times · Source

I am developing a chart and I had an error in it—incorrectly placed imagePullSecrets. When I tried to install it via

helm install ./mychart

the misplaced element was simply ignored and I wondered what is wrong.

When I did

helm template ./mychart | kubectl apply --dry-run -f -

it instead printed:

error: error validating "STDIN": error validating data: ValidationError(Deployment.spec.template.spec.containers[0]): unknown field "imagePullSecrets" in io.k8s.api.core.v1.Container

which clearly shows what is wrong. I am not sure whether it matches what the tiller actually does with the expanded templates.

But if I just do a

helm install --dry-run --debug ./mychart

it just shows the expanded template and looks OK.

So how do I correctly verify all my templates match corresponding schemata with helm?

Answer

GHETTO.CHiLD picture GHETTO.CHiLD · Jun 20, 2018

You can lint the chart by going helm lint ./mychart which should print the following if an issue is found:

$ helm lint ./mychart
==> Linting ./mychart
[ERROR] Chart.yaml: version is required
[INFO] Chart.yaml: icon is recommended

Error: 1 chart(s) linted, 1 chart(s) failed

See helm lint.