{{- if and (.Values.workers.enabled)  (.Values.ingress.enabled) -}}
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: {{ template "airflow.fullname" . }}-flower
  labels:
    app: {{ template "airflow.name" . }}
    component: flower
    chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
    release: "{{ .Release.Name }}"
    heritage: "{{ .Release.Service }}"
  annotations:
    {{ range $key, $value := .Values.ingress.flower.annotations }}
    {{ $key }}: {{ $value | quote }}
    {{- end }}
spec:
{{- if .Values.ingress.flower.tls.enabled }}
  tls:
    - hosts:
        - {{ .Values.ingress.flower.host }}
      secretName: {{ .Values.ingress.flower.tls.secretName }}
{{- end }}
  rules:
    - http:
        paths:
          - path: {{ .Values.ingress.flower.path }}
            backend:
              serviceName: {{ template "airflow.fullname" . }}-flower
              servicePort: flower
      host: {{ .Values.ingress.flower.host }}
{{- end }}
