{{- if .Values.query.enabled -}}
apiVersion: v1
kind: Service
metadata:
  name: {{ template "jaeger.query.name" . }}
  labels:
    app.kubernetes.io/name: {{ include "jaeger.name" . }}
    helm.sh/chart: {{ include "jaeger.chart" . }}
    app.kubernetes.io/component: query
    app.kubernetes.io/managed-by: {{ .Release.Service }}
    app.kubernetes.io/instance: {{ .Release.Name }}
{{- if .Values.query.service.annotations }}
  annotations:
{{ toYaml .Values.query.service.annotations | indent 4 }}
{{- end }}
spec:
  ports:
  - name: query
    port: {{ .Values.query.service.port }}
    protocol: TCP
    targetPort: query
  selector:
    app.kubernetes.io/name: {{ include "jaeger.name" . }}
    app.kubernetes.io/component: query
    app.kubernetes.io/instance: {{ .Release.Name }}
  type: {{ .Values.query.service.type }}
{{- template "loadBalancerSourceRanges" .Values.query }}
{{- end -}}
