{{- if .Values.web.ingress.enabled }}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: {{ include "attune.fullname" . }}-web
  labels:
    {{- include "attune.labels" . | nindent 4 }}
  {{- with .Values.web.ingress.annotations }}
  annotations:
    {{- toYaml . | nindent 4 }}
  {{- end }}
spec:
  {{- if .Values.web.ingress.className }}
  ingressClassName: {{ .Values.web.ingress.className }}
  {{- end }}
  rules:
    {{- range .Values.web.ingress.hosts }}
    - host: {{ .host | quote }}
      http:
        paths:
          {{- range .paths }}
          - path: {{ .path }}
            pathType: {{ .pathType }}
            backend:
              service:
                name: {{ include "attune.fullname" $ }}-web
                port:
                  number: {{ $.Values.web.service.port }}
          {{- end }}
    {{- end }}
  {{- with .Values.web.ingress.tls }}
  tls:
    {{- toYaml . | nindent 4 }}
  {{- end }}
{{- end }}
