# Source: cilium/templates/cilium-operator-clusterrole.yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: cilium-operator
rules:
- resources:
  # to automatically delete [core|kube]dns pods so that are starting to being
  # managed by Cilium
  - pods
  apiGroups:
  - ""
  verbs:
  - get
  - list
  - watch
  - delete
- resources:
  - endpointslices
  apiGroups:
  - discovery.k8s.io
  verbs:
  - get
  - list
  - watch
- resources:
  - services
  apiGroups:
  - ""
  verbs:
  - get
  - list
  - watch
- resources:
  # to perform LB IP allocation for BGP
  - services/status
  apiGroups:
  - ""
  verbs:
  - update
- resources:
  # to perform the translation of a CNP that contains `ToGroup` to its endpoints
  - services
  - endpoints
  # to check apiserver connectivity
  - namespaces
  apiGroups:
  - ""
  verbs:
  - get
  - list
  - watch
- resources:
  - ciliumnetworkpolicies
  - ciliumnetworkpolicies/status
  - ciliumnetworkpolicies/finalizers
  - ciliumclusterwidenetworkpolicies
  - ciliumclusterwidenetworkpolicies/status
  - ciliumclusterwidenetworkpolicies/finalizers
  - ciliumendpoints
  - ciliumendpoints/status
  - ciliumendpoints/finalizers
  - ciliumnodes
  - ciliumnodes/status
  - ciliumnodes/finalizers
  - ciliumidentities
  - ciliumidentities/status
  - ciliumidentities/finalizers
  - ciliumlocalredirectpolicies
  - ciliumlocalredirectpolicies/status
  - ciliumlocalredirectpolicies/finalizers
  apiGroups:
  - cilium.io
  verbs:
  - '*'
- resources:
  - customresourcedefinitions
  apiGroups:
  - apiextensions.k8s.io
  verbs:
  - create
  - get
  - list
  - update
  - watch
# For cilium-operator running in HA mode.
#
# Cilium operator running in HA mode requires the use of ResourceLock for Leader Election
# between multiple running instances.
# The preferred way of doing this is to use LeasesResourceLock as edits to Leases are less
# common and fewer objects in the cluster watch "all Leases".
- resources:
  - leases
  apiGroups:
  - coordination.k8s.io
  verbs:
  - create
  - get
  - update
