# helm_charts_ingress-portal-api.yaml
{{- if .Values.enterprise.enabled }}
{{- if .Values.portalapi.ingress.enabled -}}
{{- $serviceName := include "kong.fullname" . -}}
{{- $servicePort := include "kong.ingress.servicePort" .Values.portalapi -}}
{{- $path := .Values.portalapi.ingress.path -}}
{{- $tls := .Values.portalapi.ingress.tls -}}
{{- $hostname := .Values.portalapi.ingress.hostname -}}
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: {{ template "kong.fullname" . }}-portalapi
  labels:
    {{- include "kong.metaLabels" . | nindent 4 }}
  annotations:
    {{- range $key, $value := .Values.portalapi.ingress.annotations }}
      {{ $key }}: {{ $value | quote }}
    {{- end }}
spec:
  rules:
  - host: {{ $hostname }}
    http:
      paths:
        - path: {{ $path }}
          backend:
            serviceName: {{ $serviceName }}-portalapi
            servicePort: {{ $servicePort }}
  {{- if $tls }}
  tls:
  - hosts:
    - {{ $hostname }}
    secretName: {{ $tls }}
  {{- end -}}
{{- end -}}
{{- end -}}