{{- include "nplus.init" $ -}}
{{- if ( include "nplus.ingressEnabled" . ) }}
{{- $provider := (.this.ingress).provider -}}
{{- if eq $provider "ingress" }}
{{- include "nplus.ingress" (list . .component.fullName) | nindent 0 }}
      {{- if .this.ui }}
      - path: {{ .this.ingress.contextPath }}
        pathType: Prefix
        backend:
          service:
            name: {{ .component.fullName }}
            port: 
              name: {{ include "nplus.backendProtocol" . }}
      {{- end }}{{/* if .this.ui */}}
{{- else if eq $provider "gateway" }}
{{- include "nplus.gatewayRoute" (list . .component.fullName) | nindent 0 }}
  {{- if .this.ui }}
  - matches:
    - path:
        type: PathPrefix
        value: {{ .this.ingress.contextPath }}
    backendRefs:
    - name: {{ .component.fullName }}
      port: {{ include "nplus.backendPort" . }}
  {{- end }}{{/* if .this.ui */}}
{{- else }}{{/* if provider */}}
{{- fail (printf "unsupported ingress provider: %s" $provider) -}}
{{- end }}{{/* if provider */}}
{{- else }}{{/* if ( include "nplus.ingressEnabled" . ) */}}
# kind: ingress
# Not Generating any Ingress for {{ .component.fullName }} as
# Ingress = {{ .this.ingress }}
# Service = {{ .this.service }}
{{- end }}{{/* if ( include "nplus.ingressEnabled" . ) else */}}
