[AAI] Add AAI http service for DCAE Service Mesh patch
[oom.git] / kubernetes / aai / templates / service.yaml
index a9b3af9..aecb687 100644 (file)
@@ -26,17 +26,34 @@ metadata:
     heritage: {{ .Release.Service }}
 spec:
   ports:
-  {{if eq .Values.service.type "NodePort" -}}
-  - name: {{ .Values.service.portName }}
-    port: {{ .Values.service.externalPort }}
-    targetPort: {{ .Values.service.internalPort }}
+  - name: {{ .Values.service.portName }}{{ if (include "common.needTLS" .) }}s{{ end }}
+    port: {{ (eq "true" (include "common.needTLS" .)) | ternary .Values.service.externalPort .Values.service.externalPlainPort }}
+    targetPort: {{ (eq "true" (include "common.needTLS" .)) | ternary .Values.service.internalPort .Values.service.internalPlainPort }}
+    {{- if eq .Values.service.type "NodePort" }}
     nodePort: {{ .Values.global.nodePortPrefix | default .Values.nodePortPrefix }}{{ .Values.service.nodePort }}
-  {{- else -}}
-  - port: {{ .Values.service.externalPort }}
-    targetPort: {{ .Values.service.internalPort }}
-    name: {{ .Values.service.portName }}
-  {{- end}}
+    {{- end }}
   type: {{ .Values.service.type }}
   selector:
     app: {{ include "common.name" . }}
-  clusterIP: {{ .Values.service.aaiServiceClusterIp }}
+{{- if include "common.onServiceMesh" . }}
+---
+apiVersion: v1
+kind: Service
+metadata:
+  name: {{ include "common.servicename" . }}-internal
+  namespace: {{ include "common.namespace" . }}
+  labels:
+    app: {{ include "common.name" . }}
+    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
+    release: {{ include "common.release" . }}
+    heritage: {{ .Release.Service }}
+spec:
+  ports:
+    - name: {{ .Values.service.portName }}
+      port: {{ .Values.service.externalPlainPort }}
+      targetPort: {{ .Values.service.internalPlainPort }}
+  type: ClusterIP
+  selector:
+    app: {{ include "common.name" . }}
+{{- end }}
+