apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: cluster-manager
rules:
# Allow the registration-operator to create workload
- apiGroups: [""]
  resources: ["configmaps", "namespaces", "serviceaccounts", "services", "secrets"]
  verbs: ["create", "get", "list", "update", "watch", "patch", "delete"]
- apiGroups: [""]
  resources: ["nodes"]
  verbs: ["get", "list", "watch"]
- apiGroups: ["authorization.k8s.io"]
  resources: ["subjectaccessreviews"]
  verbs: ["create"]
- apiGroups: ["", "events.k8s.io"]
  resources: ["events"]
  verbs: ["create", "patch", "update"]
- apiGroups: ["apps"]
  resources: ["deployments"]
  verbs: ["create", "get", "list", "update", "watch", "patch", "delete"]
- apiGroups: ["rbac.authorization.k8s.io"]
  resources: ["clusterrolebindings", "rolebindings"]
  verbs: ["create", "get", "list", "update", "watch", "patch", "delete"]
- apiGroups: ["rbac.authorization.k8s.io"]
  resources: ["clusterroles", "roles"]
  verbs: ["create", "get", "list", "update", "watch", "patch", "delete", "escalate", "bind"]
# Allow the registration-operator to create crds
- apiGroups: ["apiextensions.k8s.io"]
  resources: ["customresourcedefinitions"]
  verbs: ["create", "get", "list", "update", "watch", "patch", "delete"]
# Allow the registration-operator to create apiservice
- apiGroups: ["apiregistration.k8s.io"]
  resources: ["apiservices"]
  verbs: ["create", "get", "list", "update", "watch", "patch", "delete"]
# Allow the registration-operator to create validatingwebhookconfigurration
- apiGroups: ["admissionregistration.k8s.io"]
  resources: ["validatingwebhookconfigurations", "mutatingwebhookconfigurations"]
  verbs: ["create", "get", "list", "update", "watch", "patch", "delete"]
# Allow the nuclues to manage clustermanager apis.
- apiGroups: ["operator.open-cluster-management.io"]
  resources: ["clustermanagers"]
  verbs: ["get", "list", "watch", "update", "delete"]
- apiGroups: ["operator.open-cluster-management.io"]
  resources: ["clustermanagers/status"]
  verbs: ["update", "patch"]
# Allow the registration-operator to create storageversionmigration
- apiGroups: ["migration.k8s.io"]
  resources: ["storageversionmigrations"]
  verbs: ["create", "get", "list", "update", "watch", "patch", "delete"]
