# helm_charts_ui-ingress.yaml
{{- if and .Values.ui.enabled .Values.ui.ingress.enabled -}}
{{- $fullName := include "kubeless.fullname" . -}}
{{- $ingressPath := .Values.ui.ingress.path -}}
{{- $portName := .Values.ui.service.name -}}
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: {{ $fullName }}-ui
  labels:
{{ include "labels.standard" . | indent 4 }}
{{- with .Values.ui.ingress.annotations }}
  annotations:
{{ toYaml . | indent 4 }}
{{- end }}
spec:
{{- if .Values.ui.ingress.tls }}
  tls:
  {{- range .Values.ui.ingress.tls }}
    - hosts:
      {{- range .hosts }}
        - {{ . }}
      {{- end }}
      secretName: {{ .secretName }}
  {{- end }}
{{- end }}
  rules:
  {{- range .Values.ui.ingress.hosts }}
    - host: {{ . }}
      http:
        paths:
          - path: {{ $ingressPath }}
            backend:
              serviceName: {{ $fullName }}-ui
              servicePort: {{ $portName }}
  {{- end }}
{{- end }}