# 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
rules:
- apiGroups:
  - ""
  resources:
  - configmaps
  - namespaces
  - serviceaccounts
  - endpoints
  - services
  - secrets
  - pods
  - events
  verbs:
  - "*"

- apiGroups:
  - apps
  resources:
  - deployments
  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

- 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
- apiGroups:
  - route.openshift.io
  resources:
  - routes
  verbs:
  - list
  - watch

# 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
