Fix Incorrect AAI services

Change-Id: If4b17c3525a75530aa6b149a6901cb0d8737a8d0
Issue-ID: OOM-1102
Signed-off-by: BorislavG <Borislav.Glozman@amdocs.com>
diff --git a/charts/aai-babel/values.yaml b/charts/aai-babel/values.yaml
index 1e74e35..7118d16 100644
--- a/charts/aai-babel/values.yaml
+++ b/charts/aai-babel/values.yaml
@@ -53,7 +53,7 @@
 service:
   type: NodePort
   portName: babel
-  externalPort: 79
+  externalPort: 9516
   internalPort: 9516
   nodePort: 79
 
diff --git a/charts/aai-champ/values.yaml b/charts/aai-champ/values.yaml
index 7849418..13cc9e7 100644
--- a/charts/aai-champ/values.yaml
+++ b/charts/aai-champ/values.yaml
@@ -52,8 +52,7 @@
 
 service:
   type: NodePort
-  name: champ
-  portName: champ
+  portName: aai-champ
   internalPort: 9522
   nodePort: 78
 
diff --git a/charts/aai-gizmo/values.yaml b/charts/aai-gizmo/values.yaml
index 0e982d8..1ea924f 100644
--- a/charts/aai-gizmo/values.yaml
+++ b/charts/aai-gizmo/values.yaml
@@ -50,8 +50,8 @@
 
 service:
   type: NodePort
-  name: crud-service
-  portName: crud-service
+  name: aai-crud-service
+  portName: aai-crud-service
   internalPort: 9520
   nodePort: 68
 
diff --git a/charts/aai-hbase/templates/service.yaml b/charts/aai-hbase/templates/service.yaml
index c503e6c..53c5e5f 100644
--- a/charts/aai-hbase/templates/service.yaml
+++ b/charts/aai-hbase/templates/service.yaml
@@ -1,7 +1,7 @@
 apiVersion: v1
 kind: Service
 metadata:
-  name: {{ include "common.name" . }}
+  name: {{ include "common.servicename" . }}
   namespace: {{ include "common.namespace" . }}
   labels:
     app: {{ include "common.name" . }}
diff --git a/charts/aai-modelloader/templates/service.yaml b/charts/aai-modelloader/templates/service.yaml
index bd59edb..4bfe787 100644
--- a/charts/aai-modelloader/templates/service.yaml
+++ b/charts/aai-modelloader/templates/service.yaml
@@ -1,7 +1,7 @@
 apiVersion: v1
 kind: Service
 metadata:
-  name: {{ include "common.name" . }}
+  name: {{ include "common.servicename" . }}
   namespace: {{ include "common.namespace" . }}
   labels:
     app: {{ include "common.name" . }}
@@ -14,15 +14,15 @@
   {{if eq .Values.service.type "NodePort" -}}
   - port: {{ .Values.service.internalPort }}
     nodePort: {{ .Values.global.nodePortPrefix | default .Values.nodePortPrefix }}{{ .Values.service.nodePort }}
-    name: {{ .Values.service.name }}
+    name: {{ .Values.service.portName }}
   - port: {{ .Values.service.internalPort2 }}
     nodePort: {{ .Values.global.nodePortPrefix | default .Values.nodePortPrefix }}{{ .Values.service.nodePort2 }}
-    name: {{ .Values.service.name }}2
+    name: {{ .Values.service.portName2 }}
   {{- else -}}
   - port: {{ .Values.service.internalPort }}
-    name: {{ .Values.service.name }}
+    name: {{ .Values.service.portName }}
   - port: {{ .Values.service.internalPort2 }}
-    name: {{ .Values.service.name }}2
+    name: {{ .Values.service.portName2 }}
   {{- end}}
   selector:
     app: {{ include "common.name" . }}
diff --git a/charts/aai-modelloader/values.yaml b/charts/aai-modelloader/values.yaml
index a5095ad..676fc6f 100644
--- a/charts/aai-modelloader/values.yaml
+++ b/charts/aai-modelloader/values.yaml
@@ -35,10 +35,11 @@
 
 service:
   type: NodePort
-  name: aai-modelloader
+  portName: aai-modelloader
   externalPort: 8080
   internalPort: 8080
   nodePort: 10
+  portName2: aai-modelloader-ssl
   externalPort2: 8443
   internalPort2: 8443
   nodePort2: 29
diff --git a/charts/aai-search-data/templates/service.yaml b/charts/aai-search-data/templates/service.yaml
index 41bc163..e342a9a 100644
--- a/charts/aai-search-data/templates/service.yaml
+++ b/charts/aai-search-data/templates/service.yaml
@@ -1,7 +1,7 @@
 apiVersion: v1
 kind: Service
 metadata:
-  name: {{ include "common.name" . }}
+  name: {{ include "common.servicename" . }}
   namespace: {{ include "common.namespace" . }}
   labels:
     app: {{ include "common.name" . }}
@@ -14,10 +14,10 @@
   {{if eq .Values.service.type "NodePort" -}}
   - port: {{ .Values.service.internalPort }}
     nodePort: {{ .Values.global.nodePortPrefix | default .Values.nodePortPrefix }}{{ .Values.service.nodePort }}
-    name: {{ .Values.service.name }}
+    name: {{ .Values.service.portName }}
   {{- else -}}
   - port: {{ .Values.service.internalPort }}
