{{- if .Values.config }}
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "alertmanager.fullname" . }}
  labels:
    {{- include "alertmanager.labels" . | nindent 4 }}
data:
  alertmanager.yml: |
    {{- toYaml .Values.config | default "{}" | nindent 4 }}
  {{- range $key, $value := .Values.templates }}
  {{ $key }}: |-
    {{- $value | nindent 4 }}
  {{- end }}
{{- end }}
