{{- if and (or (.Files.Glob "files/docker-entrypoint-initdb.d/*.{sh,sql,sql.gz}") .Values.initdbScripts) (not .Values.initdbScriptsConfigMap) }} apiVersion: v1 kind: ConfigMap metadata: name: {{ template "master.fullname" . }}-init-scripts namespace: {{ .Release.Namespace }} labels: app: "{{ template "mariadb.name" . }}" chart: "{{ template "mariadb.chart" . }}" release: {{ .Release.Name | quote }} heritage: {{ .Release.Service | quote }} component: "master" {{- if and (.Files.Glob "files/docker-entrypoint-initdb.d/*.sql.gz") (not .Values.initdbScriptsConfigMap) }} binaryData: {{- $root := . }} {{- range $path, $bytes := .Files.Glob "files/docker-entrypoint-initdb.d/*.sql.gz" }} {{ base $path }}: {{ $root.Files.Get $path | b64enc | quote }} {{- end }} {{- end }} data: {{- if and (.Files.Glob "files/docker-entrypoint-initdb.d/*.{sh,sql}") (not .Values.initdbScriptsConfigMap) }} {{ (.Files.Glob "files/docker-entrypoint-initdb.d/*.{sh,sql}").AsConfig | indent 2 }} {{- end }} {{- with .Values.initdbScripts }} {{ toYaml . | indent 2 }} {{- end }} {{ end }}