apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: {{ include "manager-role-binding.name" . | quote }}
  namespace: {{ include "autoscaling-runner-set.namespace" . | quote }}
  labels:
    {{- include "manager-role-binding.labels" . | nindent 4 }}
  annotations:
    {{- include "manager-role-binding.annotations" . | nindent 4 }}
  finalizers:
    - actions.github.com/cleanup-protection
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: {{ include "manager-role.name" . | quote }}
subjects:
  {{- if not .Values.controllerServiceAccount }}
    {{- fail "controllerServiceAccount must be set" -}}
  {{- end }}
  - kind: ServiceAccount
    name: {{ required "controllerServiceAccount.name must be set" .Values.controllerServiceAccount.name | quote }}
    namespace: {{ required "controllerServiceAccount.namespace must be set" .Values.controllerServiceAccount.namespace | quote }}
