3

I am having trouble accessing some named templates defined in the main chart from subcharts. As it is in the documentation that every defined named template is global, I'd like to get help on what I am doing wrong here.

Below is the defined named template in _helper.tpl of the main chart and I am trying to access it in the configMap from the subchart which is resulting into an error of no template.

_helper.tpl inside chart/templates

{{- define "main.postgres"}}
    POSTGRES_URL: 172.30.30.39
    POSTGRES_PORT: 5432
{{- end }}

configMap.yaml inside chart/subchart/templates

apiVerions: v1
kind: ConfigMap
metadata: 
  name: subchart-config
  data:
    {{- template "main.postgres" .}}

Error

error calling include: template: no template "main.postgres" associated with template "gotpl"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.