apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: dynatrace-webhook
  labels:
    operator: dynakube
    internal.dynatrace.com/component: webhook
rules:
  - apiGroups:
      - ""
    resources:
      - namespaces
    verbs:
      - get
      - list
      - watch
      - update
  - apiGroups:
      - ""
    resources:
      - events
    verbs:
      - create
      - patch
  - apiGroups:
      - ""
    resources:
      - secrets
    verbs:
      - create
  - apiGroups:
      - ""
    resources:
      - secrets
    resourceNames:
      - dynatrace-dynakube-config
      - dynatrace-data-ingest-endpoint
    verbs:
      - get
      - list
      - watch
      - update
  # data-ingest workload owner lookup
  - apiGroups:
      - ""
    resources:
      - replicationcontrollers
    verbs:
      - get
  - apiGroups:
      - apps
    resources:
      - replicasets
      - statefulsets
      - daemonsets
      - deployments
    verbs:
      - get
  - apiGroups:
      - batch
    resources:
      - jobs
      - cronjobs
    verbs:
      - get
  - apiGroups:
      - apps.openshift.io
    resources:
      - deploymentconfigs
    verbs:
      - get
