Is it possible to load the contents of yml as configamp in k8s using Helm Charts? Helm Chart for ConfigMap
{{- define "common.configmap.tpl" -}}
kind: ConfigMap
apiVersion: v1
{{ template "common.metadata" . }}
namespace: {{ .Values.namespace | default "default" }}
data:
{{ range $path, $bytes := .Files.Glob "config/*.yml" }}
{{- $.Files.Get $path | indent 2 }}
{{ end }}
{{- end }}
{{- define "common.configmap" -}}
{{- template "common.util.merge" (append . "common.configmap.tpl") -}}
{{- end }}
Sample application.yml.
server:
port: 8080
name: localhost
sample:
groupa:
param1: value1base
param2: value2base
higherparam: valuehigherbase
expected configmap
apiVersion: v1
data:
server_port: 8080
server_name: localhost
sample_groupa_param1: value1base
sample_groupa_param2: value2base
sample_higherparam: valuehigherbase
kind: ConfigMap
metadata:
labels:
app: test
chart: test-1.0.0
name: test-cm
namespace: default