{{- if .Values.ingress.enabled }}
{{- $serviceName := (printf "%s-http" (include "nifi.fullname" . )) }}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: {{ include "nifi.fullname" . }}
  labels:
    {{- include "nifi.labels" . | nindent 4 }}
  annotations:
    # nginx.ingress.kubernetes.io/backend-protocol: HTTPS
    # nginx.ingress.kubernetes.io/affinity: cookie
    # nginx.ingress.kubernetes.io/affinity-mode: persistent
    {{- with .Values.ingress.annotations }}
    {{- toYaml . | nindent 4 }}
    {{- end }}
spec:
{{- if .Values.ingress.ingressClassName }}
  ingressClassName: {{ .Values.ingress.ingressClassName | quote }}
{{- end }}
{{- if .Values.ingress.tls }}
  tls:
  {{- range .Values.ingress.tls }}
    - hosts:
      {{- range .hosts }}
        - {{ . | quote }}
      {{- end }}
      secretName: {{ .secretName }}
  {{- end }}
{{- end }}
  rules:
    - host: {{ .Values.ingress.hostName }}
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: {{ $serviceName }}
                port:
                  name: https
{{- end }}
