{{- if .Values.leaderElect }}
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "grafana-operator.fullname" . }}
  namespace: {{ .Release.Namespace | quote }}
  labels:
    {{- with .Values.additionalLabels }}
    {{- toYaml . | nindent 4 }}
    {{- end }}
data:
  controller_manager_config.yaml: |
    apiVersion: controller-runtime.sigs.k8s.io/v1alpha1
    kind: ControllerManagerConfig
    health:
      healthProbeBindAddress: :8081
    metrics:
      bindAddress: 127.0.0.1:8080
    webhook:
      port: 9443
    leaderElection:
      leaderElect: true
      resourceName: f75f3bba.integreatly.org
{{- end }}
