{{- if .Values.ingress.enabled }}
{{- range .Values.ingress.hosts }}
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: {{ template "node.fullname" $ }}
  labels: {{- include "node.labels" $ | nindent 4 }}
  annotations:
    {{- if .certManager }}
    kubernetes.io/tls-acme: "true"
    {{- end }}
    {{- range $key, $value := .annotations }}
    {{ $key }}: {{ $value | quote }}
    {{- end }}
spec:
  rules:
    - host: {{ .name }}
      http:
        paths:
          - path: {{ default "/" .path }}
            backend:
              serviceName: {{ template "node.fullname" $ }}
              servicePort: 80
  {{- if .tls }}
  tls:
    - hosts:
        - {{ .name }}
      secretName: {{ .tlsSecret }}
  {{- end }}
{{- end }}
{{- end }}
