I got a strange error when developing a Helm chart today:
[Error]: templates/ingress.yaml: Unable to parse YAML: error converting YAML to JSON: yaml: line 20: found character that cannot start any token
The template in question is an ingress one:
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "microservice.fullname" . -}}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ $fullName }}-ing
labels:
{{ include "microservice.labels" . | indent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
rules:
{{- range .Values.ingress.hosts }}
- host: {{ .host | quote }}
http:
paths:
- pathType: ImplementationSpecific
backend:
service:
name: {{ $fullName | quote }}
port.number: {{ .port }}
{{- end }}
{{- end }}
I've checked the chart for indenting issues, as I've assumed that it would be such an error. However, at line 20 of the template... there isn't any indenting error. So...
I've ran:
helm template --debug ingress .
and I could get a dump of all parsed templates. Now, line 20 is something totally different :) and lo and behold, I had a tab there!
Voila!
Now to the next error...
Member discussion: