From 119996aff1ca26ba83b513778085c8dd43e94759 Mon Sep 17 00:00:00 2001 From: Abhi Date: Fri, 28 Mar 2025 17:07:17 +0530 Subject: [PATCH] [MOSIP-39715] Updated db_scripts for mimoto Signed-off-by: Abhi --- .../templates/inji-mimoto-env-configmap.yaml | 23 +++++++++ .../templates/inji-mimoto-job.yaml | 47 +++++++++++++++++++ helm/postgres-init/values.yaml | 13 +++++ 3 files changed, 83 insertions(+) create mode 100644 helm/postgres-init/templates/inji-mimoto-env-configmap.yaml create mode 100644 helm/postgres-init/templates/inji-mimoto-job.yaml diff --git a/helm/postgres-init/templates/inji-mimoto-env-configmap.yaml b/helm/postgres-init/templates/inji-mimoto-env-configmap.yaml new file mode 100644 index 0000000..93a60f9 --- /dev/null +++ b/helm/postgres-init/templates/inji-mimoto-env-configmap.yaml @@ -0,0 +1,23 @@ +{{- if .Values.databases.inji_mimoto.enabled }} +apiVersion: v1 +kind: ConfigMap +metadata: + name: db-mimoto-init-env-config + namespace: {{ .Release.Namespace }} + labels: {{- include "common.labels.standard" . | nindent 4 }} + app.kubernetes.io/component: postgres + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + {{- if .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} +data: + MOSIP_DB_NAME: inji_mimoto + DB_SERVERIP: {{ .Values.databases.inji_mimoto.host | quote }} + DB_PORT: {{ .Values.databases.inji_mimoto.port | quote }} + SU_USER: {{ .Values.databases.inji_mimoto.su.user | quote }} + DML_FLAG: {{ .Values.databases.inji_mimoto.dml | quote }} + GIT_REPO_URL: {{ .Values.databases.inji_mimoto.repoUrl | quote }} + GIT_BRANCH: {{ .Values.databases.inji_mimoto.branch | quote }} + {{- end }} \ No newline at end of file diff --git a/helm/postgres-init/templates/inji-mimoto-job.yaml b/helm/postgres-init/templates/inji-mimoto-job.yaml new file mode 100644 index 0000000..a8f8876 --- /dev/null +++ b/helm/postgres-init/templates/inji-mimoto-job.yaml @@ -0,0 +1,47 @@ +{{- if .Values.databases.inji_mimoto.enabled }} +apiVersion: batch/v1 +kind: Job +metadata: + name: db-mimoto-init-job + labels: + {{- include "postgres-init.labels" . | nindent 4 }} +spec: + backoffLimit: 0 + template: + metadata: + labels: + {{- include "postgres-init.selectorLabels" . | nindent 8 }} + app.kubernetes.io/name: db-mimoto-init-job + sidecar.istio.io/inject: "false" + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "postgres-init.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.jobSecurityContext | nindent 8 }} + restartPolicy: Never # This is one time job + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + env: + - name: SU_USER_PWD + valueFrom: + secretKeyRef: + name: {{ .Values.databases.inji_mimoto.su.secret.name }} + key: {{ .Values.databases.inji_mimoto.su.secret.key }} + + - name: DBUSER_PWD + valueFrom: + secretKeyRef: + name: db-common-secrets + key: db-dbuser-password + + envFrom: + - configMapRef: + name: db-mimoto-init-env-config + {{- end }} \ No newline at end of file diff --git a/helm/postgres-init/values.yaml b/helm/postgres-init/values.yaml index e847b18..1d5ad1d 100644 --- a/helm/postgres-init/values.yaml +++ b/helm/postgres-init/values.yaml @@ -347,3 +347,16 @@ databases: dml: 1 repoUrl: https://github.com/mosip/inji-verify.git branch: develop + + inji_mimoto: + enabled: false + host: "postgres-postgresql" + port: 5432 + su: + user: postgres + secret: + name: postgres-postgresql + key: postgres-password + dml: 1 + repoUrl: https://github.com/mosip/mimoto.git + branch: develop