[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/sdc/charts/sdc-onboarding-be/templates/configmap.yaml b/kubernetes/sdc/charts/sdc-onboarding-be/templates/configmap.yaml
index 03eb04e..ea50099 100644
--- a/kubernetes/sdc/charts/sdc-onboarding-be/templates/configmap.yaml
+++ b/kubernetes/sdc/charts/sdc-onboarding-be/templates/configmap.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 }}
 data:
 {{ tpl (.Files.Glob "resources/config/logging/*").AsConfig . | indent 2 }}
diff --git a/kubernetes/sdc/charts/sdc-onboarding-be/templates/deployment.yaml b/kubernetes/sdc/charts/sdc-onboarding-be/templates/deployment.yaml
index dee139b..78b1116 100644
--- a/kubernetes/sdc/charts/sdc-onboarding-be/templates/deployment.yaml
+++ b/kubernetes/sdc/charts/sdc-onboarding-be/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:
       - name: {{ include "common.name" . }}-job-completion
@@ -39,7 +39,7 @@
         - /root/job_complete.py
         args:
         - --job-name
-        - {{ .Release.Name }}-sdc-onboarding-be-cassandra-init
+        - {{ include "common.release" . }}-sdc-onboarding-be-cassandra-init
         env:
         - name: NAMESPACE
           valueFrom:
@@ -86,10 +86,10 @@
                 fieldPath: status.podIP
           - name: SDC_USER
             valueFrom:
-              secretKeyRef: {name: {{ .Release.Name }}-sdc-cs-secrets, key: sdc_user}
+              secretKeyRef: {name: {{ include "common.release" . }}-sdc-cs-secrets, key: sdc_user}
           - name: SDC_PASSWORD
             valueFrom:
-              secretKeyRef: {name: {{ .Release.Name }}-sdc-cs-secrets, key: sdc_password}
+              secretKeyRef: {name: {{ include "common.release" . }}-sdc-cs-secrets, key: sdc_password}
           - name: SDC_CERT_DIR
             value: {{ .Values.cert.certDir }}
           volumeMounts:
@@ -127,7 +127,7 @@
           path: /etc/localtime
       - name: {{ include "common.fullname" . }}-filebeat-conf
         configMap:
-          name: {{ .Release.Name }}-sdc-filebeat-configmap
+          name: {{ include "common.release" . }}-sdc-filebeat-configmap
       - name: {{ include "common.fullname" . }}-data-filebeat
         emptyDir: {}
       - name: {{ include "common.fullname" . }}-logback
@@ -135,7 +135,7 @@
           name : {{ include "common.fullname" . }}-logging-configmap
       - name: {{ include "common.fullname" . }}-environments
         configMap:
-          name: {{ .Release.Name }}-sdc-environments-configmap
+          name: {{ include "common.release" . }}-sdc-environments-configmap
           defaultMode: 0755
       - name:  {{ include "common.fullname" . }}-logs
         emptyDir: {}
diff --git a/kubernetes/sdc/charts/sdc-onboarding-be/templates/job.yaml b/kubernetes/sdc/charts/sdc-onboarding-be/templates/job.yaml
index 8d56f0a..1167614 100644
--- a/kubernetes/sdc/charts/sdc-onboarding-be/templates/job.yaml
+++ b/kubernetes/sdc/charts/sdc-onboarding-be/templates/job.yaml
@@ -21,7 +21,7 @@
   labels:
     app: {{ include "common.name" . }}-job
     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
-    release: {{ .Release.Name }}
+    release: {{ include "common.release" . }}
     heritage: {{ .Release.Service }}
 spec:
   backoffLimit: 20
@@ -29,7 +29,7 @@
     metadata:
       labels:
         app: {{ include "common.name" . }}-job
-        release: {{ .Release.Name }}
+        release: {{ include "common.release" . }}
     spec:
       restartPolicy: Never
       initContainers:
@@ -40,7 +40,7 @@
         - /root/job_complete.py
         args:
         - --job-name
-        - {{ .Release.Name }}-sdc-cs-config-cassandra
+        - {{ include "common.release" . }}-sdc-cs-config-cassandra
         env:
         - name: NAMESPACE
           valueFrom:
@@ -63,19 +63,19 @@
               fieldPath: status.podIP
         - name: SDC_USER
           valueFrom:
-            secretKeyRef: {name: {{ .Release.Name }}-sdc-cs-secrets, key: sdc_user}
+            secretKeyRef: {name: {{ include "common.release" . }}-sdc-cs-secrets, key: sdc_user}
         - name: SDC_PASSWORD
           valueFrom:
-            secretKeyRef: {name: {{ .Release.Name }}-sdc-cs-secrets, key: sdc_password}
+            secretKeyRef: {name: {{ include "common.release" . }}-sdc-cs-secrets, key: sdc_password}
         - name: CS_PASSWORD
           valueFrom:
-            secretKeyRef: {name: {{ .Release.Name }}-sdc-cs-secrets, key: cs_password}
+            secretKeyRef: {name: {{ include "common.release" . }}-sdc-cs-secrets, key: cs_password}
         - name: CS_HOST_IP
           value: "{{ .Values.global.cassandra.serviceName }}"
       volumes:
       - name: {{ include "common.fullname" . }}-environments
         configMap:
-          name: {{ .Release.Name }}-sdc-environments-configmap
+          name: {{ include "common.release" . }}-sdc-environments-configmap
           defaultMode: 0755
       imagePullSecrets:
       - name: "{{ include "common.namespace" . }}-docker-registry-key"
diff --git a/kubernetes/sdc/charts/sdc-onboarding-be/templates/pv.yaml b/kubernetes/sdc/charts/sdc-onboarding-be/templates/pv.yaml
index 70f6d95..bc110c3 100644
--- a/kubernetes/sdc/charts/sdc-onboarding-be/templates/pv.yaml
+++ b/kubernetes/sdc/charts/sdc-onboarding-be/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.cert.persistence.volumeReclaimPolicy }}
   storageClassName: "{{ include "common.fullname" . }}-data"
   hostPath:
-    path: {{ .Values.global.persistence.mountPath | default .Values.persistence.mountPath }}/{{ .Release.Name }}/{{ .Values.cert.persistence.mountSubPath }}
+    path: {{ .Values.global.persistence.mountPath | default .Values.persistence.mountPath }}/{{ include "common.release" . }}/{{ .Values.cert.persistence.mountSubPath }}
 {{- end -}}
 {{- end -}}
diff --git a/kubernetes/sdc/charts/sdc-onboarding-be/templates/pvc.yaml b/kubernetes/sdc/charts/sdc-onboarding-be/templates/pvc.yaml
index 662370d..006d736 100644
--- a/kubernetes/sdc/charts/sdc-onboarding-be/templates/pvc.yaml
+++ b/kubernetes/sdc/charts/sdc-onboarding-be/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.cert.persistence.annotations }}
   annotations:
diff --git a/kubernetes/sdc/charts/sdc-onboarding-be/templates/service.yaml b/kubernetes/sdc/charts/sdc-onboarding-be/templates/service.yaml
index a72ce76..ad6650a 100644
--- a/kubernetes/sdc/charts/sdc-onboarding-be/templates/service.yaml
+++ b/kubernetes/sdc/charts/sdc-onboarding-be/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 }}
@@ -44,4 +44,4 @@
     {{- end}}
   selector:
     app: {{ include "common.name" . }}
-    release: {{ .Release.Name }}
+    release: {{ include "common.release" . }}