I created ConfigMap in helm
apiVersion: v1
kind: ConfigMap
metadata:
name: test
data:
{{- $root := . -}}
{{- range $path, $bytes := .Files.Glob "*.yml"}}
{{ $path }}: '{{ $root.Files.Get $path }}'
{{- end }}
When I run kubectl get configmaps, the yml file format changed to a different file format adding "\" to the yml file. How can I prevent helm from changing the file format ?
apiVersion: v1
kind: ConfigMap
metadata:
name: test
data:
{{- $root := . -}}
{{- range $path, $bytes := .Files.Glob "*.yml"}}
{{- $value := $root.Files.Get $path -}}
{{- printf "\n" | nindent 2 -}}
{{ $path | nindent 2 }}: {{- toYaml $value | nindent 4 }}
{{- end }}
You can use something like above.
$value
variable.$value
variable to toYaml
function and nindent
with 4