[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/msb/charts/kube2msb/templates/deployment.yaml b/kubernetes/msb/charts/kube2msb/templates/deployment.yaml
index 455eae0..472bbc7 100644
--- a/kubernetes/msb/charts/kube2msb/templates/deployment.yaml
+++ b/kubernetes/msb/charts/kube2msb/templates/deployment.yaml
@@ -19,7 +19,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 }}
@@ -27,7 +27,7 @@
     metadata:
       labels:
         app: {{ include "common.name" . }}
-        release: {{ .Release.Name }}
+        release: {{ include "common.release" . }}
       annotations:
         sidecar.istio.io/inject: "{{.Values.istioSidecar}}"
     spec:
diff --git a/kubernetes/msb/charts/msb-consul/templates/deployment.yaml b/kubernetes/msb/charts/msb-consul/templates/deployment.yaml
index 5b8ceae..d36c395 100644
--- a/kubernetes/msb/charts/msb-consul/templates/deployment.yaml
+++ b/kubernetes/msb/charts/msb-consul/templates/deployment.yaml
@@ -19,7 +19,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 }}
@@ -27,7 +27,7 @@
     metadata:
       labels:
         app: {{ include "common.name" . }}
-        release: {{ .Release.Name }}
+        release: {{ include "common.release" . }}
       annotations:
         sidecar.istio.io/inject: "{{.Values.istioSidecar}}"
     spec:
diff --git a/kubernetes/msb/charts/msb-consul/templates/service.yaml b/kubernetes/msb/charts/msb-consul/templates/service.yaml
index 49539fe..787c68e 100644
--- a/kubernetes/msb/charts/msb-consul/templates/service.yaml
+++ b/kubernetes/msb/charts/msb-consul/templates/service.yaml
@@ -19,7 +19,7 @@
   labels:
     app: {{ include "common.name" . }}
     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
-    release: {{ .Release.Name }}
+    release: {{ include "common.release" . }}
     heritage: {{ .Release.Service }}
   annotations:
 spec:
@@ -36,4 +36,4 @@
     {{- end}}
   selector:
     app: {{ include "common.name" . }}
-    release: {{ .Release.Name }}
+    release: {{ include "common.release" . }}
diff --git a/kubernetes/msb/charts/msb-discovery/templates/deployment.yaml b/kubernetes/msb/charts/msb-discovery/templates/deployment.yaml
index eb99c94..923ad1f 100644
--- a/kubernetes/msb/charts/msb-discovery/templates/deployment.yaml
+++ b/kubernetes/msb/charts/msb-discovery/templates/deployment.yaml
@@ -19,7 +19,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 }}
@@ -27,7 +27,7 @@
     metadata:
       labels:
         app: {{ include "common.name" . }}
-        release: {{ .Release.Name }}
+        release: {{ include "common.release" . }}
       annotations:
         sidecar.istio.io/inject: "{{.Values.istioSidecar}}"
     spec:
@@ -108,7 +108,7 @@
             name: {{ include "common.fullname" . }}-log
         - name: {{ include "common.fullname" . }}-filebeat-conf
           configMap:
-            name: {{ .Release.Name }}-msb-filebeat-configmap
+            name: {{ include "common.release" . }}-msb-filebeat-configmap
         - name: {{ include "common.fullname" . }}-data-filebeat
           emptyDir: {}
         - name:  {{ include "common.fullname" . }}-logs
diff --git a/kubernetes/msb/charts/msb-discovery/templates/service.yaml b/kubernetes/msb/charts/msb-discovery/templates/service.yaml
index 49539fe..787c68e 100644
--- a/kubernetes/msb/charts/msb-discovery/templates/service.yaml
+++ b/kubernetes/msb/charts/msb-discovery/templates/service.yaml
@@ -19,7 +19,7 @@
   labels:
     app: {{ include "common.name" . }}
     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
-    release: {{ .Release.Name }}
+    release: {{ include "common.release" . }}
     heritage: {{ .Release.Service }}
   annotations:
 spec:
@@ -36,4 +36,4 @@
     {{- end}}
   selector:
     app: {{ include "common.name" . }}
-    release: {{ .Release.Name }}
+    release: {{ include "common.release" . }}
diff --git a/kubernetes/msb/charts/msb-eag/templates/deployment.yaml b/kubernetes/msb/charts/msb-eag/templates/deployment.yaml
index 6cfcef2..fd16a0c 100644
--- a/kubernetes/msb/charts/msb-eag/templates/deployment.yaml
+++ b/kubernetes/msb/charts/msb-eag/templates/deployment.yaml
@@ -19,7 +19,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 }}
@@ -27,7 +27,7 @@
     metadata:
       labels:
         app: {{ include "common.name" . }}
-        release: {{ .Release.Name }}
+        release: {{ include "common.release" . }}
       annotations:
         sidecar.istio.io/inject: "{{.Values.istioSidecar}}"
     spec:
@@ -114,7 +114,7 @@
             name: {{ include "common.fullname" . }}-log
         - name: {{ include "common.fullname" . }}-filebeat-conf
           configMap:
-            name: {{ .Release.Name }}-msb-filebeat-configmap
+            name: {{ include "common.release" . }}-msb-filebeat-configmap
         - name: {{ include "common.fullname" . }}-data-filebeat
           emptyDir: {}
         - name:  {{ include "common.fullname" . }}-logs
diff --git a/kubernetes/msb/charts/msb-eag/templates/service.yaml b/kubernetes/msb/charts/msb-eag/templates/service.yaml
index bc5e661..ad2addf 100644
--- a/kubernetes/msb/charts/msb-eag/templates/service.yaml
+++ b/kubernetes/msb/charts/msb-eag/templates/service.yaml
@@ -19,7 +19,7 @@
   labels:
     app: {{ include "common.name" . }}
     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
-    release: {{ .Release.Name }}
+    release: {{ include "common.release" . }}
     heritage: {{ .Release.Service }}
   annotations:
 spec:
@@ -39,4 +39,4 @@
     {{- end}}
   selector:
     app: {{ include "common.name" . }}
-    release: {{ .Release.Name }}
+    release: {{ include "common.release" . }}
diff --git a/kubernetes/msb/charts/msb-iag/templates/deployment.yaml b/kubernetes/msb/charts/msb-iag/templates/deployment.yaml
index 21d5d00..8975a32 100644
--- a/kubernetes/msb/charts/msb-iag/templates/deployment.yaml
+++ b/kubernetes/msb/charts/msb-iag/templates/deployment.yaml
@@ -19,7 +19,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 }}
@@ -27,7 +27,7 @@
     metadata:
       labels:
         app: {{ include "common.name" . }}
-        release: {{ .Release.Name }}
+        release: {{ include "common.release" . }}
       annotations:
         sidecar.istio.io/inject: "{{.Values.istioSidecar}}"
     spec:
@@ -114,7 +114,7 @@
             name: {{ include "common.fullname" . }}-log
         - name: {{ include "common.fullname" . }}-filebeat-conf
           configMap:
-            name: {{ .Release.Name }}-msb-filebeat-configmap
+            name: {{ include "common.release" . }}-msb-filebeat-configmap
         - name: {{ include "common.fullname" . }}-data-filebeat
           emptyDir: {}
         - name:  {{ include "common.fullname" . }}-logs
diff --git a/kubernetes/msb/charts/msb-iag/templates/service.yaml b/kubernetes/msb/charts/msb-iag/templates/service.yaml
index bc5e661..ad2addf 100644
--- a/kubernetes/msb/charts/msb-iag/templates/service.yaml
+++ b/kubernetes/msb/charts/msb-iag/templates/service.yaml
@@ -19,7 +19,7 @@
   labels:
     app: {{ include "common.name" . }}
     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
-    release: {{ .Release.Name }}
+    release: {{ include "common.release" . }}
     heritage: {{ .Release.Service }}
   annotations:
 spec:
@@ -39,4 +39,4 @@
     {{- end}}
   selector:
     app: {{ include "common.name" . }}
-    release: {{ .Release.Name }}
+    release: {{ include "common.release" . }}
diff --git a/kubernetes/msb/templates/configmap.yaml b/kubernetes/msb/templates/configmap.yaml
index dba46a6..e71397b 100644
--- a/kubernetes/msb/templates/configmap.yaml
+++ b/kubernetes/msb/templates/configmap.yaml
@@ -14,7 +14,7 @@
 apiVersion: v1
 kind: ConfigMap
 metadata:
-  name: {{ .Release.Name }}-msb-filebeat-configmap
+  name: {{ include "common.release" . }}-msb-filebeat-configmap
   namespace: {{ include "common.namespace" . }}
 data:
 {{ tpl (.Files.Glob "resources/config/log/filebeat/filebeat.yml").AsConfig . | indent 2 }}
diff --git a/kubernetes/msb/templates/serviceaccout.yaml b/kubernetes/msb/templates/serviceaccout.yaml
index 560987b..c1e1a33 100644
--- a/kubernetes/msb/templates/serviceaccout.yaml
+++ b/kubernetes/msb/templates/serviceaccout.yaml
@@ -25,7 +25,7 @@
   labels:
     app: {{ include "common.name" . }}
     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
-    release: {{ .Release.Name }}
+    release: {{ include "common.release" . }}
     heritage: {{ .Release.Service }}
 roleRef:
   apiGroup: rbac.authorization.k8s.io