apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: kong-operator
rules:
  # to manage HorizontalPodAutoscaler
- apiGroups:
  - "autoscaling"
  resources:
  - horizontalpodautoscalers
  verbs:
  - get
  - create
  - delete
  # to create Ingress rules for Kong
- apiGroups:
  - "extensions"
  resources:
  - ingresses
  verbs:
  - '*'
- apiGroups:
  - "networking.k8s.io"
  resources:
  - ingresses
  - ingressclasses
  verbs:
  - '*'
  # To create service account for Kong when using Kong as an Ingress Controller
  # and its associated roles and bindings
- apiGroups:
  - "rbac.authorization.k8s.io"
  resources:
  - clusterroles
  - roles
  - clusterrolebindings
  - rolebindings
  verbs:
  - '*'
  # To create CRDs for Ingress Controller deployment
- apiGroups:
  - "apiextensions.k8s.io"
  resources:
  - customresourcedefinitions
  verbs:
  - '*'
- apiGroups:
  - "batch"
  resources:
  - jobs
  verbs:
  - '*'
- apiGroups:
  - ""
  resources:
  - pods
  - services
  - endpoints
  - persistentvolumeclaims
  - events
  - configmaps
  - secrets
  - serviceaccounts
  verbs:
  - '*'
- apiGroups:
  - apps
  resources:
  - deployments
  - daemonsets
  - replicasets
  - statefulsets
  verbs:
  - '*'
- apiGroups:
  - ""
  resources:
  - namespaces
  verbs:
  - get
- apiGroups:
  - ""
  resources:
  - configmaps
  - secrets
  verbs:
  - '*'
- apiGroups:
  - charts.konghq.com
  resources:
  - '*'
  verbs:
  - '*'
