{{- /*
Copyright Broadcom, Inc. All Rights Reserved.
SPDX-License-Identifier: APACHE-2.0
*/}}

{{- if and .Values.queryFrontend.query.enabled (empty .Values.queryFrontend.query.existingConfigmap) }}
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ template "grafana-tempo.queryConfigmapName" . }}
  namespace: {{ .Release.Namespace | quote }}
  {{- $versionLabel := dict "app.kubernetes.io/version" ( include "common.images.version" ( dict "imageRoot" .Values.queryFrontend.query.image "chart" .Chart ) ) }}
  {{- $labels := include "common.tplvalues.merge" ( dict "values" ( list .Values.commonLabels $versionLabel ) "context" . ) }}
  labels: {{- include "common.labels.standard" ( dict "customLabels" $labels "context" $ ) | nindent 4 }}
    app.kubernetes.io/component: query
  {{- if .Values.commonAnnotations }}
  annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
  {{- end }}
data:
  tempo-query.yaml: |-
    {{- include "common.tplvalues.render" (dict "value" .Values.queryFrontend.query.configuration "context" $) | nindent 4 }}
{{- end }}
