[ONAP-wide] Replace .Release.Name with common.release

ONAP is too big to be deployed using helm install so we need to
use a custom helm plugin helm deploy. This script deloys onap
component by component instead of deploying evrything at
once. Unfortunately this script also modifies the helm release by
appending component name to it.

As a result of this behavior our objects are called for example:

onap-mariadb-galera-mariadb-galera-0

instead of just being called onap-mariadb-galera-0.

This patch simplifies this naming convention by replacing all direct
usages of .Release.Name with common.release macro which strips the
component specific part from the release name.

Issue-ID: OOM-2275
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Change-Id: Ia8cead50d305adb00eef666d0a1ace74479b5183
diff --git a/kubernetes/oof/charts/oof-cmso/charts/oof-cmso-optimizer/templates/configmap.yaml b/kubernetes/oof/charts/oof-cmso/charts/oof-cmso-optimizer/templates/configmap.yaml
index c439735..e4d0a5c 100644
--- a/kubernetes/oof/charts/oof-cmso/charts/oof-cmso-optimizer/templates/configmap.yaml
+++ b/kubernetes/oof/charts/oof-cmso/charts/oof-cmso-optimizer/templates/configmap.yaml
@@ -20,7 +20,7 @@
   labels:
     app: {{ include "common.name" . }}
     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
-    release: {{ .Release.Name }}
+    release: {{ include "common.release" . }}
     heritage: {{ .Release.Service }}
 data:
 {{ tpl (.Files.Glob "resources/config/*").AsConfig . | indent 2 }}
diff --git a/kubernetes/oof/charts/oof-cmso/charts/oof-cmso-optimizer/templates/deployment.yaml b/kubernetes/oof/charts/oof-cmso/charts/oof-cmso-optimizer/templates/deployment.yaml
index e28dfca..0e6b4c8 100644
--- a/kubernetes/oof/charts/oof-cmso/charts/oof-cmso-optimizer/templates/deployment.yaml
+++ b/kubernetes/oof/charts/oof-cmso/charts/oof-cmso-optimizer/templates/deployment.yaml
@@ -20,7 +20,7 @@
   labels:
     app: {{ include "common.name" . }}
     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
-    release: {{ .Release.Name }}
+    release: {{ include "common.release" . }}
     heritage: {{ .Release.Service }}
 spec:
   replicas: {{ .Values.replicaCount }}
@@ -28,7 +28,7 @@
     metadata:
       labels:
         app: {{ include "common.name" . }}
-        release: {{ .Release.Name }}
+        release: {{ include "common.release" . }}
     spec:
       initContainers:
       - command:
@@ -60,7 +60,7 @@
         - name: DB_PASSWORD
           valueFrom:
             secretKeyRef:
-              name: {{ .Release.Name}}-cmso-db
+              name: {{ include "common.release" . }}-cmso-db
               key: db-root-password
         terminationMessagePolicy: File
         volumeMounts:
@@ -84,7 +84,7 @@
         - name: DB_PASSWORD
           valueFrom:
             secretKeyRef:
-              name: {{ .Release.Name}}-cmso-db
+              name: {{ include "common.release" . }}-cmso-db
               key: db-root-password
         - name: JAVA_TRUSTSTORE
           value: /share/etc/certs/{{ .Values.global.truststoreFile }}
@@ -150,6 +150,6 @@
           emptyDir: {}
         - name: {{ include "common.fullname" . }}-certs
           secret:
-            secretName: {{ .Release.Name }}-{{ .Values.global.commonConfigPrefix }}-certs
+            secretName: {{ include "common.release" . }}-{{ .Values.global.commonConfigPrefix }}-certs
       imagePullSecrets:
       - name: "{{ include "common.namespace" . }}-docker-registry-key"
diff --git a/kubernetes/oof/charts/oof-cmso/charts/oof-cmso-optimizer/templates/service.yaml b/kubernetes/oof/charts/oof-cmso/charts/oof-cmso-optimizer/templates/service.yaml
index 1624a08..d0b586a 100644
--- a/kubernetes/oof/charts/oof-cmso/charts/oof-cmso-optimizer/templates/service.yaml
+++ b/kubernetes/oof/charts/oof-cmso/charts/oof-cmso-optimizer/templates/service.yaml
@@ -20,7 +20,7 @@
   labels:
     app: {{ include "common.name" . }}
     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
