{{- if .Values.preDelete.enabled }}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: rancher-webhook-pre-delete
  labels: {{ include "rancher-webhook.labels" . | nindent 4 }}
  annotations:
    "helm.sh/hook": pre-delete
    "helm.sh/hook-weight": "2"
    "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded,hook-failed
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: rancher-webhook-pre-delete
subjects:
  - kind: ServiceAccount
    name: rancher-webhook-pre-delete
    namespace: {{ .Release.Namespace }}
{{- end }}