{{- if and .Values.rbac.create .Values.rbac.clusterAdministrator }}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: {{ include "velero.fullname" . }}-server
  labels:
    app.kubernetes.io/component: server
    app.kubernetes.io/name: {{ include "velero.name" . }}
    app.kubernetes.io/instance: {{ .Release.Name }}
    app.kubernetes.io/managed-by: {{ .Release.Service }}
    helm.sh/chart: {{ include "velero.chart" . }}
subjects:
  - kind: ServiceAccount
    namespace: {{ .Release.Namespace }}
    name: {{ include "velero.serverServiceAccount" . }}
roleRef:
  kind: ClusterRole
  name: {{ .Values.rbac.clusterAdministratorName }}
  apiGroup: rbac.authorization.k8s.io
{{- end }}
