I want to mount a shell script template into a container.
I have the following configmap.yaml:
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "myservice-chart.fullname" . }}--scripts-configmap
labels:
app: {{ template "myservice-chart.name" . }}
chart: {{ template "myservice-chart.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
data:
setup: |
{{ include "setup" . | indent 4 }}
And this is my setup.tpl:
{{- define "setup" }}
#!/bin/bash
echo "Hello world!"
{{- end }}
When I do a Helm dry-run, Helm generates this (valid) YAML:
...
apiVersion: v1
kind: ConfigMap
metadata:
name: listening-donkey-myservice-chart-quorum-scripts-configmap
labels:
app: myservice-chart
chart: myservice-chart-0.1.0
release: listening-donkey
heritage: Tiller
data:
setup: |
#!/bin/bash
echo "Hello world!"
...
When I run it without --dry-run, it generates this error:
configmap.yaml: error converting YAML to JSON: yaml: line 13: did not find expected key