{{- if and .Values.metrics.enabled .Values.metrics.serviceMonitor.enabled .Values.metrics.serviceMonitor.rbac.create }}
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: {{ template "kong.fullname" . }}-prometheus
  namespace: {{ .Release.Namespace }}
rules:
- apiGroups: [""]
  resources: ["endpoints", "services", "pods"]
  verbs: ["get", "list", "watch"]
{{- end }}
