[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/policy/charts/brmsgw/templates/deployment.yaml b/kubernetes/policy/charts/brmsgw/templates/deployment.yaml
index 7535d54..2b2f383 100644
--- a/kubernetes/policy/charts/brmsgw/templates/deployment.yaml
+++ b/kubernetes/policy/charts/brmsgw/templates/deployment.yaml
@@ -21,7 +21,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 }}
@@ -29,7 +29,7 @@
     metadata:
       labels:
         app: {{ include "common.name" . }}
-        release: {{ .Release.Name }}
+        release: {{ include "common.release" . }}
     spec:
       initContainers:
       - command:
@@ -100,11 +100,11 @@
             path: /etc/localtime
         - name: pe
           configMap:
-            name: {{ .Release.Name }}-pe-configmap
+            name: {{ include "common.release" . }}-pe-configmap
             defaultMode: 0755
         - name: pe-scripts
           configMap:
-            name: {{ .Release.Name }}-pe-scripts-configmap
+            name: {{ include "common.release" . }}-pe-scripts-configmap
             defaultMode: 0777
         - name: pe-brmsgw
           configMap:
diff --git a/kubernetes/policy/charts/brmsgw/templates/service.yaml b/kubernetes/policy/charts/brmsgw/templates/service.yaml
index d2f847c..7883651 100644
--- a/kubernetes/policy/charts/brmsgw/templates/service.yaml
+++ b/kubernetes/policy/charts/brmsgw/templates/service.yaml
@@ -21,7 +21,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 }}
@@ -37,4 +37,4 @@
     {{- end}}
   selector:
     app: {{ include "common.name" . }}
-    release: {{ .Release.Name }}
+    release: {{ include "common.release" . }}
diff --git a/kubernetes/policy/charts/drools/charts/nexus/templates/deployment.yaml b/kubernetes/policy/charts/drools/charts/nexus/templates/deployment.yaml
index 140e7f3..a9157f4 100644
--- a/kubernetes/policy/charts/drools/charts/nexus/templates/deployment.yaml
+++ b/kubernetes/policy/charts/drools/charts/nexus/templates/deployment.yaml
@@ -21,7 +21,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 }}
@@ -29,7 +29,7 @@
     metadata:
       labels:
         app: {{ include "common.name" . }}
-        release: {{ .Release.Name }}
+        release: {{ include "common.release" . }}
     spec:
       initContainers:
       - command: ["sh", "-c", "chown -R 200:200 /share"]
diff --git a/kubernetes/policy/charts/drools/charts/nexus/templates/pv.yaml b/kubernetes/policy/charts/drools/charts/nexus/templates/pv.yaml
index f45e9d4..62e66f1 100644
--- a/kubernetes/policy/charts/drools/charts/nexus/templates/pv.yaml
+++ b/kubernetes/policy/charts/drools/charts/nexus/templates/pv.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 }}"
     name: {{ include "common.fullname" . }}
 spec:
@@ -36,6 +36,6 @@
   persistentVolumeReclaimPolicy: {{ .Values.persistence.volumeReclaimPolicy }}
   storageClassName: "{{ include "common.fullname" . }}-data"
   hostPath:
-    path: {{ .Values.global.persistence.mountPath | default .Values.persistence.mountPath }}/{{ .Release.Name }}/{{ .Values.persistence.mountSubPath }}
+    path: {{ .Values.global.persistence.mountPath | default .Values.persistence.mountPath }}/{{ include "common.release" . }}/{{ .Values.persistence.mountSubPath }}
 {{- end -}}
 {{- end -}}
diff --git a/kubernetes/policy/charts/drools/charts/nexus/templates/pvc.yaml b/kubernetes/policy/charts/drools/charts/nexus/templates/pvc.yaml
index a082319..1cadcc5 100644
--- a/kubernetes/policy/charts/drools/charts/nexus/templates/pvc.yaml
+++ b/kubernetes/policy/charts/drools/charts/nexus/templates/pvc.yaml
@@ -24,7 +24,7 @@
   labels:
     app: {{ include "common.name" . }}
     chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
-    release: "{{ .Release.Name }}"
+    release: "{{ include "common.release" . }}"
     heritage: "{{ .Release.Service }}"
 {{- if .Values.persistence.annotations }}
   annotations:
diff --git a/kubernetes/policy/charts/drools/charts/nexus/templates/service.yaml b/kubernetes/policy/charts/drools/charts/nexus/templates/service.yaml
index d2f847c..7883651 100644
--- a/kubernetes/policy/charts/drools/charts/nexus/templates/service.yaml
+++ b/kubernetes/policy/charts/drools/charts/nexus/templates/service.yaml
@@ -21,7 +21,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 }}
@@ -37,4 +37,4 @@
     {{- end}}
   selector:
     app: {{ include "common.name" . }}
