{{- if gt (int (default 1 .Values.replicaCount)) 1 }}
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: {{ include "gha-runner-scale-set-controller.leaderElectionRoleBinding" . }}
  namespace: {{ include "gha-runner-scale-set-controller.namespace" . }}
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: {{ include "gha-runner-scale-set-controller.leaderElectionRoleName" . }}
subjects:
- kind: ServiceAccount
  name: {{ include "gha-runner-scale-set-controller.serviceAccountName" . }}
  namespace: {{ include "gha-runner-scale-set-controller.namespace" . }}
{{- end }}