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