kd
kd copied to clipboard
EOF if document contains --- in the middle of a condition block since 1.8.0
For example:
apiVersion: v1
kind: ConfigMap
metadata:
name: my-map
data:
my.value: 1
{{if eq .KUBE_NAMESPACE "my-prod"}}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: my-map-2
data:
my.value: 2
{{end}}
We see the following error:
[ERROR] 2018/09/18 17:56:52 render.go:33: template: template:8: unexpected EOF
The last working version with these templates I can find is v0.13.0
I get a similar problem if there is a --- inside a range
{{ range list 1 2 3 -}}
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: zookeeper{{ . }}
spec:
replicas: 1
template:
metadata:
labels:
app: zookeeper
spec:
terminationGracePeriodSeconds: 30
containers:
- name: zookeeper
image: bitnami/zookeeper:3.5.5
# . ...
---
{{ end }}
It can be gotten around by using a variable to replace the ---
EG
{{ $end := "---" }}
{{ range list 1 2 3 -}}
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: zookeeper{{ . }}
spec:
replicas: 1
template:
metadata:
labels:
app: zookeeper
spec:
terminationGracePeriodSeconds: 30
containers:
- name: zookeeper
image: bitnami/zookeeper:3.5.5
# . ...
{{ $end }}
{{ end }}