# Cluster role for the operator itself.
# TODO: A lot of these should be replaced by roles in the namespaces for which
# the operator actually needs access.
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: openshift-ingress-operator
  annotations:
    include.release.openshift.io/ibm-cloud-managed: "true"
    include.release.openshift.io/self-managed-high-availability: "true"
rules:
- apiGroups:
  - ""
  resources:
  - configmaps
  - namespaces
  - serviceaccounts
  - endpoints
  - services
  - secrets
  - pods
  - events
  verbs:
  - "*"

- apiGroups:
  - apps
  resources:
  - deployments
  - daemonsets
  verbs:
  - "*"

- apiGroups:
  - policy
  resources:
  - poddisruptionbudgets
  verbs:
  - "*"

- apiGroups:
  - monitoring.coreos.com
  resources:
  - servicemonitors
  verbs:
  - create
  - get
  - update

- apiGroups:
  - rbac.authorization.k8s.io
  resources:
  - clusterroles
  - clusterrolebindings
  - roles
  - rolebindings
  verbs:
  - create
  - get
  - list
  - watch
  - update

- apiGroups:
  - operator.openshift.io
  resources:
  - ingresscontrollers
  - ingresscontrollers/status
  verbs:
  - "*"

- apiGroups:
  - ingress.operator.openshift.io
  resources:
  - dnsrecords
  - dnsrecords/status
  verbs:
  - "*"

- apiGroups:
  - config.openshift.io
  resources:
  - infrastructures
  - ingresses
  - dnses
  - apiservers
  - networks
  verbs:
  - get

- apiGroups:
  - config.openshift.io
  resources:
  - dnses
  - infrastructures
  - ingresses
  verbs:
  - list
  - watch

- apiGroups:
  - config.openshift.io
  resources:
  - clusteroperators
  verbs:
  - create
  - get

- apiGroups:
  - config.openshift.io
  resources:
  - clusteroperators/status
  verbs:
  - update

# Mirrored from assets/router/metrics/cluster-role.yaml
- apiGroups:
  - route.openshift.io
  resources:
  - routers/metrics
  verbs:
  - get

# Mirrored from assets/router/cluster-role.yaml
- apiGroups:
  - authentication.k8s.io
  resources:
  - tokenreviews
  verbs:
  - create

# Mirrored from assets/router/cluster-role.yaml
- apiGroups:
  - authorization.k8s.io
  resources:
  - subjectaccessreviews
  verbs:
  - create

# Mirrored from assets/router/cluster-role.yaml
# and expanded for the canary-controller.
- apiGroups:
  - route.openshift.io
  resources:
  - routes
  verbs:
  - '*'

# Mirrored from assets/router/cluster-role.yaml
- apiGroups:
  - route.openshift.io
  resources:
  - routes/status
  verbs:
  - update

# Mirrored from assets/router/cluster-role.yaml
- apiGroups:
  - security.openshift.io
  resources:
  - securitycontextconstraints
  verbs:
  - use
  resourceNames:
  - hostnetwork

# Mirrored from assets/router/cluster-role.yaml
- apiGroups:
  - discovery.k8s.io
  resources:
  - endpointslices
  verbs:
  - list
  - watch
