I'm refactoring a helm chart, and wanted to put some values from deployment.yaml
to values.yaml
and that value is
hosts:
- {{ include "myApp.externalHostName" . | quote }}
but it gives me the error
[ERROR] values.yaml: unable to parse YAML: error converting YAML to
JSON: yaml: invalid map key: map[interface {}]interface {}{"toJson
include \"myApp.externalHostName\" . | quote":interface {}(nil)}
[ERROR] templates/: cannot load values.yaml: error converting YAML to
JSON: yaml: invalid map key: map[interface {}]interface {}{"toJson
include \"myApp.externalHostName\" . | quote":interface {}(nil)}
it would work if I just used
hosts:
- myExternalHostname.something
but is it possible to run include in values.yaml?
The values.yaml
files are not subject to golang interpolation. If you need dynamic content, you'll need to update files inside the templates
directory (which are subject to golang interpolation), or generate the values.yaml
content using another mechanism
In this specific case, you may find yaml anchors to be helpful:
myApp:
externalHostName: &externalHostName myapp.example.com
theIngressOrWhatever:
hosts:
- *externalHostName