apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: kt-channel-controller
rules:
  - apiGroups:
      - messaging.optum.dev
    resources:
      - kafkatopicchannels
      - kafkatopicchannels/status
    verbs:
      - get
      - list
      - watch
      - update
      - patch
  - apiGroups:
      - messaging.optum.dev
    resources:
      - kafkatopicchannels/finalizers
    verbs:
      - update
  - apiGroups:
      - "" # Core API group.
    resources:
      - configmaps
      - secrets
    verbs:
      - get
      - list
      - watch
      - create
  - apiGroups:
      - "" # Core API group.
    resources:
      - services
      - serviceaccounts
    verbs: &everything
      - get
      - list
      - watch
      - create
      - patch
      - update
  - apiGroups:
      - "" # Core API Group.
    resources:
      - configmaps
    resourceNames:
      - kt-channel-dispatcher
    verbs:
      - update
  - apiGroups:
      - "" # Core API Group.
    resources:
      - events
    verbs:
      - create
      - patch
      - update
  - apiGroups:
      - "" # Core API group.
    resources:
      - endpoints
      - pods
    verbs:
      - get
      - list
      - watch
  - apiGroups:
      - apps
    resources:
      - deployments
      - deployments/status
    verbs: *everything
  - apiGroups:
      - rbac.authorization.k8s.io
    resources:
      - rolebindings
    verbs: *everything
  - apiGroups:
      - "coordination.k8s.io"
    resources:
      - leases
    verbs: *everything