-    name: {{ .Values.service.name }}
+    name: {{ .Values.service.portName }}
   {{- end}}
   selector:
     app: {{ include "common.name" . }}
diff --git a/charts/aai-search-data/values.yaml b/charts/aai-search-data/values.yaml
index 4e47d37..c6f42bd 100644
--- a/charts/aai-search-data/values.yaml
+++ b/charts/aai-search-data/values.yaml
@@ -41,7 +41,7 @@
 
 service:
   type: ClusterIP
-  name: aai-search-data
+  portName: aai-search-data
   internalPort: 9509
 
 ingress:
diff --git a/charts/aai-sparky-be/templates/service.yaml b/charts/aai-sparky-be/templates/service.yaml
index e97935a..e342a9a 100644
--- a/charts/aai-sparky-be/templates/service.yaml
+++ b/charts/aai-sparky-be/templates/service.yaml
@@ -14,10 +14,10 @@
   {{if eq .Values.service.type "NodePort" -}}
   - port: {{ .Values.service.internalPort }}
     nodePort: {{ .Values.global.nodePortPrefix | default .Values.nodePortPrefix }}{{ .Values.service.nodePort }}
-    name: {{ .Values.service.name }}
+    name: {{ .Values.service.portName }}
   {{- else -}}
   - port: {{ .Values.service.internalPort }}
-    name: {{ .Values.service.name }}
+    name: {{ .Values.service.portName }}
   {{- end}}
   selector:
     app: {{ include "common.name" . }}
diff --git a/charts/aai-sparky-be/values.yaml b/charts/aai-sparky-be/values.yaml
index 91c4026..b9ef4ca 100644
--- a/charts/aai-sparky-be/values.yaml
+++ b/charts/aai-sparky-be/values.yaml
@@ -4,7 +4,7 @@
 global: # global defaults
   nodePortPrefix: 302
   aai:
-    serviceName: aai-aai
+    serviceName: aai
   aaiElasticsearch:
     serviceName: aai-elasticsearch
   gizmo:
@@ -62,7 +62,7 @@
 
 service:
   type: ClusterIP
-  name: aai-sparky-be
+  portName: aai-sparky-be
   internalPort: 9517
   internalPort2: 8000
 
diff --git a/templates/service.yaml b/templates/service.yaml
index d21ac7e..a2f96a8 100644
--- a/templates/service.yaml
+++ b/templates/service.yaml
@@ -1,7 +1,7 @@
 apiVersion: v1
 kind: Service
 metadata:
-  name: {{ include "common.name" . }}
+  name: {{ include "common.servicename" . }}
   namespace: {{ include "common.namespace" . }}
   labels:
     app: {{ include "common.name" . }}
@@ -11,23 +11,23 @@
 spec:
   ports:
   {{if eq .Values.service.type "NodePort" -}}
-  - name: {{ .Values.service.name }}
-    port: {{ .Values.service.internalPort }}
+  - name: {{ .Values.service.portName }}
+    port: {{ .Values.service.externalPort }}
     targetPort: {{ .Values.service.internalPort }}
     nodePort: {{ .Values.global.nodePortPrefix | default .Values.nodePortPrefix }}{{ .Values.service.nodePort }}
-  - name: {{ .Values.service.name }}2
-    port: {{ .Values.service.internalPort2 }}
+  - name: {{ .Values.service.portName2 }}
+    port: {{ .Values.service.externalPort2 }}
     targetPort: {{ .Values.service.internalPort2 }}
     nodePort: {{ .Values.global.nodePortPrefix | default .Values.nodePortPrefix }}{{ .Values.service.nodePort2 }}
   {{- else -}}
   - port: {{ .Values.service.externalPort }}
     targetPort: {{ .Values.service.internalPort }}
-    name: {{ .Values.service.name }}
+    name: {{ .Values.service.portName }}
   - port: {{ .Values.service.externalPort2 }}
     targetPort: {{ .Values.service.internalPort2 }}
-    name: {{ .Values.service.name }}2
+    name: {{ .Values.service.portName }}
   {{- end}}
   type: {{ .Values.service.type }}
   selector:
     app: {{ include "common.name" . }}
-  clusterIP: {{ .Values.config.aaiServiceClusterIp }}
+  clusterIP: {{ .Values.service.aaiServiceClusterIp }}
diff --git a/values.yaml b/values.yaml
index 153379b..2b0180e 100644
--- a/values.yaml
+++ b/values.yaml
@@ -29,7 +29,7 @@
     serviceName: aai-cassandra
     replicas: 3
   aai:
-    serviceName: aai-aai
+    serviceName: aai
   babel:
     serviceName: aai-babel
   champ:
@@ -64,9 +64,6 @@
 
 # application configuration
 config:
-  # POLICY hotfix - Note this must be temporary
-  # See https://jira.onap.org/browse/POLICY-510
-  aaiServiceClusterIp:
   logstashServiceName: log-ls
   logstashPort: 5044
 
@@ -91,13 +88,17 @@
 
 service:
   type: NodePort
-  name: aai
+  portName: aai
   externalPort: 8080
   internalPort: 8080
   nodePort: 32
+  portName2: aai-ssl
   externalPort2: 8443
   internalPort2: 8443
   nodePort2: 33
+  # POLICY hotfix - Note this must be temporary
+  # See https://jira.onap.org/browse/POLICY-510
+  aaiServiceClusterIp:
 
 ingress:
   enabled: false