# helm_charts_ingress_ui.yaml
{{- if .Values.ingressUI.enabled -}}
{{- $serviceName := include "luigi.fullname" . -}}
{{- $servicePort := .Values.service.externalPort -}}
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: {{ template "luigi.fullname" . }}-ui
  labels:
    app: {{ template "luigi.name" . }}
    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}
  annotations:
    {{- range $key, $value := .Values.ingressUI.annotations }}
      {{ $key }}: {{ $value | quote }}
    {{- end }}
spec:
  rules:
    {{- range $host := .Values.ingressUI.hosts }}
    - host: {{ $host }}
      http:
        paths:
          - path: /
            backend:
              serviceName: {{ $serviceName }}
              servicePort: {{ $servicePort }}
    {{- end -}}
  {{- if .Values.ingressUI.tls }}
  tls:
{{ toYaml .Values.ingressUI.tls | indent 4 }}
  {{- end -}}
{{- end -}}