apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: {{ .Values.ingress.name }}
  annotations:
    {{- toYaml .Values.ingress.annotations | nindent 4 }}
spec:
  ingressClassName: {{ .Values.ingress.className }}
  rules:
    {{- range $host := .Values.ingress.hosts }}
    - host: {{ $host.host }}
      http:
        paths:
        {{- range $path := $host.paths }}
        - path: {{ $path.path }}
          pathType: Prefix
          backend:
            service:
              name: {{ $path.serviceName }}
              port:
                number: {{ $path.servicePort }}
        {{- end }}
    {{- end }}
  {{- with .Values.ingress.tls }}
  tls:
  {{- range . }}
  - hosts:
    {{- range .hosts }}
    - {{ . }}
    {{- end }}
    secretName: {{ .secretName }}
  {{- end }}
  {{- end }}
