# helm_charts_confd-configmap.yaml
{{- if (or (.Values.datadog.confd) (.Values.datadog.autoconf)) }}
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ template "datadog.fullname" . }}-confd
  labels:
    helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
    app.kubernetes.io/name: "{{ template "datadog.fullname" . }}"
    app.kubernetes.io/instance: {{ .Release.Name | quote }}
    app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
    app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
  annotations:
    checksum/confd-config: {{ tpl (toYaml .Values.datadog.confd) . | sha256sum }}
    checksum/autoconf-config: {{ tpl (toYaml .Values.datadog.autoconf) . | sha256sum }}
data:
{{/*
Merge the legacy autoconf dict before so confd static configurations
override duplicates
*/}}
{{- if .Values.datadog.autoconf }}
{{ tpl (toYaml .Values.datadog.autoconf) . | indent 2 }}
{{- end }}
{{- if .Values.datadog.confd }}
{{ tpl (toYaml .Values.datadog.confd) . | indent 2 }}
{{- end }}
{{- end -}}