{{- if .Values.rbac.create -}}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: {{ include "datadog-operator.fullname" . }}
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: {{ include "datadog-operator.fullname" . }}
subjects:
  - kind: ServiceAccount
    name: {{ template "datadog-operator.serviceAccountName" . }}
    namespace: {{ .Release.Namespace }}
{{- end -}}