-    release: {{ .Release.Name }}
+    release: {{ include "common.release" . }}
     heritage: {{ .Release.Service }}
 spec:
   type: {{ .Values.service.type }}
@@ -36,4 +36,4 @@
     {{- end}}
   selector:
     app: {{ include "common.name" . }}
-    release: {{ .Release.Name }}
+    release: {{ include "common.release" . }}
diff --git a/kubernetes/oof/charts/oof-cmso/charts/oof-cmso-service/templates/configmap.yaml b/kubernetes/oof/charts/oof-cmso/charts/oof-cmso-service/templates/configmap.yaml
index c439735..e4d0a5c 100644
--- a/kubernetes/oof/charts/oof-cmso/charts/oof-cmso-service/templates/configmap.yaml
+++ b/kubernetes/oof/charts/oof-cmso/charts/oof-cmso-service/templates/configmap.yaml
@@ -20,7 +20,7 @@
   labels:
     app: {{ include "common.name" . }}
     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
-    release: {{ .Release.Name }}
+    release: {{ include "common.release" . }}
     heritage: {{ .Release.Service }}
 data:
 {{ tpl (.Files.Glob "resources/config/*").AsConfig . | indent 2 }}
diff --git a/kubernetes/oof/charts/oof-cmso/charts/oof-cmso-service/templates/deployment.yaml b/kubernetes/oof/charts/oof-cmso/charts/oof-cmso-service/templates/deployment.yaml
index 1b17ed2..e7b5eed 100644
--- a/kubernetes/oof/charts/oof-cmso/charts/oof-cmso-service/templates/deployment.yaml
+++ b/kubernetes/oof/charts/oof-cmso/charts/oof-cmso-service/templates/deployment.yaml
@@ -20,7 +20,7 @@
   labels:
     app: {{ include "common.name" . }}
     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
-    release: {{ .Release.Name }}
+    release: {{ include "common.release" . }}
     heritage: {{ .Release.Service }}
 spec:
   replicas: {{ .Values.replicaCount }}
@@ -28,7 +28,7 @@
     metadata:
       labels:
         app: {{ include "common.name" . }}
-        release: {{ .Release.Name }}
+        release: {{ include "common.release" . }}
     spec:
       initContainers:
       - command:
@@ -60,7 +60,7 @@
         - name: DB_PASSWORD
           valueFrom:
             secretKeyRef:
-              name: {{ .Release.Name}}-cmso-db
+              name: {{ include "common.release" . }}-cmso-db
               key: db-root-password
         terminationMessagePolicy: File
         volumeMounts:
@@ -108,7 +108,7 @@
         - name: DB_PASSWORD
           valueFrom:
             secretKeyRef:
-              name: {{ .Release.Name}}-cmso-db
+              name: {{ include "common.release" . }}-cmso-db
               key: user-password
         - name: JAVA_TRUSTSTORE
           value: /share/etc/certs/{{ .Values.global.truststoreFile }}
@@ -180,9 +180,9 @@
           emptyDir: {}
         - name: filebeat-conf
           configMap:
-            name: {{ .Release.Name }}-cmso-filebeat-configmap
+            name: {{ include "common.release" . }}-cmso-filebeat-configmap
         - name: {{ include "common.fullname" . }}-certs
           secret:
-            secretName: {{ .Release.Name }}-{{ .Values.global.commonConfigPrefix }}-certs
+            secretName: {{ include "common.release" . }}-{{ .Values.global.commonConfigPrefix }}-certs
       imagePullSecrets:
       - name: "{{ include "common.namespace" . }}-docker-registry-key"
diff --git a/kubernetes/oof/charts/oof-cmso/charts/oof-cmso-service/templates/service.yaml b/kubernetes/oof/charts/oof-cmso/charts/oof-cmso-service/templates/service.yaml
index 1624a08..d0b586a 100644
--- a/kubernetes/oof/charts/oof-cmso/charts/oof-cmso-service/templates/service.yaml
+++ b/kubernetes/oof/charts/oof-cmso/charts/oof-cmso-service/templates/service.yaml
@@ -20,7 +20,7 @@
   labels:
     app: {{ include "common.name" . }}
     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
-    release: {{ .Release.Name }}
+    release: {{ include "common.release" . }}
     heritage: {{ .Release.Service }}
 spec:
   type: {{ .Values.service.type }}
