helmfile icon indicating copy to clipboard operation
helmfile copied to clipboard

helm.sh/hook annotation breaks helmfile template rendering when using kustomize features

Open cadeff01 opened this issue 3 years ago • 1 comments

Using the helmfile and values.yaml.gotmpl below results in a properly rendering chart.

repositories:
- name: gitlab
  url: {{ .Values | get "helmRepo" "https://charts.gitlab.io" }}

releases:
- name: gitlab
  namespace: gitlab
  chart: gitlab/gitlab
  version: 5.9.1
  labels:
    app: gitlab
  values:
    - values.yaml.gotmpl
global:
 ingress:
   configureCertmanager: false
   tls:
     enabled: false

The bug comes in when you try to use any kustomize features such as the label transformer:

repositories:
- name: gitlab
  url: {{ .Values | get "helmRepo" "https://charts.gitlab.io" }}

releases:
- name: gitlab
  namespace: gitlab
  chart: gitlab/gitlab
  version: 5.9.1
  labels:
    app: gitlab
  transformers:
    - apiVersion: builtin
      kind: LabelTransformer
      metadata:
        name: tenant
      labels:
        tenant: core
      fieldSpecs:
        - path: metadata/labels
          create: true
  values:
    - values.yaml.gotmpl

In the case of the gitlab chart in the second example you will only get the resources that have the helm.sh/hook annotation. Removing this annotation in the underlying chart resources allows it to render properly or passing --no-hooks to helm through helmDefaults.args but this will prevent the rendering of resources with this annotation completely.

Running with the debug flag doesn't give any errors so possibly an issue with chartify but haven't been able to isolate it further than the examples above.

cadeff01 avatar Mar 31 '22 15:03 cadeff01

helm version version.BuildInfo{Version:"v3.8.1", GitCommit:"5cb9af4b1b271d11d7a97a71df3ac337dd94ad37", GitTreeState:"clean", GoVersion:"go1.17.5"} helmfile version helmfile version v0.144.0 kustomize version {Version:kustomize/v4.5.4 GitCommit:cf3a452ddd6f83945d39d582243b8592ec627ae3 BuildDate:2022-03-28T23:12:45Z GoOs:linux GoArch:amd64}

cadeff01 avatar Mar 31 '22 15:03 cadeff01