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