# Copyright Contributors to the Open Cluster Management project
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  labels:
    app: governance-policy-addon-controller
  name: policy-addon-ctrl-manager-role
rules:
  - apiGroups:
      - addon.open-cluster-management.io
    resources:
      - clustermanagementaddons
    verbs:
      - get
      - list
      - watch
  - apiGroups:
      - addon.open-cluster-management.io
    resourceNames:
      - config-policy-controller
      - governance-policy-framework
    resources:
      - clustermanagementaddons/finalizers
    verbs:
      - update
  - apiGroups:
      - addon.open-cluster-management.io
    resources:
      - managedclusteraddons
    verbs:
      - create
      - get
      - list
      - update
      - watch
  - apiGroups:
      - addon.open-cluster-management.io
    resourceNames:
      - config-policy-controller
      - governance-policy-framework
    resources:
      - managedclusteraddons
    verbs:
      - delete
  - apiGroups:
      - addon.open-cluster-management.io
    resourceNames:
      - config-policy-controller
      - governance-policy-framework
    resources:
      - managedclusteraddons/finalizers
    verbs:
      - update
  - apiGroups:
      - addon.open-cluster-management.io
    resourceNames:
      - config-policy-controller
      - governance-policy-framework
    resources:
      - managedclusteraddons/status
    verbs:
      - patch
      - update
  - apiGroups:
      - authorization.k8s.io
    resources:
      - subjectaccessreviews
    verbs:
      - create
      - get
  - apiGroups:
      - certificates.k8s.io
    resources:
      - certificatesigningrequests
      - certificatesigningrequests/approval
    verbs:
      - create
      - get
      - list
      - update
      - watch
  - apiGroups:
      - certificates.k8s.io
    resources:
      - signers
    verbs:
      - approve
  - apiGroups:
      - cluster.open-cluster-management.io
    resources:
      - managedclusters
    verbs:
      - get
      - list
      - watch
  - apiGroups:
      - coordination.k8s.io
    resources:
      - leases
    verbs:
      - create
  - apiGroups:
      - coordination.k8s.io
    resourceNames:
      - config-policy-controller
      - governance-policy-framework
    resources:
      - leases
    verbs:
      - get
      - list
      - patch
      - update
      - watch
  - apiGroups:
      - ""
    resourceNames:
      - policy-encryption-key
    resources:
      - secrets
    verbs:
      - get
      - list
      - watch
  - apiGroups:
      - policy.open-cluster-management.io
    resources:
      - policies
    verbs:
      - create
      - delete
      - get
      - list
      - patch
      - update
      - watch
  - apiGroups:
      - policy.open-cluster-management.io
    resources:
      - policies/finalizers
    verbs:
      - update
  - apiGroups:
      - policy.open-cluster-management.io
    resources:
      - policies/status
    verbs:
      - get
      - patch
      - update
  - apiGroups:
      - rbac.authorization.k8s.io
    resources:
      - clusterroles
    verbs:
      - create
  - apiGroups:
      - rbac.authorization.k8s.io
    resourceNames:
      - open-cluster-management:config-policy-controller-hub
      - open-cluster-management:policy-framework-hub
    resources:
      - clusterroles
    verbs:
      - delete
      - get
      - patch
      - update
  - apiGroups:
      - rbac.authorization.k8s.io
    resources:
      - rolebindings
    verbs:
      - create
  - apiGroups:
      - rbac.authorization.k8s.io
    resourceNames:
      - open-cluster-management:config-policy-controller-hub
      - open-cluster-management:policy-framework-hub
    resources:
      - rolebindings
    verbs:
      - delete
      - get
      - patch
      - update
  - apiGroups:
      - work.open-cluster-management.io
    resources:
      - manifestworks
    verbs:
      - create
      - get
      - list
      - watch
  - apiGroups:
      - work.open-cluster-management.io
    resourceNames:
      - addon-config-policy-controller-deploy
      - addon-governance-policy-framework-deploy
    resources:
      - manifestworks
    verbs:
      - delete
      - patch
      - update
