[COMMON] Apply changes for mariadb-init project 75/121075/27
authorMahmoud Abdelhamid <mahmoud.abdelhamid@orange.com>
Tue, 4 May 2021 15:52:04 +0000 (17:52 +0200)
committerSylvain Desbureaux <sylvain.desbureaux@orange.com>
Wed, 30 Jun 2021 06:36:38 +0000 (06:36 +0000)
Two changes are intended with this commit:
- (for proper name mapping) Update VolumeMounts names to be:
(mariadb-init for mountPath /db-init/)
(mariadb-conf for mountPath /db-conf/)
originally it was reversed.
- Make use of (common.mariadbService) and (common.mariadbPort) defined
in (common/templates/_mariadb.tpl) into job.yaml. This will reflect the
proper values for mariadb service name and port in case of local
installation.

Issue-ID: OOM-2737
Signed-off-by: Mahmoud Abdelhamid <mahmoud.abdelhamid@orange.com>
Change-Id: I303f8d5f56632289d8dfd2f2ba8c35819a4f871c

kubernetes/common/mariadb-init/templates/job.yaml

index ad97cd4..96d1dc5 100644 (file)
@@ -63,9 +63,9 @@ spec:
             /db_config/db_cmd.sh{{ end }}
         env:
         - name: DB_HOST
-          value: "{{ default .Values.global.mariadbGalera.nameOverride .Values.mariadbGalera.serviceName }}"
+          value: {{ include "common.mariadbService" . }}
         - name: DB_PORT
-          value: "{{ default .Values.global.mariadbGalera.servicePort .Values.mariadbGalera.servicePort }}"
+          value: {{ include "common.mariadbPort" . | quote }}
         - name: MYSQL_ROOT_PASSWORD
           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "root-password" "key" (default "password" .Values.global.mariadbGalera.userRootSecretKey)) | indent 10 }}
         - name: {{ printf "MYSQL_USER_%s" .Values.config.mysqlDatabase | upper }}
@@ -83,10 +83,10 @@ spec:
         - mountPath: /etc/localtime
           name: localtime
           readOnly: true
-        - name: mariadb-conf
+        - name: mariadb-init
           mountPath: /db_init/
 {{- if or .Values.dbScriptConfigMap .Values.dbScript }}
-        - name: mariadb-init
+        - name: mariadb-conf
           mountPath: /db_config/
 {{- end }}
         resources:
@@ -104,7 +104,7 @@ spec:
         hostPath:
           path: /etc/localtime
 {{- if  or .Values.dbScriptConfigMap .Values.dbScript }}
-      - name: mariadb-init
+      - name: mariadb-conf
         configMap:
 {{-   if  .Values.dbScriptConfigMap }}
           name: {{ tpl .Values.dbScriptConfigMap . }}
@@ -113,7 +113,7 @@ spec:
 {{-   end }}
           defaultMode: 0755
 {{- end }}
-      - name: mariadb-conf
+      - name: mariadb-init
         configMap:
           name: {{ include "mariadbInit.configMap" . }}
           defaultMode: 0755