[ONAP-wide] Replace .Release.Name with common.release
[oom.git] / kubernetes / common / mariadb-galera / templates / backup / cronjob.yaml
index 7d3ec75..69a8490 100644 (file)
@@ -1,5 +1,5 @@
 {{/*
-# Copyright © 2019 Amdocs, Bell Canada
+# Copyright © 2019 Amdocs, Bell Canada, Samsung Electronics
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -22,7 +22,7 @@ metadata:
   labels:
     app: {{ include "common.fullname" . }}
     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
-    release: {{ .Release.Name }}
+    release: {{ include "common.release" . }}
     heritage: {{ .Release.Service }}
 spec:
   schedule: {{ .Values.backup.cron | quote }}
@@ -86,25 +86,17 @@ spec:
               echo "Backup Successful!!!"
             env:
             - name: DB_PASS
-              valueFrom:
-                secretKeyRef:
-                  name: {{ include "common.fullname" . }}
-                  key: db-root-password
+              {{- include "common.secret.envFromSecret" (dict "global" . "uid" "db-root-password" "key" "password") | indent 14}}
             volumeMounts:
-            - name: backup-data
+            - name: backup-dir
               mountPath: /backup
-            - name: db-data
-              mountPath: /var/lib/mysql
           containers:
           - name: mariadb-backup-validate
             image: "{{ include "common.repository" . }}/{{ .Values.backupImage }}"
             imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
             env:
             - name: MYSQL_ROOT_PASSWORD
-              valueFrom:
-                secretKeyRef:
-                  name: {{ include "common.fullname" . }}
-                  key: db-root-password
+              {{- include "common.secret.envFromSecret" (dict "global" . "uid" "db-root-password" "key" "password") | indent 14}}
             command:
             - /bin/bash
             - -c
@@ -130,7 +122,7 @@ spec:
                 remove_dir $target_dir
                 exit 0
               fi
-              
+
               /docker-entrypoint.sh mysqld &
 
               count=0
@@ -163,16 +155,13 @@ spec:
             - mountPath: /etc/localtime
               name: localtime
               readOnly: true
-            - name: backup-data
+            - name: backup-dir
               mountPath: /backup
           volumes:
           - name: localtime
             hostPath:
               path: /etc/localtime
-          - name: db-data
-            persistentVolumeClaim:
-              claimName: {{ include "common.fullname" . }}-db-data
-          - name: backup-data
+          - name: backup-dir
             persistentVolumeClaim:
-              claimName: {{ include "common.fullname" . }}-backup 
+              claimName: {{ include "common.fullname" . }}-backup-data
 {{- end }}