{{- if .Values.rbac.create }}
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: {{ template "kyverno.fullname" . }}:leaderelection
  namespace: {{ template "kyverno.namespace" . }}
  labels: {{ include "kyverno.labels" . | nindent 4 }}
    app: kyverno
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: {{ template "kyverno.fullname" . }}:leaderelection
subjects:
- kind: ServiceAccount
  name: {{ template "kyverno.serviceAccountName" . }}
  namespace: {{ template "kyverno.namespace" . }}

{{- end }}
