apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: submariner-addon
rules:
# Allow submariner-addon hub controller to run with openshift library-go
- apiGroups: [""]
  resources: ["configmaps"]
  verbs: ["create", "get", "list", "watch", "delete", "update"]
- apiGroups: [""]
  resources: ["pods"]
  verbs: ["get"]
- apiGroups: ["apps"]
  resources: ["replicasets"]
  verbs: ["get"]
- apiGroups: ["", "events.k8s.io"]
  resources: ["events"]
  verbs: ["create", "patch", "update"]
# Allow submariner-addon hub controller to manage submariner broker
- apiGroups: [""]
  resources: ["namespaces", "serviceaccounts"]
  verbs: ["create", "get", "list", "watch", "update", "patch", "delete"]
- apiGroups: ["rbac.authorization.k8s.io"]
  resources: ["roles"]
  verbs: ["create", "get", "list", "watch", "update", "patch", "delete", "bind", "escalate"]
- apiGroups: ["rbac.authorization.k8s.io"]
  resources: ["rolebindings"]
  verbs: ["create", "get", "list", "watch", "update", "patch", "delete"]
- apiGroups: ["apiextensions.k8s.io"]
  resources: ["customresourcedefinitions", "customresourcedefinitions/finalizers"]
  verbs: ["create", "get", "list", "watch", "update", "patch", "delete"]
# Allow submariner-addon hub controller to deploy submariner agent
- apiGroups: [""]
  resources: ["secrets"]
  verbs: ["create", "get", "list", "watch"]
- apiGroups: ["cluster.open-cluster-management.io"]
  resources: ["managedclusters", "managedclustersets"]
  verbs: ["get", "list", "watch", "update", "patch"]
- apiGroups: ["work.open-cluster-management.io"]
  resources: ["manifestworks"]
  verbs: ["create", "get", "list", "watch", "update", "patch", "delete"]
# Allow submariner-addon hub controller to configure submariner cluster environment
- apiGroups: ["config.openshift.io"]
  resources: ["apiservers", "infrastructures", "infrastructures/status"]
  verbs: ["get"]
- apiGroups: ["submarineraddon.open-cluster-management.io"]
  resources: ["submarinerconfigs"]
  verbs: ["get", "list", "watch", "update", "patch"]
- apiGroups: ["submarineraddon.open-cluster-management.io"]
  resources: ["submarinerconfigs/status"]
  verbs: ["update", "patch"]
# Allow submariner-addon hub controller to run with addon-framwork
- apiGroups: ["addon.open-cluster-management.io"]
  resources: ["clustermanagementaddons"]
  verbs: ["get", "list", "watch"]
- apiGroups: ["addon.open-cluster-management.io"]
  resources: ["managedclusteraddons"]
  verbs: ["get", "list", "watch", "patch", "update"]
- apiGroups: ["addon.open-cluster-management.io"]
  resources: ["managedclusteraddons/finalizers"]
  verbs: ["update"]
- apiGroups: ["addon.open-cluster-management.io"]
  resources: ["managedclusteraddons/status"]
  verbs: ["patch", "update"]
- apiGroups: ["certificates.k8s.io"]
  resources: ["certificatesigningrequests"]
  verbs: ["get", "list", "watch"]
- apiGroups: ["certificates.k8s.io"]
  resources: ["certificatesigningrequests/approval"]
  verbs: ["update", "patch"]
- apiGroups: ["certificates.k8s.io"]
  resources: ["signers"]
  resourceNames: ["kubernetes.io/kube-apiserver-client"]
  verbs: ["approve"]
