{{- if .Values.ingressController.clusterRole.create -}}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name:  {{ template "kong.clusterRoleName" . }}
  annotations:
    "helm.sh/resource-policy": keep
rules:
  - apiGroups:
      - "configuration.konghq.com"
    resources:
      - kongclusterplugins
    verbs:
      - get
      - list
      - watch
  - apiGroups:
      - "networking.k8s.io"
    resources:
      - ingressclasses
    verbs:
      - get
      - watch
      - list
  - apiGroups:
      - ''
    resources:
      - endpoints
      - pods
      - services
    verbs:
      - list
{{- end -}}
