{{- include "nplus.init" $ -}}
{{- if and (eq .this.ingress.provider "gateway") (.this.ingress).domain }}
apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
  name: {{ .component.fullName }}
  {{- if .this.utils.includeNamespace }}
  namespace: {{ .Release.Namespace }}
  {{- end }}
  labels:
    {{- include "nplus.instanceLabels" . | nindent 4 }}
  annotations:
    {{- include "nplus.argoWave" . | nindent 4 }}
    {{- include "nplus.annotations" . | nindent 4 }}
    {{- include "nplus.securityAnnotations" . | nindent 4 }}
spec:
  gatewayClassName: {{ (.this.ingress).class }}
  listeners:
  - name: https
    protocol: HTTPS
    port: 443
    hostname: {{ (.this.ingress).domain }}
    tls:
      mode: Terminate
      certificateRefs:
      - kind: Secret
        name: {{ (.this.ingress).secret }}
    allowedRoutes:
      namespaces:
        from: Same
{{- end }}
