[GENERAL] Use readiness container v3.0.1
[oom.git] / kubernetes / so / charts / so-mariadb / templates / job.yaml
old mode 100755 (executable)
new mode 100644 (file)
index a20564e..838c10f
@@ -20,7 +20,7 @@ metadata:
   labels:
     app: {{ include "common.name" . }}
     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
-    release: {{ .Release.Name }}
+    release: {{ include "common.release" . }}
     heritage: {{ .Release.Service }}
   annotations:
     "helm.sh/hook": pre-upgrade,pre-install
@@ -32,7 +32,7 @@ spec:
     metadata:
       labels:
         app: {{ include "common.name" . }}
-        release: {{ .Release.Name }}
+        release: {{ include "common.release" . }}
       name: {{ include "common.name" . }}
     spec:
       containers:
@@ -43,14 +43,11 @@ spec:
         - name: DB_HOST
           value: {{ .Values.global.migration.dbHost }}
         - name: DB_USER
-          value: {{ .Values.global.migration.dbUser }}
+          {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-backup-creds" "key" "login") | indent 10 }}
         - name: DB_PORT
           value: "{{ .Values.global.migration.dbPort }}"
         - name: DB_PASS
-          valueFrom:
-            secretKeyRef:
-              name: {{ template "common.fullname" . }}-migration
-              key: db-root-password-backup
+          {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-backup-creds" "key" "password") | indent 10 }}
         command:
         - /bin/bash
         - -c
@@ -81,7 +78,7 @@ metadata:
   labels:
     app: {{ include "common.name" . }}
     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
-    release: {{ .Release.Name }}
+    release: {{ include "common.release" . }}
     heritage: {{ .Release.Service }}
   annotations:
     "helm.sh/hook": post-upgrade,post-rollback,post-install
@@ -93,13 +90,13 @@ spec:
     metadata:
       labels:
         app: {{ include "common.name" . }}-job
-        release: {{ .Release.Name }}
+        release: {{ include "common.release" . }}
       name: {{ include "common.name" . }}
     spec:
       initContainers:
       - name: {{ include "common.name" . }}-readiness
         command:
-        - /root/ready.py
+        - /app/ready.py
         args:
         - --container-name
         - {{ .Values.global.mariadbGalera.nameOverride }}
@@ -109,23 +106,8 @@ spec:
             fieldRef:
               apiVersion: v1
               fieldPath: metadata.namespace
-        image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
-        imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
-      - name: {{ include "common.name" . }}-inject-testlab-project
-        command:
-        - /bin/bash
-        - -c
-        - >
-          git clone -b {{ .Values.config.gerritBranch }} --single-branch {{ .Values.config.gerritProject }} /tmp/gerrit;
-          echo "Clone complete. Copying from /tmp/gerrit/volumes/mariadb/docker-entrypoint-initdb.d to /docker-entrypoint-initdb.d";
-          cp -rf /tmp/gerrit/volumes/mariadb/docker-entrypoint-initdb.d/* /docker-entrypoint-initdb.d;
-          chmod -R 755 /docker-entrypoint-initdb.d;
-          echo "Done.";
-        image: "{{ .Values.global.ubuntuInitRepository }}/{{ .Values.ubuntuInitImage }}"
+        image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}"
         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
-        volumeMounts:
-        - name: docker-entrypoint-initdb-d
-          mountPath: "/docker-entrypoint-initdb.d"
       containers:
       - name: {{ include "common.name" . }}
         image: "{{ include "common.repository" . }}/{{ .Values.image }}"
@@ -145,24 +127,43 @@ spec:
         - name: DB_HOST
           valueFrom:
             secretKeyRef:
-              name: {{ .Release.Name}}-so-db-secrets
+              name: {{ include "common.release" . }}-so-db-secrets
               key: mariadb.readwrite.host
         - name: DB_PORT
           valueFrom:
             secretKeyRef:
-              name: {{ .Release.Name}}-so-db-secrets
+              name: {{ include "common.release" . }}-so-db-secrets
               key: mariadb.readwrite.port
         - name: MYSQL_ROOT_PASSWORD
-          valueFrom:
-            secretKeyRef:
-              name: {{ template "common.fullname" . }}
-              key: db-root-password
+          {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-root-pass" "key" "password") | indent 10 }}
+        - name: DB_USER
+          {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-user-creds" "key" "login") | indent 10 }}
+        - name: DB_PASSWORD
+          {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-user-creds" "key" "password") | indent 10 }}
+        - name: DB_ADMIN
+          {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-admin-creds" "key" "login") | indent 10 }}
+        - name: DB_ADMIN_PASSWORD
+          {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-admin-creds" "key" "password") | indent 10 }}
+        - name: CAMUNDA_DB_USER
+          {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "camunda-db-creds" "key" "login") | indent 10 }}
+        - name: CAMUNDA_DB_PASSWORD
+          {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "camunda-db-creds" "key" "password") | indent 10 }}
+        - name: REQUEST_DB_USER
+          {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "request-db-creds" "key" "login") | indent 10 }}
+        - name: REQUEST_DB_PASSWORD
+          {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "request-db-creds" "key" "password") | indent 10 }}
+        - name: CATALOG_DB_USER
+          {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "catalog-db-creds" "key" "login") | indent 10 }}
+        - name: CATALOG_DB_PASSWORD
+          {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "catalog-db-creds" "key" "password") | indent 10 }}
         volumeMounts:
         - mountPath: /etc/localtime
           name: localtime
           readOnly: true
-        - name: docker-entrypoint-initdb-d
+        - name: docker-entrypoint-initdb-d-sh
           mountPath: "/docker-entrypoint-initdb.d"
+        - name: docker-entrypoint-initdb-d-sql
+          mountPath: "/docker-entrypoint-initdb.d/db-sql-scripts"
         {{- if .Values.global.migration.enabled }}
         - name: backup-storage
           mountPath: /var/data/mariadb
@@ -181,8 +182,12 @@ spec:
       - name: localtime
         hostPath:
           path: /etc/localtime
-      - name: docker-entrypoint-initdb-d
-        emptyDir: {}
+      - name: docker-entrypoint-initdb-d-sh
+        configMap:
+          name: {{ include "common.fullname" . }}-mariadb-sh
+      - name: docker-entrypoint-initdb-d-sql
+        configMap:
+          name: {{ include "common.fullname" . }}-mariadb-sql
       {{- if .Values.global.migration.enabled }}
       - name: backup-storage
         persistentVolumeClaim: