I am trying to use an include statement in helm range, but
I am getting an error can't evaluate field Values in type string.
test.yaml
spec:
rules:
{{- range .Values.tests }}
- host: {{ . }}
http:
paths:
- backend:
service:
name: test-{{ $.Values.somename }}
port:
number: {{- include "testit.get_port" }}
path: /
pathType: ImplementationSpecific
{{- end }}
and _helper.tpl is this
{{- define "testit.get_port" }}
{{- if (eq .Values.somtest "test1") }}5000{{- else }}80{{- end }}
{{- end }}
I know for using values, you have to use a $ sign if it is used in range loop. How about include, what should i use there
You didn't include any parameter to the
includecall, so the template is gettingnilas its parameter. Inside arangeloop, you probably need to pass the$top-level object