DMAAP changes
[oom.git] / kubernetes / dmaap / components / message-router / charts / message-router-kafka / templates / service.yaml
index 88de96b..8200eda 100644 (file)
@@ -1,5 +1,4 @@
-# Copyright © 2017 Amdocs, Bell Canada
-# Modifications Copyright © 2018 AT&T
+# Copyright © 2019 AT&T
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+{{- $root := . -}}
+{{ range $i, $e := until (atoi (quote $root.Values.replicaCount) | default 3) }}
+---
 apiVersion: v1
 kind: Service
 metadata:
-  name: {{ .Values.service.name }}
-  namespace: {{ include "common.namespace" . }}
+  name: {{ $root.Values.service.name }}-{{ $i }}
+  namespace: {{ $root.Release.Namespace }}
   labels:
-    app: {{ include "common.name" . }}
-    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
-    release: {{ .Release.Name }}
-    heritage: {{ .Release.Service }}
+    app: {{ $root.Values.service.name }}
+    chart: {{ $root.Chart.Name }}-{{ $root.Chart.Version | replace "+" "_" }}
+    release: {{ $root.Release.Name }}
+    heritage: {{ $root.Release.Service }}
+
 spec:
-  type: {{ .Values.service.type }}
-  ports:
-    - port: {{ .Values.service.externalPort }}
-      targetPort: {{ .Values.service.internalPort }}
-      name: {{ .Values.service.portName }}
-  clusterIP: None
+  type: {{ $root.Values.service.type }} 
+  externalTrafficPolicy: Local
   selector:
-    app: {{ include "common.name" . }}
-    release: {{ .Release.Name }}
-
+   statefulset.kubernetes.io/pod-name: {{ $root.Release.Name }}-{{ $root.Values.service.name }}-{{ $i }}
+  ports:
+    - port: {{ $root.Values.service.externalPort }}
+      targetPort: {{ $root.Values.service.externalPort }}
+      nodePort: {{ $root.Values.service.baseNodePort  | add $i }}
+      name: {{ $root.Values.service.name }}-{{ $i }}
+{{ end }}