{{- if and .Values.querier.enabled .Values.querier.pspEnabled .Values.querier.rbac.create -}}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: {{ include "thanos.fullname" . }}-querier
roleRef:
  kind: ClusterRole
  name: {{ include "thanos.fullname" . }}-querier
  apiGroup: rbac.authorization.k8s.io
subjects:
# Authorize specific service accounts:
- kind: ServiceAccount
  name: {{ include "thanos.serviceaccount.name" (dict "component" "querier" "context" $) }}
  namespace: {{ .Release.Namespace }}
{{- end -}}
