helmfile: release templating cannot refer to other release variables
I’m using release templating for a common directory structure with auto loading values per environment, and really want to use in installed field as well. But for the life of me, I can’t figure out how. Either there’s a bug or I’m doing something wrong (most probably)
I have this in templates.yaml:
loader: &loader
missingFileHandler: Debug
values:
- values.yaml
- values.yaml.gotmpl
- ./{{ if contains "prod" .Environment.Name }}prod.yaml{{ else }}nonexistent.yaml{{end}}
- ./{{ if contains "prod" .Environment.Name }}prod.yaml.gotmpl{{ else }}nonexistent.yaml{{end}}
- ./{{ .Environment.Name }}.yaml
- ./{{ .Environment.Name }}.yaml.gotmpl
and I’m trying to do something like this:
---
bases:
- ../../common/environments.yaml
- ../../common/defaults.yaml
---
{{ readFile "../../common/templates.yaml" }}
releases:
- name: "prometheus-operator"
namespace: "prometheus-operator"
chart: "stable/prometheus-operator"
installed: {{ .Values.releases.`{{ .Release.name }}` | getOrNil "enabled" | default "false" }}
<<: *loader
ideally, I want version and installed to go live in the loader template, but I can’t - no combination of {s and `s work. and yes, I’ve tried installedTemplate as well.
I have to hardcode it for now like this
version: {{ .Values.releases.prometheus_operator | getOrNil "version" | default "~8" }}
installed: {{ .Values.releases.prometheus_operator | getOrNil "enabled" | default "false" }}
@mumoshu any chance you could have a look?
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 15
Thank you! Seems to be working! Thanks for your hard work on helmfiles