@@ -36,4 +36,4 @@
     {{- end}}
   selector:
     app: {{ include "common.name" . }}
-    release: {{ .Release.Name }}
+    release: {{ include "common.release" . }}
diff --git a/kubernetes/oof/charts/oof-cmso/charts/oof-cmso-ticketmgt/templates/configmap.yaml b/kubernetes/oof/charts/oof-cmso/charts/oof-cmso-ticketmgt/templates/configmap.yaml
index c439735..e4d0a5c 100644
--- a/kubernetes/oof/charts/oof-cmso/charts/oof-cmso-ticketmgt/templates/configmap.yaml
+++ b/kubernetes/oof/charts/oof-cmso/charts/oof-cmso-ticketmgt/templates/configmap.yaml
@@ -20,7 +20,7 @@
   labels:
     app: {{ include "common.name" . }}
     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
-    release: {{ .Release.Name }}
+    release: {{ include "common.release" . }}
     heritage: {{ .Release.Service }}
 data:
 {{ tpl (.Files.Glob "resources/config/*").AsConfig . | indent 2 }}
diff --git a/kubernetes/oof/charts/oof-cmso/charts/oof-cmso-ticketmgt/templates/deployment.yaml b/kubernetes/oof/charts/oof-cmso/charts/oof-cmso-ticketmgt/templates/deployment.yaml
index 38a8c92..53d1b26 100644
--- a/kubernetes/oof/charts/oof-cmso/charts/oof-cmso-ticketmgt/templates/deployment.yaml
+++ b/kubernetes/oof/charts/oof-cmso/charts/oof-cmso-ticketmgt/templates/deployment.yaml
@@ -20,7 +20,7 @@
   labels:
     app: {{ include "common.name" . }}
     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
-    release: {{ .Release.Name }}
+    release: {{ include "common.release" . }}
     heritage: {{ .Release.Service }}
 spec:
   replicas: {{ .Values.replicaCount }}
@@ -28,7 +28,7 @@
     metadata:
       labels:
         app: {{ include "common.name" . }}
-        release: {{ .Release.Name }}
+        release: {{ include "common.release" . }}
     spec:
       containers:
       - name: {{ include "common.name" . }}
@@ -97,6 +97,6 @@
           emptyDir: {}
         - name: {{ include "common.fullname" . }}-certs
           secret:
-            secretName: {{ .Release.Name }}-{{ .Values.global.commonConfigPrefix }}-certs
+            secretName: {{ include "common.release" . }}-{{ .Values.global.commonConfigPrefix }}-certs
       imagePullSecrets:
       - name: "{{ include "common.namespace" . }}-docker-registry-key"
diff --git a/kubernetes/oof/charts/oof-cmso/charts/oof-cmso-ticketmgt/templates/service.yaml b/kubernetes/oof/charts/oof-cmso/charts/oof-cmso-ticketmgt/templates/service.yaml
index 1624a08..d0b586a 100644
--- a/kubernetes/oof/charts/oof-cmso/charts/oof-cmso-ticketmgt/templates/service.yaml
+++ b/kubernetes/oof/charts/oof-cmso/charts/oof-cmso-ticketmgt/templates/service.yaml
@@ -20,7 +20,7 @@
   labels:
     app: {{ include "common.name" . }}
     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
-    release: {{ .Release.Name }}
+    release: {{ include "common.release" . }}
     heritage: {{ .Release.Service }}
 spec:
   type: {{ .Values.service.type }}
@@ -36,4 +36,4 @@
     {{- end}}
   selector:
     app: {{ include "common.name" . }}
-    release: {{ .Release.Name }}
+    release: {{ include "common.release" . }}
diff --git a/kubernetes/oof/charts/oof-cmso/charts/oof-cmso-topology/templates/configmap.yaml b/kubernetes/oof/charts/oof-cmso/charts/oof-cmso-topology/templates/configmap.yaml
index c439735..e4d0a5c 100644
--- a/kubernetes/oof/charts/oof-cmso/charts/oof-cmso-topology/templates/configmap.yaml
+++ b/kubernetes/oof/charts/oof-cmso/charts/oof-cmso-topology/templates/configmap.yaml
@@ -20,7 +20,7 @@
   labels:
     app: {{ include "common.name" . }}
     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
