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?
This was a recent change in 0.23.0 I believe the intent is to only render values.yaml.gotmpl in the future
OK, that's good to know and actually a good idea. But it breaks current releases :( Any chance it can be fixed shortly? Or rendering values.yaml.gotmpl is a long-term goal?
UPD. If you guys don't mind, I think I can prepare a PR to fix this
This should be fixed now https://github.com/roboll/helmfile/issues/249#event-1817505540
try the latest release
Thanks for the report. Yes, values.yaml.gotmpl is the long-term goal. helmfile newer than v0.25.1 already implement it 馃憤
Closing as resolved, but please feel free to reopen if necessary!
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.
@diversario Hey! Thanks for reporting. Your issue seems same as #1360. Let's discuss/track the progress towards fixing it there.