-    release: {{ .Release.Name }}
+    release: {{ include "common.release" . }}
diff --git a/kubernetes/policy/charts/drools/templates/secrets.yaml b/kubernetes/policy/charts/drools/templates/secrets.yaml
index 31ba543..47e0b8c 100644
--- a/kubernetes/policy/charts/drools/templates/secrets.yaml
+++ b/kubernetes/policy/charts/drools/templates/secrets.yaml
@@ -21,7 +21,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:
diff --git a/kubernetes/policy/charts/drools/templates/service.yaml b/kubernetes/policy/charts/drools/templates/service.yaml
index 8a17007..9f4ad9b 100644
--- a/kubernetes/policy/charts/drools/templates/service.yaml
+++ b/kubernetes/policy/charts/drools/templates/service.yaml
@@ -21,7 +21,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 }}
@@ -43,4 +43,4 @@
     {{- end}}
   selector:
     app: {{ include "common.name" . }}
-    release: {{ .Release.Name }}
+    release: {{ include "common.release" . }}
diff --git a/kubernetes/policy/charts/drools/templates/statefulset.yaml b/kubernetes/policy/charts/drools/templates/statefulset.yaml
index 9f9ca35..047a77a 100644
--- a/kubernetes/policy/charts/drools/templates/statefulset.yaml
+++ b/kubernetes/policy/charts/drools/templates/statefulset.yaml
@@ -21,7 +21,7 @@
   labels:
     app: {{ include "common.name" . }}
     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
-    release: {{ .Release.Name }}
+    release: {{ include "common.release" . }}
     heritage: {{ .Release.Service }}
 spec:
   serviceName: {{ include "common.servicename" . }}
@@ -33,14 +33,14 @@
     metadata:
       labels:
         app: {{ include "common.name" . }}
-        release: {{ .Release.Name }}
+        release: {{ include "common.release" . }}
     spec:
       initContainers:
       - command:
         - /root/ready.py
         args:
         - --container-name
-        - {{ .Release.Name }}-galera-config
+        - {{ include "common.release" . }}-galera-config
         - --container-name
         - {{ .Values.global.nexus.nameOverride }}
         env:
@@ -117,7 +117,7 @@
             path: /etc/localtime
         - name: filebeat-conf
           configMap:
-            name: {{ .Release.Name }}-filebeat-configmap
+            name: {{ include "common.release" . }}-filebeat-configmap
         - name: policy-logs
           emptyDir: {}
         - name: policy-data-filebeat
diff --git a/kubernetes/policy/charts/pdp/templates/service.yaml b/kubernetes/policy/charts/pdp/templates/service.yaml
index 2f1ecca..864676a 100644
--- a/kubernetes/policy/charts/pdp/templates/service.yaml
+++ b/kubernetes/policy/charts/pdp/templates/service.yaml
@@ -21,7 +21,7 @@
   labels:
     app: {{ include "common.name" . }}
     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
-    release: {{ .Release.Name }}
+    release: {{ include "common.release" . }}
     heritage: {{ .Release.Service }}
   annotations:
     msb.onap.org/service-info: '[
@@ -48,6 +48,6 @@
     {{- end}}
   selector:
     app: {{ include "common.name" . }}
-    release: {{ .Release.Name }}
+    release: {{ include "common.release" . }}
   sessionAffinity: None
   clusterIP: None
diff --git a/kubernetes/policy/charts/pdp/templates/statefulset.yaml b/kubernetes/policy/charts/pdp/templates/statefulset.yaml
index a3a8f6a..127c400 100644
--- a/kubernetes/policy/charts/pdp/templates/statefulset.yaml
+++ b/kubernetes/policy/charts/pdp/templates/statefulset.yaml
@@ -21,7 +21,7 @@
   labels:
     app: {{ include "common.name" . }}
     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
-    release: {{ .Release.Name }}
+    release: {{ include "common.release" . }}
     heritage: {{ .Release.Service }}
 spec:
   serviceName: {{ include "common.servicename" . }}
@@ -33,7 +33,7 @@
     metadata:
       labels:
         app: {{ include "common.name" . }}
-        release: {{ .Release.Name }}
+        release: {{ include "common.release" . }}
     spec:
       initContainers:
       - command:
@@ -119,7 +119,7 @@
           path: /etc/localtime
       - name: filebeat-conf
         configMap:
-          name: {{ .Release.Name }}-filebeat-configmap
+          name: {{ include "common.release" . }}-filebeat-configmap
       - name: policy-logs
         emptyDir: {}
       - name: policy-data-filebeat
@@ -129,11 +129,11 @@
           name: {{ include "common.fullname" . }}-log-configmap
       - name: pe
         configMap:
-          name: {{ .Release.Name }}-pe-configmap
+          name: {{ include "common.release" . }}-pe-configmap
           defaultMode: 0755
       - name: pe-scripts
         configMap:
-          name: {{ .Release.Name }}-pe-scripts-configmap
+          name: {{ include "common.release" . }}-pe-scripts-configmap
           defaultMode: 0777
       - name: pe-pdp
         configMap:
diff --git a/kubernetes/policy/charts/policy-apex-pdp/templates/service.yaml b/kubernetes/policy/charts/policy-apex-pdp/templates/service.yaml
index c90d76e..adbd5ed 100644
--- a/kubernetes/policy/charts/policy-apex-pdp/templates/service.yaml
+++ b/kubernetes/policy/charts/policy-apex-pdp/templates/service.yaml
@@ -24,7 +24,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 }}
@@ -40,5 +40,5 @@
     {{- end}}
   selector:
     app: {{ include "common.name" . }}
-    release: {{ .Release.Name }}
+    release: {{ include "common.release" . }}
   sessionAffinity: None
diff --git a/kubernetes/policy/charts/policy-apex-pdp/templates/statefulset.yaml b/kubernetes/policy/charts/policy-apex-pdp/templates/statefulset.yaml
index 9ab1e05..4d35509 100644
--- a/kubernetes/policy/charts/policy-apex-pdp/templates/statefulset.yaml
+++ b/kubernetes/policy/charts/policy-apex-pdp/templates/statefulset.yaml
@@ -24,7 +24,7 @@
   labels:
     app: {{ include "common.name" . }}
     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
-    release: {{ .Release.Name }}
+    release: {{ include "common.release" . }}
     heritage: {{ .Release.Service }}
 spec:
   serviceName: {{ include "common.servicename" . }}
@@ -36,7 +36,7 @@
     metadata:
       labels:
         app: {{ include "common.name" . }}
-        release: {{ .Release.Name }}
+        release: {{ include "common.release" . }}
     spec:
       containers:
         - name: {{ include "common.name" . }}
diff --git a/kubernetes/policy/charts/policy-api/templates/deployment.yaml b/kubernetes/policy/charts/policy-api/templates/deployment.yaml
index 505ba89..25e80d0 100644
--- a/kubernetes/policy/charts/policy-api/templates/deployment.yaml
+++ b/kubernetes/policy/charts/policy-api/templates/deployment.yaml
@@ -6,7 +6,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 }}
@@ -14,14 +14,14 @@
     metadata:
       labels:
         app: {{ include "common.name" . }}
-        release: {{ .Release.Name }}
+        release: {{ include "common.release" . }}
     spec:
       initContainers:
         - command:
           - /root/ready.py
           args:
           - --container-name
-          - {{ .Release.Name }}-galera-config
+          - {{ include "common.release" . }}-galera-config
           env:
           - name: NAMESPACE
             valueFrom:
diff --git a/kubernetes/policy/charts/policy-api/templates/service.yaml b/kubernetes/policy/charts/policy-api/templates/service.yaml
index e6ff6fb..fba02c8 100644
--- a/kubernetes/policy/charts/policy-api/templates/service.yaml
+++ b/kubernetes/policy/charts/policy-api/templates/service.yaml
@@ -24,7 +24,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 }}
@@ -40,4 +40,4 @@
     {{- end}}
   selector:
     app: {{ include "common.name" . }}
-    release: {{ .Release.Name }}
+    release: {{ include "common.release" . }}
diff --git a/kubernetes/policy/charts/policy-common/templates/configmap.yaml b/kubernetes/policy/charts/policy-common/templates/configmap.yaml
index dab9672..4aed509 100644
--- a/kubernetes/policy/charts/policy-common/templates/configmap.yaml
+++ b/kubernetes/policy/charts/policy-common/templates/configmap.yaml
@@ -16,7 +16,7 @@
 apiVersion: v1
 kind: ConfigMap
 metadata:
-  name: {{ .Release.Name }}-pe-configmap
+  name: {{ include "common.release" . }}-pe-configmap
   namespace: {{ include "common.namespace" . }}
 data:
 {{ tpl (.Files.Glob "resources/config/pe/*").AsConfig . | indent 2 }}
@@ -24,7 +24,7 @@
 apiVersion: v1
 kind: ConfigMap
 metadata:
-  name: {{ .Release.Name }}-pe-scripts-configmap
+  name: {{ include "common.release" . }}-pe-scripts-configmap
   namespace: {{ include "common.namespace" . }}
 data:
 {{ tpl (.Files.Glob "resources/config/scripts/do-start.sh").AsConfig . | indent 2 }}
@@ -32,7 +32,7 @@
 apiVersion: v1
 kind: ConfigMap
 metadata:
-  name: {{ .Release.Name }}-filebeat-configmap
+  name: {{ include "common.release" . }}-filebeat-configmap
   namespace: {{ include "common.namespace" . }}
 data:
 {{ tpl (.Files.Glob "resources/config/log/filebeat/filebeat.yml").AsConfig . | indent 2 }}
diff --git a/kubernetes/policy/charts/policy-distribution/templates/deployment.yaml b/kubernetes/policy/charts/policy-distribution/templates/deployment.yaml
index d6a6d21..65961d8 100644
--- a/kubernetes/policy/charts/policy-distribution/templates/deployment.yaml
+++ b/kubernetes/policy/charts/policy-distribution/templates/deployment.yaml
@@ -6,7 +6,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 }}
@@ -14,7 +14,7 @@
     metadata:
       labels:
         app: {{ include "common.name" . }}
-        release: {{ .Release.Name }}
+        release: {{ include "common.release" . }}
     spec:
       containers:
         - name: {{ include "common.name" . }}
diff --git a/kubernetes/policy/charts/policy-distribution/templates/service.yaml b/kubernetes/policy/charts/policy-distribution/templates/service.yaml
index 5108c55..9619d0c 100644
--- a/kubernetes/policy/charts/policy-distribution/templates/service.yaml
+++ b/kubernetes/policy/charts/policy-distribution/templates/service.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 }}
 spec:
   ports:
@@ -34,4 +34,4 @@
       name: {{ .Values.service.portName }}
   selector:
     app: {{ include "common.name" . }}
-    release: {{ .Release.Name }}
+    release: {{ include "common.release" . }}
diff --git a/kubernetes/policy/charts/policy-pap/templates/deployment.yaml b/kubernetes/policy/charts/policy-pap/templates/deployment.yaml
index a3adfee..caef521 100644
--- a/kubernetes/policy/charts/policy-pap/templates/deployment.yaml
+++ b/kubernetes/policy/charts/policy-pap/templates/deployment.yaml
@@ -6,7 +6,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 }}
@@ -14,7 +14,7 @@
     metadata:
       labels:
         app: {{ include "common.name" . }}
-        release: {{ .Release.Name }}
+        release: {{ include "common.release" . }}
     spec:
       initContainers:
       - command:
diff --git a/kubernetes/policy/charts/policy-pap/templates/service.yaml b/kubernetes/policy/charts/policy-pap/templates/service.yaml
index 6df7781..a23352a 100644
--- a/kubernetes/policy/charts/policy-pap/templates/service.yaml
+++ b/kubernetes/policy/charts/policy-pap/templates/service.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 }}
 spec:
   ports:
@@ -34,4 +34,4 @@
       name: {{ .Values.service.portName }}
   selector:
     app: {{ include "common.name" . }}
-    release: {{ .Release.Name }}
+    release: {{ include "common.release" . }}
diff --git a/kubernetes/policy/charts/policy-xacml-pdp/templates/deployment.yaml b/kubernetes/policy/charts/policy-xacml-pdp/templates/deployment.yaml
index ced19b9..57e7c78 100644
--- a/kubernetes/policy/charts/policy-xacml-pdp/templates/deployment.yaml
+++ b/kubernetes/policy/charts/policy-xacml-pdp/templates/deployment.yaml
@@ -6,7 +6,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 }}
@@ -14,14 +14,14 @@
     metadata:
       labels:
         app: {{ include "common.name" . }}
-        release: {{ .Release.Name }}
+        release: {{ include "common.release" . }}
     spec:
       initContainers:
       - command:
         - /root/ready.py
         args:
         - --container-name
-        - {{ .Release.Name }}-galera-config
+        - {{ include "common.release" . }}-galera-config
         env:
         - name: NAMESPACE
           valueFrom:
diff --git a/kubernetes/policy/charts/policy-xacml-pdp/templates/service.yaml b/kubernetes/policy/charts/policy-xacml-pdp/templates/service.yaml
index c02dbfd..33b990f 100644
--- a/kubernetes/policy/charts/policy-xacml-pdp/templates/service.yaml
+++ b/kubernetes/policy/charts/policy-xacml-pdp/templates/service.yaml
@@ -24,7 +24,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 }}
@@ -34,4 +34,4 @@
       name: {{ .Values.service.portName }}
   selector:
     app: {{ include "common.name" . }}
-    release: {{ .Release.Name }}
+    release: {{ include "common.release" . }}