Range inside of an include adds extra newline
- Dominant language
- No language data
- Stars
- 495
- Forks
- 210
- PR merge metrics
- No merged PRs in 30d
Description
There seems to be a bug with range inside of an include. It is a little hard to explain, so here is my test setup.
values.yaml:
```
array:
- this
- is
- somthing
```
_helpers.tpl :
```
{{- define "test.range" -}}
{{- range .Values.array }}
test2 {{ . }}
{{- end }}
{{- end }}
{{- define "test.range.three" -}}
#comment
{{- range .Values.array }}
test3 {{ . }}
{{- end }}
{{- end }}
```
cm.yaml :
```
apiVersion: v1
kind: ConfigMap
metadata:
name: test
data:
test.data: |-
{{- range .Values.array }}
test1 {{ . }}
{{- end }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: test2
data:
test.data: |-
{{- include "test.range" . | nindent 4 }}
---
---
apiVersion: v1
kind: ConfigMap
metadata:
name: test3
data:
test.data: |-
{{- include "test.range.three" . | nindent 4 }}
```
In my mind all three configmaps should look the same, but when you do a helm template command with this setup the test2 confimap has an extra blank new line. This new line once pushed to kubernetes then screws up kubernetes output to yaml format.
I am going to guess that the whitespace deletion has a bug in it with this setup, since in test3 just adding some text before the range removes any extra whitespace. Or I might be missing something simple.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.