{{- if and (or (.Files.Glob "files/docker-entrypoint-initdb.d/*.{sh,txt}") .Values.influxdb.initdbScripts) (not .Values.influxdb.initdbScriptsCM) }}
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "influxdb.fullname" . }}-initdb-scripts
  labels: 
    {{- include "influxdb.labels" . | nindent 4 }}
    app.kubernetes.io/component: influxdb
data:
{{- with .Files.Glob "files/docker-entrypoint-initdb.d/*.{sh,txt}" }}
{{ .AsConfig | indent 2 }}
{{- end }}
{{- with .Values.influxdb.initdbScripts }}
{{ tpl (toYaml .) $ | indent 2 }}
{{- end }}
{{- end }}
