J release changes
[ric-plt/ric-dep.git] / helm / infrastructure / subcharts / kong / templates / service-kong-portal-api.yaml
index 1f61ac2..710f201 100644 (file)
@@ -1,50 +1,19 @@
+{{- if .Values.deployment.kong.enabled }}
 {{- if .Values.enterprise.enabled }}
-apiVersion: v1
-kind: Service
-metadata:
-  name: {{ template "kong.fullname" . }}-portalapi
-  annotations:
-    {{- range $key, $value := .Values.portalapi.annotations }}
-      {{ $key }}: {{ $value | quote }}
-    {{- end }}
-  labels:
-    {{- include "kong.metaLabels" . | nindent 4 }}
-spec:
-  type: {{ .Values.portalapi.type }}
-  {{- if eq .Values.portalapi.type "LoadBalancer" }}
-  {{- if .Values.portalapi.loadBalancerIP }}
-  loadBalancerIP: {{ .Values.portalapi.loadBalancerIP }}
-  {{- end }}
-  {{- if .Values.portalapi.loadBalancerSourceRanges }}
-  loadBalancerSourceRanges:
-  {{- range $cidr := .Values.portalapi.loadBalancerSourceRanges }}
-  - {{ $cidr }}
-  {{- end }}
-  {{- end }}
-  {{- end }}
-  externalIPs:
-  {{- range $ip := .Values.portalapi.externalIPs }}
-  - {{ $ip }}
-  {{- end }}
-  ports:
-  {{- if .Values.portalapi.http.enabled }}
-  - name: kong-portalapi
-    port: {{ .Values.portalapi.http.servicePort }}
-    targetPort: {{ .Values.portalapi.http.containerPort }}
-  {{- if (and (eq .Values.portalapi.type "NodePort") (not (empty .Values.portalapi.http.nodePort))) }}
-    nodePort: {{ .Values.portalapi.http.nodePort }}
-  {{- end }}
-    protocol: TCP
-  {{- end }}
-  {{- if or .Values.portalapi.tls.enabled }}
-  - name: kong-portalapi-tls
-    port: {{ .Values.portalapi.tls.servicePort }}
-    targetPort: {{ .Values.portalapi.tls.containerPort }}
-  {{- if (and (eq .Values.portalapi.type "NodePort") (not (empty .Values.portalapi.tls.nodePort))) }}
-    nodePort: {{ .Values.portalapi.tls.nodePort }}
-  {{- end }}
-    protocol: TCP
-  {{- end }}
-  selector:
-    {{- include "kong.selectorLabels" . | nindent 4 }}
+{{- if and .Values.portalapi.enabled (or .Values.portalapi.http.enabled .Values.portalapi.tls.enabled) -}}
+{{- $serviceConfig := dict -}}
+{{- $serviceConfig := merge $serviceConfig .Values.portalapi -}}
+{{- $_ := set $serviceConfig "ingressVersion" (include "kong.ingressVersion" .) -}}
+{{- $_ := set $serviceConfig "fullName" (include "kong.fullname" .) -}}
+{{- $_ := set $serviceConfig "namespace" (include "kong.namespace" .) -}}
+{{- $_ := set $serviceConfig "metaLabels" (include "kong.metaLabels" .) -}}
+{{- $_ := set $serviceConfig "selectorLabels" (include "kong.selectorLabels" .) -}}
+{{- $_ := set $serviceConfig "serviceName" "portalapi" -}}
+{{- include "kong.service" $serviceConfig }}
+{{ if .Values.portalapi.ingress.enabled }}
+---
+{{ include "kong.ingress" $serviceConfig }}
+{{- end -}}
+{{- end -}}
+{{- end -}}
 {{- end -}}