{{- if .Values.ingress.enabled }}
{{- $ingressPath := .Values.ingress.path -}}
{{- $fullName := printf "%s-zeppelin" .Release.Name -}}
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: {{ $fullName }}
  labels:
    app: {{ template "zeppelin.name" . }}
    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}
{{- with .Values.ingress.annotations }}
  annotations:
{{ toYaml . | indent 4 }}
{{- end }}
spec:
  rules:
  {{- range .Values.ingress.hosts }}
  - host: {{ . | quote }}
    http:
      paths:
        - path: {{ $ingressPath }}
          backend:
            serviceName: {{ $fullName }}
            servicePort: 8080
  {{- end }}
{{- if .Values.ingress.tls }}
  tls:
  {{- range .Values.ingress.tls }}
    - hosts:
      {{- range .hosts }}
        - {{ . | quote }}
      {{- end }}
      secretName: {{ .secretName }}
  {{- end }}
{{- end }}
{{- end }}
