#  grants list namespaces permissions to the presto service account
{{- if .Values.presto.spec.config.connectors.prometheus.enabled }}
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: {{ .Release.Namespace }}-presto-service-account
  labels:
    app: presto
rules:
- apiGroups:
  - ""
  resources:
  - namespaces
  verbs:
  - get
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: {{ .Release.Namespace }}-presto-service-account
  labels:
    app: presto
subjects:
- kind: ServiceAccount
  name: presto
  namespace: {{ .Release.Namespace }}
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: {{ .Release.Namespace }}-presto-service-account
{{- end }}
