I have k8s manifest such as below, packaged with Helm.
apiVersion: v1
kind: ServiceAccount
metadata:
{{- template "myFunction" "blah" -}}
I have _helper.tpl
defining myFunction as below.
{{- define "myFunction" }}
{{- if .Values.nameOverride }}
name: {{ . }}
{{- else }}
name: "test"
{{- end }}
{{- end }}
Finally, I have values.yaml
defining nameOverride: ""
. From my understanding, as I haven't defined anything for nameOverride, myFunction
should output name: "test"
, and when I define something for nameOverride, the output should be name: "blah"
. However, I'm getting the error below.
Error: template: product-search/templates/_helpers.tpl:2:16: executing "myFunction" at <.Values.nameOverride>: can't evaluate field Values in type string
helm.go:88: [debug] template: product-search/templates/_helpers.tpl:2:16: executing
"myFunction" at <.Values.nameOverride>: can't evaluate field Values in type string
Any ideas why? Thanks!