{{ if .Values.config }}
apiVersion: v1
kind: ConfigMap
metadata:
  namespace: {{ .Release.Namespace }}
  labels: {{ include "newrelic.labels" . | indent 4 }}
  name: {{ template "newrelic.fullname" . }}
data:
    newrelic-infra.yml: |
{{ toYaml .Values.config | indent 6 }}
{{ end }}
{{ if .Values.integrations_config }}
---
apiVersion: v1
kind: ConfigMap
metadata:
  namespace: {{ .Release.Namespace }}
  labels: {{ include "newrelic.labels" . | indent 4 }}
  name: {{ template "newrelic.fullname" . }}-integrations-cfg
data:
{{ range .Values.integrations_config -}}
{{ .name | indent 2 }}: |
    ---
{{ toYaml .data | indent  4 }}
{{ end }}
{{ end }}
