apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: {{ .ManagedClusterName }}:managed-cluster-work
  namespace: "{{ .ManagedClusterName }}"
  finalizers:
  - cluster.open-cluster-management.io/manifest-work-cleanup
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: {{ .ManagedClusterName }}:managed-cluster-work
subjects:
  # Bind the role with agent user group, the role will be as a common role for all agents
  # TODO: we will consider bind a specific role for each agent by agent name
  - kind: Group
    apiGroup: rbac.authorization.k8s.io
    name: system:open-cluster-management:{{ .ManagedClusterName }}
