{{ if (.Values.jaeger.ingress.enabled) and eq .Values.provider "jaeger" }}
{{- $servicePort := .Values.jaeger.ui.port -}}
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: jaeger-query
  namespace: {{ .Release.Namespace }}
  labels:
    app: jaeger
    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}
  annotations:
    {{- range $key, $value := .Values.jaeger.ingress.annotations }}
      {{ $key }}: {{ $value | quote }}
    {{- end }}
spec:
  rules:
    {{- range $host := .Values.jaeger.ingress.hosts }}
    - host: {{ $host }}
      http:
        paths:
          - path: /
            backend:
              serviceName: jaeger-query
              servicePort: {{ $servicePort }}
    {{- end -}}
  {{- if .Values.jaeger.ingress.tls }}
  tls:
{{ toYaml .Values.jaeger.ingress.tls | indent 4 }}
  {{- end -}}
{{- end -}}
