---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: manager-role
rules:
  ##
  ## Base operator rules
  ##
  - apiGroups:
      - ""
    resources:
      - secrets
      - pods
      - pods/exec
      - pods/log
      - services # allow managing services
      - configmaps # allow managing configmaps
    verbs:
      - create
      - delete
      - get
      - list
      - patch
      - update
      - watch
  - apiGroups:
      - apps
    resources:
      - deployments
      - daemonsets
      - replicasets
      - statefulsets
    verbs:
      - create
      - delete
      - get
      - list
      - patch
      - update
      - watch
  - apiGroups: # allow operator to manage routes
      - route.openshift.io
    resources:
      - routes
      - routes/custom-host # https://stackoverflow.com/a/61907374/3763807
    verbs:
      - '*' # can be narrowed down for more security, if required

  ##
  ## Rules for web.example.com/v1alpha1, Kind: Apache
  ##
  - apiGroups:
      - web.example.com
    resources:
      - apaches
      - apaches/status
      - apaches/finalizers
    verbs:
      - create
      - delete
      - get
      - list
      - patch
      - update
      - watch
#+kubebuilder:scaffold:rules
