Im using the following file by helm
apiVersion: v1
kind: ConfigMap
metadata:
name: nginx-cfg
data:
default.conf: |-
{{ .Files.Get "config/nginx.conf" | nindent 4 }}
and I got the following error:
Error: YAML parse error on ops/templates/config/nginx.conf: error converting YAML to JSON: yaml: line 4: mapping values are not allowed in this context
The nginx file looks like following
nginx.conf
server {
listen 80;
listen [::]:80;
server_name: {{ print "kiftb." .Values.global.host | quote }} // this is the error line
...
The line with the sever_name
create the error.
Any idea how to solve it?
update
As suggested by @Evan I've tried to remove the colon,
server_name {{ print "kiftb." .Values.global.host | quote }}
And I got an error:
error unmarshaling JSON: while decoding JSON: json: cannot unmarshal string into Go value of type releaseutil.SimpleHead
helm.go:81: [debug] error unmarshaling JSON: while decoding JSON: json: cannot unmarshal string into Go value of type releaseutil.SimpleHead
Any Idea how to overcome this? is there any workaround ?
Try removing the colon after server_name
.
server_name {{ print "kiftb." .Values.global.host | quote }}
...