Skip to content

Unable to pass helm lint due to certificate yaml stripping too much whitespace #645

@rickymulder

Description

@rickymulder

Our internal pipelines are unable to pass a logic gate of helm lint due to this line

The chart in it's current form errors like so:

==> Linting .
[ERROR] templates/certificate.yaml: unable to parse YAML: invalid Yaml document separator: apiVersion: policy.cert-manager.io/v1alpha1

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

Problem:

...
---

{{- if .Values.app.webhook.tls.approverPolicy.enabled -}}

apiVersion: policy.cert-manager.io/v1alpha1
...

Solution:

...
---

{{- if .Values.app.webhook.tls.approverPolicy.enabled }}

apiVersion: policy.cert-manager.io/v1alpha1
...

This is only a problem with linting. Using helm template doesn't produce the same error. helm/helm#10149 explains similar behavior, and plenty of charts have been fixed by the community. Turns out stripping whitespace with abandon is a bad idea.

$ helm version
version.BuildInfo{Version:"v3.18.3", GitCommit:"6838ebcf265a3842d1433956e8a622e3290cf324", GitTreeState:"clean", GoVersion:"go1.24.4"}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions