profile
viewpoint

Ask questions[Question] Helmfile tries to render values files

I recently noticed that helmfile tries to render Helm values files, while it should not.

For example, I have defined this release:

    - name: prometheus
      labels:
        tier: ci
        app: prometheus
      namespace: monitoring
      chart: stable/prometheus
      values:
        - helm_vars/prod/prometheus/values.yml
      secrets:
        - helm_vars/prod/prometheus/secrets.yaml

and it fails with err: release "prometheus" in "helmfile.yaml" failed: failed to render [/Users/amgk/src/github.com/amnk/babelfish/helm_vars/prod/prometheus/values.yml], because of template: stringTemplate:27: undefined variable "$labels"

while usual helm-wrapper invocation works fine:

helm-wrapper upgrade --install --reset-values prometheus stable/prometheus --namespace monitoring --values /Users/amgk/src/github.com/amnk/babelfish/helm_vars/staging/prometheus/values.yml --values /Users/amgk/src/github.com/amnk/babelfish/helm_vars/staging/prometheus/secrets.yaml

/Users/amgk/src/github.com/amnk/babelfish/helm_vars/prod/prometheus/values.yml indeed contains not a proper Go template, but Helm files should not contain them, right? Or I simply miss something obvious here?

roboll/helmfile

Answer questions diversario

Facing exact same error with Helmfile v0.121.1.

In this case, the error

COMBINED OUTPUT:
  Error: parse error at (prometheus-operator/templates/helmx.all.yaml:1665): undefined variable "$labels"

only shows up if I attempt to specify a patch for the prometheus-operator chart, like so:

- name: prometheus-operator
  chart: plaid/prometheus-operator
  namespace: monitoring
  jsonPatches:
  - target:
      group: monitoring.coreos.com
      version: v1
      kind: PrometheusRule
      name: prometheus-operator-kubernetes-apps
      namespace: monitoring
    patch:
    - op: replace
      path: /spec/groups/0/rules/0/for
      value: 1h

I think this is because all the manifests are merged into one file, and kustomize (?) then runs on it, thinking it's a go template.

The line where the error points is this:

        message: The configuration of the instances of the Alertmanager cluster `{{$labels.service}}` are out of sync.
useful!

Related questions

feat: Predictable Helmfile template hot 2
v0.53.3: environment yaml files: "cannot unmarshal !!str `<no value>` into bool" typing issues? hot 1
v0.53.3: environment yaml files: "cannot unmarshal !!str `<no value>` into bool" typing issues? hot 1
Template subcommand is "invalid" hot 1
UPGRADE FAILED: ... has no deployed releases hot 1
[Feature Request] Add local Helm Chart templates to repository chart release hot 1
Possible to set selector in parent helmfile? hot 1
Using helmfiles, but unable to pass Environment down to helmfile.yaml hot 1
Go-getter URLs from #1374 are not working - helmfile hot 1
remove "helm diff" errors when doing apply hot 1
Helmfile with many releases is too slow due to &#34;Building dependency&#34; etc hot 1
source:https://uonfu.com/
Github User Rank List