{{- if gt (int (default 1 .Values.replicaCount)) 1 -}}
# permissions to do leader election.
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: {{ include "gha-runner-scale-set-controller.leaderElectionRoleName" . }}
  namespace: {{ .Release.Namespace }}
rules:
  - apiGroups: ["coordination.k8s.io"]
    resources: ["leases"]
    verbs: ["get", "watch", "list", "delete", "update", "create"]
{{- end }}