I would like to be able to reference the current namespace in values.yaml to use it to suffix some values like this
# in values.yaml
someParam: someval-{{ .Release.Namespace }}
It much nicer to define it this way instead of going into all my templates and adding {{ .Release.Namespace }}. If I can do it in values.yaml it's much clearer and only needs to be defined in one place.
解决方案
If you know that someParam might contain templating constructs, Helm includes a tpl function that interprets it.
- name: SOME_VARIABLE
value: {{ .Values.someParam | tpl }}
If a chart allows this it generally documents it. As a specific example, the helm/charts PostgreSQL chart documents that its configurationConfigMap setting is
ConfigMap with the PostgreSQL configuration files (Note: Overrides postgresqlConfiguration and pgHbaConfiguration). The value is evaluated as a template.
So for that specific value, you can put a template macro in the values.yaml file.