-    release: {{ .Release.Name }}
+    release: {{ include "common.release" . }}
     heritage: {{ .Release.Service }}
 data:
 {{ tpl (.Files.Glob "resources/config/*").AsConfig . | indent 2 }}
diff --git a/kubernetes/oof/charts/oof-cmso/charts/oof-cmso-topology/templates/deployment.yaml b/kubernetes/oof/charts/oof-cmso/charts/oof-cmso-topology/templates/deployment.yaml
index 2b36b29..8cc4a98 100644
--- a/kubernetes/oof/charts/oof-cmso/charts/oof-cmso-topology/templates/deployment.yaml
+++ b/kubernetes/oof/charts/oof-cmso/charts/oof-cmso-topology/templates/deployment.yaml
@@ -20,7 +20,7 @@
   labels:
     app: {{ include "common.name" . }}
     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
-    release: {{ .Release.Name }}
+    release: {{ include "common.release" . }}
     heritage: {{ .Release.Service }}
 spec:
   replicas: {{ .Values.replicaCount }}
@@ -28,7 +28,7 @@
     metadata:
       labels:
         app: {{ include "common.name" . }}
-        release: {{ .Release.Name }}
+        release: {{ include "common.release" . }}
     spec:
       containers:
       - name: {{ include "common.name" . }}
@@ -97,6 +97,6 @@
           emptyDir: {}
         - name: {{ include "common.fullname" . }}-certs
           secret:
-            secretName: {{ .Release.Name }}-{{ .Values.global.commonConfigPrefix }}-certs
+            secretName: {{ include "common.release" . }}-{{ .Values.global.commonConfigPrefix }}-certs
       imagePullSecrets:
       - name: "{{ include "common.namespace" . }}-docker-registry-key"
diff --git a/kubernetes/oof/charts/oof-cmso/charts/oof-cmso-topology/templates/service.yaml b/kubernetes/oof/charts/oof-cmso/charts/oof-cmso-topology/templates/service.yaml
index 1624a08..d0b586a 100644
--- a/kubernetes/oof/charts/oof-cmso/charts/oof-cmso-topology/templates/service.yaml
+++ b/kubernetes/oof/charts/oof-cmso/charts/oof-cmso-topology/templates/service.yaml
@@ -20,7 +20,7 @@
   labels:
     app: {{ include "common.name" . }}
     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
-    release: {{ .Release.Name }}
+    release: {{ include "common.release" . }}
     heritage: {{ .Release.Service }}
 spec:
   type: {{ .Values.service.type }}
@@ -36,4 +36,4 @@
     {{- end}}
   selector:
     app: {{ include "common.name" . }}
-    release: {{ .Release.Name }}
+    release: {{ include "common.release" . }}
diff --git a/kubernetes/oof/charts/oof-cmso/templates/configmap.yaml b/kubernetes/oof/charts/oof-cmso/templates/configmap.yaml
index f906fac..f4a7962 100644
--- a/kubernetes/oof/charts/oof-cmso/templates/configmap.yaml
+++ b/kubernetes/oof/charts/oof-cmso/templates/configmap.yaml
@@ -16,12 +16,12 @@
 apiVersion: v1
 kind: ConfigMap
 metadata:
-  name: {{ .Release.Name }}-cmso-filebeat-configmap
+  name: {{ include "common.release" . }}-cmso-filebeat-configmap
   namespace: {{ include "common.namespace" . }}
   labels:
     app: {{ include "common.name" . }}
     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
-    release: {{ .Release.Name }}
+    release: {{ include "common.release" . }}
     heritage: {{ .Release.Service }}
 data:
 {{ tpl (.Files.Glob "resources/log/filebeat/*").AsConfig . | indent 2 }}
diff --git a/kubernetes/oof/charts/oof-cmso/templates/secret.yaml b/kubernetes/oof/charts/oof-cmso/templates/secret.yaml
index a742914..11a9221 100644
--- a/kubernetes/oof/charts/oof-cmso/templates/secret.yaml
+++ b/kubernetes/oof/charts/oof-cmso/templates/secret.yaml
@@ -20,7 +20,7 @@
   labels:
     app: {{ include "common.name" . }}
     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
-    release: {{ .Release.Name }}
+    release: {{ include "common.release" . }}
     heritage: {{ .Release.Service }}
 type: Opaque
 data: