apiVersion: v1
kind: Service
metadata:
  name: {{ template "grafana-tempo.query-frontend.fullname" . }}-headless
  namespace: {{ .Release.Namespace | quote }}
  labels: {{- include "common.labels.standard" . | nindent 4 }}
    app.kubernetes.io/component: query-frontend
    {{- if .Values.commonLabels }}
    {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
    {{- end }}
  {{- if .Values.commonAnnotations }}
  annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
  {{- end }}
spec:
  # NOTE: this is based on this https://github.com/grafana/helm-charts/pull/451. Should be reviewed if it is actually necessary in the future
  publishNotReadyAddresses: true
  type: ClusterIP
  clusterIP: None
  ports:
    - name: http
      port: {{ .Values.queryFrontend.service.ports.http }}
      targetPort: http
      protocol: TCP
    - name: grpc
      port: {{ .Values.queryFrontend.service.ports.grpc }}
      targetPort: grpc
      protocol: TCP
    {{- if .Values.queryFrontend.service.extraPorts }}
    {{- include "common.tplvalues.render" (dict "value" .Values.queryFrontend.service.extraPorts "context" $) | nindent 4 }}
    {{- end }}
  selector: {{- include "common.labels.matchLabels" . | nindent 4 }}
    app.kubernetes.io/component: query-frontend
