In the same template as before, I had originally:
rules:
{{- range .Values.ingress.hosts }}
- host: {{ .host | quote }}
http:
paths:
- pathType: ImplementationSpecific
backend:
service:
name: {{ $fullName | quote }}
port:
number: {{ .Values.services.port }} # Here
{{- end }}
I kept getting an error that:
Error: template: ./templates/ingress.yaml:34:36: executing "./templates/ingress.yaml" at <.Values.services.port>: nil pointer evaluating interface {}.services
Not good. I figured that once you're in a loop {{- range ...}}
, you cant really have access to the .Variables
variable. So, I moved the port
entry in the .Values.ingress.host
on variables.yaml and changed the template:
rules:
{{- range .Values.ingress.hosts }}
- host: {{ .host | quote }}
http:
paths:
- pathType: ImplementationSpecific
backend:
service:
name: {{ $fullName | quote }}
port:
number: {{ .port }}
{{- end }}
The corresponding section in values.yaml:
ingress:
hosts:
- host: "my.host.local.laurivan.com"
port: 80
Great! The error went away.
HTH,
Member discussion: