{{- if .Values.rbac.create }}
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  labels:
    app: {{ template "nfs-subdir-external-provisioner.name" . }}
    chart: {{ template "nfs-subdir-external-provisioner.chart" . }}
    heritage: {{ .Release.Service }}
    release: {{ .Release.Name }}
  name: run-{{ template "nfs-subdir-external-provisioner.fullname" . }}
subjects:
  - kind: ServiceAccount
    name: {{ template "nfs-subdir-external-provisioner.serviceAccountName" . }}
    namespace: {{ .Release.Namespace }}
roleRef:
  kind: ClusterRole
  name: {{ template "nfs-subdir-external-provisioner.fullname" . }}-runner
  apiGroup: rbac.authorization.k8s.io
{{- end }}
