Kubernetes Helm: Helpers includes accessible in one file, but not another

512 views Asked by At

In one directory are numerous files, there is a _helpers.tpl file as well as .yaml templates that we use to deploy different services. To simplify my issue and what I'm working with:

_helpers.tpl
backup.yaml
writer.yaml

There is a variable defined in the _helpers.tpl file that is accessible in backup.yaml, but the exact same line of code referring to the exact same variable in writer.yaml gives the following error:

Error: template: temp-chart/templates/template.yaml:8:23: executing "temp-chart/templates/template.yaml" at <include "account" .>: error calling include: template: no template "account" associated with template "gotpl"

I did not create this project, so I'm wondering if there was an error in the initial setup of the writer.yaml file or something was overlooked? Are there any steps required in configuring the helpers file or the templates that ensures they can access one another?

_helpers.tpl

{{- define "account" -}}
{{- if .Values.backup.account -}}
{{- .Values.backup.account-}}
{{- else -}}
{{- .Values.buildVals.accountId -}}
{{- end -}}
{{- end -}}

backup.yaml and writer.yaml are identical:

account: {{ include "account" . }}
0

There are 0 answers