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?
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.
Related questions