{{- if not .Values.existingConfigMap -}}
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "fluent-bit.fullname" . }}
  namespace: {{ .Release.Namespace }}
  labels:
    {{- include "fluent-bit.labels" . | nindent 4 }}
data:
  custom_parsers.conf: |
    {{- (tpl .Values.config.customParsers $) | nindent 4 }}
  fluent-bit.conf: |
    {{- (tpl .Values.config.service $)  | nindent 4 }}
    {{- (tpl .Values.config.inputs $)  | nindent 4 }}
    {{- (tpl .Values.config.filters $)  | nindent 4 }}
    {{- (tpl .Values.config.outputs $)  | nindent 4 }}
  {{- range $key, $val := .Values.config.upstream }}
  {{ $key }}: |
    {{- (tpl $val $) | nindent 4 }}
  {{- end }}
  {{- range $key, $val := .Values.config.extraFiles }}
  {{ $key }}: |
    {{- (tpl $val $) | nindent 4 }}
  {{- end }}
{{- end -}}
