{{- if .Values.prometheus.enabled }}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: {{ template "kube-prometheus.prometheus.fullname" . }}
  labels: {{- include "kube-prometheus.prometheus.labels" . | nindent 4 }}
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: {{ template "kube-prometheus.prometheus.fullname" . }}
subjects:
  - kind: ServiceAccount
    name: {{ template "kube-prometheus.prometheus.serviceAccountName" . }}
    namespace: {{ .Release.Namespace }}
{{- end }}
