diff --git a/deploy/postgres-init-values.yaml b/deploy/postgres-init-values.yaml index 2ec0f86..adbfebf 100644 --- a/deploy/postgres-init-values.yaml +++ b/deploy/postgres-init-values.yaml @@ -4,72 +4,360 @@ dbUserPasswords: databases: mosip_master: enabled: true + scriptsDir: mosip_master # fixed - must match db_scripts/ folder in repo + dbName: mosip_master # customize e.g. mosip_master02 + dbUser: masteruser # customize e.g. masteruser02 + defaultDb: postgres + host: "postgres-postgresql" + port: 5432 + su: + user: postgres + secret: + name: postgres-postgresql + key: postgres-password + dml: 1 + repoUrl: https://github.com/mosip/admin-services.git branch: develop mosip_audit: enabled: true + scriptsDir: mosip_audit # fixed - must match db_scripts/ folder in repo + dbName: mosip_audit # customize e.g. mosip_audit02 + dbUser: audituser # customize e.g. audituser02 + defaultDb: postgres + host: "postgres-postgresql" + port: 5432 + su: + user: postgres + secret: + name: postgres-postgresql + key: postgres-password + dml: 0 + repoUrl: https://github.com/mosip/audit-manager.git branch: develop mosip_keymgr: - enabled: true + enabled: true + scriptsDir: mosip_keymgr # fixed - must match db_scripts/ folder in repo + dbName: mosip_keymgr # customize e.g. mosip_keymgr02 + dbUser: keymgruser # customize e.g. keymgruser02 + defaultDb: postgres + host: "postgres-postgresql" + port: 5432 + su: + user: postgres + secret: + name: postgres-postgresql + key: postgres-password + dml: 1 + repoUrl: https://github.com/mosip/keymanager.git branch: develop mosip_kernel: enabled: true + scriptsDir: mosip_kernel # fixed - must match db_scripts/ folder in repo + dbName: mosip_kernel # customize e.g. mosip_kernel02 + dbUser: kerneluser # customize e.g. kerneluser02 + defaultDb: postgres + host: "postgres-postgresql" + port: 5432 + su: + user: postgres + secret: + name: postgres-postgresql + key: postgres-password + dml: 0 + repoUrl: https://github.com/mosip/commons.git branch: develop mosip_idmap: enabled: true + scriptsDir: mosip_idmap # fixed - must match db_scripts/ folder in repo + dbName: mosip_idmap # customize e.g. mosip_idmap02 + dbUser: idmapuser # customize e.g. idmapuser02 + defaultDb: postgres + host: "postgres-postgresql" + port: 5432 + su: + user: postgres + secret: + name: postgres-postgresql + key: postgres-password + dml: 0 + repoUrl: https://github.com/mosip/id-repository.git branch: develop mosip_prereg: enabled: true + scriptsDir: mosip_prereg # fixed - must match db_scripts/ folder in repo + dbName: mosip_prereg # customize e.g. mosip_prereg02 + dbUser: prereguser # customize e.g. prereguser02 + defaultDb: postgres + host: "postgres-postgresql" + port: 5432 + su: + user: postgres + secret: + name: postgres-postgresql + key: postgres-password + dml: 0 + repoUrl: https://github.com/mosip/pre-registration.git branch: develop mosip_idrepo: enabled: true + scriptsDir: mosip_idrepo # fixed - must match db_scripts/ folder in repo + dbName: mosip_idrepo # customize e.g. mosip_idrepo02 + dbUser: idrepouser # customize e.g. idrepouser02 + defaultDb: postgres + host: "postgres-postgresql" + port: 5432 + su: + user: postgres + secret: + name: postgres-postgresql + key: postgres-password + dml: 0 + repoUrl: https://github.com/mosip/id-repository.git branch: develop mosip_ida: enabled: true + scriptsDir: mosip_ida # fixed - must match db_scripts/ folder in repo + dbName: mosip_ida # customize e.g. mosip_ida02 + dbUser: idauser # customize e.g. idauser02 + defaultDb: postgres + host: "postgres-postgresql" + port: 5432 + su: + user: postgres + secret: + name: postgres-postgresql + key: postgres-password + dml: 1 + repoUrl: https://github.com/mosip/id-authentication.git branch: develop mosip_credential: enabled: true + scriptsDir: mosip_credential # fixed - must match db_scripts/ folder in repo + dbName: mosip_credential # customize e.g. mosip_credential02 + dbUser: credentialuser # customize e.g. credentialuser02 + defaultDb: postgres + host: "postgres-postgresql" + port: 5432 + su: + user: postgres + secret: + name: postgres-postgresql + key: postgres-password + dml: 0 + repoUrl: https://github.com/mosip/id-repository.git branch: develop mosip_regprc: enabled: true + scriptsDir: mosip_regprc # fixed - must match db_scripts/ folder in repo + dbName: mosip_regprc # customize e.g. mosip_regprc02 + dbUser: regprcuser # customize e.g. regprcuser02 + defaultDb: postgres + host: "postgres-postgresql" + port: 5432 + su: + user: postgres + secret: + name: postgres-postgresql + key: postgres-password + dml: 1 + repoUrl: https://github.com/mosip/registration.git branch: develop mosip_pms: enabled: true + scriptsDir: mosip_pms # fixed - must match db_scripts/ folder in repo + dbName: mosip_pms # customize e.g. mosip_pms02 + dbUser: pmsuser # customize e.g. pmsuser02 + defaultDb: postgres + host: "postgres-postgresql" + port: 5432 + # Note: This flag is used to update datashare domain in partner policies according to deployment version (i.e v2/v3) + # Set flag ENV_VERSION_FLAG to true for v2 envs and false for v3 envs. + ENV_VERSION_FLAG: false + su: + user: postgres + secret: + name: postgres-postgresql + key: postgres-password + dml: 1 + repoUrl: https://github.com/mosip/partner-management-services.git branch: develop mosip_hotlist: enabled: true + scriptsDir: mosip_hotlist # fixed - must match db_scripts/ folder in repo + dbName: mosip_hotlist # customize e.g. mosip_hotlist02 + dbUser: hotlistuser # customize e.g. hotlistuser02 + defaultDb: postgres + host: "postgres-postgresql" + port: 5432 + su: + user: postgres + secret: + name: postgres-postgresql + key: postgres-password + dml: 0 + repoUrl: https://github.com/mosip/admin-services.git branch: develop mosip_resident: enabled: true + scriptsDir: mosip_resident # fixed - must match db_scripts/ folder in repo + dbName: mosip_resident # customize e.g. mosip_resident02 + dbUser: residentuser # customize e.g. residentuser02 + defaultDb: postgres + host: "postgres-postgresql" + port: 5432 + su: + user: postgres + secret: + name: postgres-postgresql + key: postgres-password + dml: 0 + repoUrl: https://github.com/mosip/resident-services.git branch: develop - mosip_otp: + mosip_toolkit: enabled: true + scriptsDir: mosip_toolkit # fixed - must match db_scripts/ folder in repo + dbName: mosip_toolkit # customize e.g. mosip_toolkit02 + dbUser: toolkituser # customize e.g. toolkituser02 + defaultDb: postgres + host: "postgres-postgresql" + port: 5432 + su: + user: postgres + secret: + name: postgres-postgresql + key: postgres-password + dml: 0 + repoUrl: https://github.com/mosip/mosip-compliance-toolkit.git branch: develop - mosip_toolkit: - enabled: false - branch: v1.3.2 - mosip_digitalcard: - enabled: false + enabled: true + scriptsDir: mosip_digitalcard # fixed - must match db_scripts/ folder in repo + dbName: mosip_digitalcard # customize e.g. mosip_digitalcard02 + dbUser: digitalcarduser # customize e.g. digitalcarduser02 + defaultDb: postgres + host: "postgres-postgresql" + port: 5432 + su: + user: postgres + secret: + name: postgres-postgresql + key: postgres-password + dml: 0 + repoUrl: https://github.com/mosip/digital-card-service.git branch: develop mosip_esignet: enabled: false - branch: v1.3.0 + scriptsDir: mosip_esignet # fixed - must match db_scripts/ folder in repo + dbName: mosip_esignet # customize e.g. mosip_esignet02 + dbUser: esignetuser # customize e.g. esignetuser02 + defaultDb: postgres + host: "postgres-postgresql" + port: 5432 + su: + user: postgres + secret: + name: postgres-postgresql + key: postgres-password + dml: 1 + repoUrl: https://github.com/mosip/esignet.git + branch: develop mosip_mockidentitysystem: enabled: false - branch: v0.9.2 + scriptsDir: mosip_mockidentitysystem # fixed - must match db_scripts/ folder in repo + dbName: mosip_mockidentitysystem # customize e.g. mosip_mockidentitysystem02 + dbUser: mockidentityuser # customize e.g. mockidentityuser02 + defaultDb: postgres + host: "postgres-postgresql" + port: 5432 + su: + user: postgres + secret: + name: postgres-postgresql + key: postgres-password + dml: 1 + repoUrl: https://github.com/mosip/esignet-mock-services.git + branch: develop + + mosip_otp: + enabled: true + scriptsDir: mosip_otp # fixed - must match db_scripts/ folder in repo + dbName: mosip_otp # customize e.g. mosip_otp02 + dbUser: otpuser # customize e.g. otpuser02 + defaultDb: postgres + host: "postgres-postgresql" + port: 5432 + su: + user: postgres + secret: + name: postgres-postgresql + key: postgres-password + dml: 0 + repoUrl: https://github.com/mosip/otp-manager.git + branch: develop + + inji_certify: + enabled: false + scriptsDir: inji_certify # fixed - must match db_scripts/ folder in repo + dbName: inji_certify # customize e.g. inji_certify02 + dbUser: injicertifyuser # customize e.g. injicertifyuser02 + defaultDb: postgres + host: "postgres-postgresql" + port: 5432 + su: + user: postgres + secret: + name: postgres-postgresql + key: postgres-password + dml: 1 + repoUrl: https://github.com/mosip/inji-certify.git + branch: develop + + inji_verify: + enabled: false + scriptsDir: inji_verify # fixed - must match db_scripts/ folder in repo + dbName: inji_verify # customize e.g. inji_verify02 + dbUser: injiverifyuser # customize e.g. injiverifyuser02 + defaultDb: postgres + host: "postgres-postgresql" + port: 5432 + su: + user: postgres + secret: + name: postgres-postgresql + key: postgres-password + dml: 1 + repoUrl: https://github.com/mosip/inji-verify.git + branch: develop + + inji_mimoto: + enabled: false + scriptsDir: inji_mimoto # fixed - must match db_scripts/ folder in repo + dbName: inji_mimoto # customize e.g. inji_mimoto02 + dbUser: injimimotouser # customize e.g. injimimotouser02 + defaultDb: postgres + 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 diff --git a/helm/postgres-init/templates/audit-env-configmap.yaml b/helm/postgres-init/templates/audit-env-configmap.yaml deleted file mode 100644 index 4344fbe..0000000 --- a/helm/postgres-init/templates/audit-env-configmap.yaml +++ /dev/null @@ -1,23 +0,0 @@ -{{- if .Values.databases.mosip_audit.enabled }} -apiVersion: v1 -kind: ConfigMap -metadata: - name: db-audit-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: mosip_audit - DB_SERVERIP: {{ .Values.databases.mosip_audit.host | quote }} - DB_PORT: {{ .Values.databases.mosip_audit.port | quote }} - SU_USER: {{ .Values.databases.mosip_audit.su.user | quote }} - DML_FLAG: {{ .Values.databases.mosip_audit.dml | quote }} - GIT_REPO_URL: {{ .Values.databases.mosip_audit.repoUrl | quote }} - GIT_BRANCH: {{ .Values.databases.mosip_audit.branch | quote }} -{{- end }} diff --git a/helm/postgres-init/templates/audit-job.yaml b/helm/postgres-init/templates/audit-job.yaml deleted file mode 100644 index 3a2636c..0000000 --- a/helm/postgres-init/templates/audit-job.yaml +++ /dev/null @@ -1,47 +0,0 @@ -{{- if .Values.databases.mosip_audit.enabled }} -apiVersion: batch/v1 -kind: Job -metadata: - name: db-audit-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-audit-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.mosip_audit.su.secret.name }} - key: {{ .Values.databases.mosip_audit.su.secret.key }} - - - name: DBUSER_PWD - valueFrom: - secretKeyRef: - name: db-common-secrets - key: db-dbuser-password - - envFrom: - - configMapRef: - name: db-audit-init-env-config -{{- end }} diff --git a/helm/postgres-init/templates/credential-env-configmap.yaml b/helm/postgres-init/templates/credential-env-configmap.yaml deleted file mode 100644 index 05b2066..0000000 --- a/helm/postgres-init/templates/credential-env-configmap.yaml +++ /dev/null @@ -1,23 +0,0 @@ -{{- if .Values.databases.mosip_credential.enabled }} -apiVersion: v1 -kind: ConfigMap -metadata: - name: db-credential-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: mosip_credential - DB_SERVERIP: {{ .Values.databases.mosip_credential.host | quote }} - DB_PORT: {{ .Values.databases.mosip_credential.port | quote }} - SU_USER: {{ .Values.databases.mosip_credential.su.user | quote }} - DML_FLAG: {{ .Values.databases.mosip_credential.dml | quote }} - GIT_REPO_URL: {{ .Values.databases.mosip_credential.repoUrl | quote }} - GIT_BRANCH: {{ .Values.databases.mosip_credential.branch | quote }} -{{- end }} diff --git a/helm/postgres-init/templates/credential-job.yaml b/helm/postgres-init/templates/credential-job.yaml deleted file mode 100644 index 0b396db..0000000 --- a/helm/postgres-init/templates/credential-job.yaml +++ /dev/null @@ -1,47 +0,0 @@ -{{- if .Values.databases.mosip_credential.enabled }} -apiVersion: batch/v1 -kind: Job -metadata: - name: db-credential-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-credential-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.mosip_credential.su.secret.name }} - key: {{ .Values.databases.mosip_credential.su.secret.key }} - - - name: DBUSER_PWD - valueFrom: - secretKeyRef: - name: db-common-secrets - key: db-dbuser-password - - envFrom: - - configMapRef: - name: db-credential-init-env-config -{{- end }} diff --git a/helm/postgres-init/templates/digitalcard-env-configmap.yaml b/helm/postgres-init/templates/digitalcard-env-configmap.yaml deleted file mode 100644 index 0be7e56..0000000 --- a/helm/postgres-init/templates/digitalcard-env-configmap.yaml +++ /dev/null @@ -1,23 +0,0 @@ -{{- if .Values.databases.mosip_digitalcard.enabled }} -apiVersion: v1 -kind: ConfigMap -metadata: - name: db-digitalcard-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: mosip_digitalcard - DB_SERVERIP: {{ .Values.databases.mosip_digitalcard.host | quote }} - DB_PORT: {{ .Values.databases.mosip_digitalcard.port | quote }} - SU_USER: {{ .Values.databases.mosip_digitalcard.su.user | quote }} - DML_FLAG: {{ .Values.databases.mosip_digitalcard.dml | quote }} - GIT_REPO_URL: {{ .Values.databases.mosip_digitalcard.repoUrl | quote }} - GIT_BRANCH: {{ .Values.databases.mosip_digitalcard.branch | quote }} -{{- end }} diff --git a/helm/postgres-init/templates/digitalcard-job.yaml b/helm/postgres-init/templates/digitalcard-job.yaml deleted file mode 100644 index f1ac99c..0000000 --- a/helm/postgres-init/templates/digitalcard-job.yaml +++ /dev/null @@ -1,47 +0,0 @@ -{{- if .Values.databases.mosip_digitalcard.enabled }} -apiVersion: batch/v1 -kind: Job -metadata: - name: db-digitalcard-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-digitalcard-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.mosip_digitalcard.su.secret.name }} - key: {{ .Values.databases.mosip_digitalcard.su.secret.key }} - - - name: DBUSER_PWD - valueFrom: - secretKeyRef: - name: db-common-secrets - key: db-dbuser-password - - envFrom: - - configMapRef: - name: db-digitalcard-init-env-config -{{- end }} diff --git a/helm/postgres-init/templates/env-configmap.yaml b/helm/postgres-init/templates/env-configmap.yaml new file mode 100644 index 0000000..7b70f32 --- /dev/null +++ b/helm/postgres-init/templates/env-configmap.yaml @@ -0,0 +1,34 @@ +{{- range $dbKey, $dbVal := .Values.databases }} + {{- if $dbVal.enabled }} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: db-{{ $dbKey | replace "_" "-" }}-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: + # Folder name inside db_scripts/ in the git repo (must match repo structure exactly) + DB_SCRIPTS_DIR: {{ $dbVal.scriptsDir | quote }} + # Actual Postgres database name to create (can be anything e.g. mosip_master02) + MOSIP_DB_NAME: {{ $dbVal.dbName | quote }} + DB_SERVERIP: {{ $dbVal.host | quote }} + DB_PORT: {{ $dbVal.port | quote }} + DEFAULT_DB_NAME: {{ $dbVal.defaultDb | quote }} + SU_USER: {{ $dbVal.su.user | quote }} + DB_UNAME: {{ $dbVal.dbUser | quote }} + DML_FLAG: {{ $dbVal.dml | quote }} + GIT_REPO_URL: {{ $dbVal.repoUrl | quote }} + GIT_BRANCH: {{ $dbVal.branch | quote }} + {{- if $dbVal.ENV_VERSION_FLAG }} + ENV_VERSION_FLAG: {{ $dbVal.ENV_VERSION_FLAG | quote }} + {{- end }} + {{- end }} + {{- end }} \ No newline at end of file diff --git a/helm/postgres-init/templates/esignet-env-configmap.yaml b/helm/postgres-init/templates/esignet-env-configmap.yaml deleted file mode 100644 index 7a12e10..0000000 --- a/helm/postgres-init/templates/esignet-env-configmap.yaml +++ /dev/null @@ -1,23 +0,0 @@ -{{- if .Values.databases.mosip_esignet.enabled }} -apiVersion: v1 -kind: ConfigMap -metadata: - name: db-esignet-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: mosip_esignet - DB_SERVERIP: {{ .Values.databases.mosip_esignet.host | quote }} - DB_PORT: {{ .Values.databases.mosip_esignet.port | quote }} - SU_USER: {{ .Values.databases.mosip_esignet.su.user | quote }} - DML_FLAG: {{ .Values.databases.mosip_esignet.dml | quote }} - GIT_REPO_URL: {{ .Values.databases.mosip_esignet.repoUrl | quote }} - GIT_BRANCH: {{ .Values.databases.mosip_esignet.branch | quote }} -{{- end }} diff --git a/helm/postgres-init/templates/esignet-job.yaml b/helm/postgres-init/templates/esignet-job.yaml deleted file mode 100644 index f04c1cc..0000000 --- a/helm/postgres-init/templates/esignet-job.yaml +++ /dev/null @@ -1,47 +0,0 @@ -{{- if .Values.databases.mosip_esignet.enabled }} -apiVersion: batch/v1 -kind: Job -metadata: - name: db-esignet-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-esignet-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.mosip_esignet.su.secret.name }} - key: {{ .Values.databases.mosip_esignet.su.secret.key }} - - - name: DBUSER_PWD - valueFrom: - secretKeyRef: - name: db-common-secrets - key: db-dbuser-password - - envFrom: - - configMapRef: - name: db-esignet-init-env-config -{{- end }} diff --git a/helm/postgres-init/templates/hotlist-env-configmap.yaml b/helm/postgres-init/templates/hotlist-env-configmap.yaml deleted file mode 100644 index d063de0..0000000 --- a/helm/postgres-init/templates/hotlist-env-configmap.yaml +++ /dev/null @@ -1,23 +0,0 @@ -{{- if .Values.databases.mosip_hotlist.enabled }} -apiVersion: v1 -kind: ConfigMap -metadata: - name: db-hotlist-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: mosip_hotlist - DB_SERVERIP: {{ .Values.databases.mosip_hotlist.host | quote }} - DB_PORT: {{ .Values.databases.mosip_hotlist.port | quote }} - SU_USER: {{ .Values.databases.mosip_hotlist.su.user | quote }} - DML_FLAG: {{ .Values.databases.mosip_hotlist.dml | quote }} - GIT_REPO_URL: {{ .Values.databases.mosip_hotlist.repoUrl | quote }} - GIT_BRANCH: {{ .Values.databases.mosip_hotlist.branch | quote }} -{{- end }} diff --git a/helm/postgres-init/templates/hotlist-job.yaml b/helm/postgres-init/templates/hotlist-job.yaml deleted file mode 100644 index e0bb011..0000000 --- a/helm/postgres-init/templates/hotlist-job.yaml +++ /dev/null @@ -1,47 +0,0 @@ -{{- if .Values.databases.mosip_hotlist.enabled }} -apiVersion: batch/v1 -kind: Job -metadata: - name: db-hotlist-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-hotlist-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.mosip_hotlist.su.secret.name }} - key: {{ .Values.databases.mosip_hotlist.su.secret.key }} - - - name: DBUSER_PWD - valueFrom: - secretKeyRef: - name: db-common-secrets - key: db-dbuser-password - - envFrom: - - configMapRef: - name: db-hotlist-init-env-config -{{- end }} diff --git a/helm/postgres-init/templates/ida-env-configmap.yaml b/helm/postgres-init/templates/ida-env-configmap.yaml deleted file mode 100644 index 2374244..0000000 --- a/helm/postgres-init/templates/ida-env-configmap.yaml +++ /dev/null @@ -1,23 +0,0 @@ -{{- if .Values.databases.mosip_ida.enabled }} -apiVersion: v1 -kind: ConfigMap -metadata: - name: db-ida-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: mosip_ida - DB_SERVERIP: {{ .Values.databases.mosip_ida.host | quote }} - DB_PORT: {{ .Values.databases.mosip_ida.port | quote }} - SU_USER: {{ .Values.databases.mosip_ida.su.user | quote }} - DML_FLAG: {{ .Values.databases.mosip_ida.dml | quote }} - GIT_REPO_URL: {{ .Values.databases.mosip_ida.repoUrl | quote }} - GIT_BRANCH: {{ .Values.databases.mosip_ida.branch | quote }} -{{- end }} diff --git a/helm/postgres-init/templates/ida-job.yaml b/helm/postgres-init/templates/ida-job.yaml deleted file mode 100644 index a1f4d2c..0000000 --- a/helm/postgres-init/templates/ida-job.yaml +++ /dev/null @@ -1,47 +0,0 @@ -{{- if .Values.databases.mosip_ida.enabled }} -apiVersion: batch/v1 -kind: Job -metadata: - name: db-ida-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-ida-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.mosip_ida.su.secret.name }} - key: {{ .Values.databases.mosip_ida.su.secret.key }} - - - name: DBUSER_PWD - valueFrom: - secretKeyRef: - name: db-common-secrets - key: db-dbuser-password - - envFrom: - - configMapRef: - name: db-ida-init-env-config -{{- end }} diff --git a/helm/postgres-init/templates/idmap-env-configmap.yaml b/helm/postgres-init/templates/idmap-env-configmap.yaml deleted file mode 100644 index cf5222d..0000000 --- a/helm/postgres-init/templates/idmap-env-configmap.yaml +++ /dev/null @@ -1,23 +0,0 @@ -{{- if .Values.databases.mosip_idmap.enabled }} -apiVersion: v1 -kind: ConfigMap -metadata: - name: db-idmap-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: mosip_idmap - DB_SERVERIP: {{ .Values.databases.mosip_idmap.host | quote }} - DB_PORT: {{ .Values.databases.mosip_idmap.port | quote }} - SU_USER: {{ .Values.databases.mosip_idmap.su.user | quote }} - DML_FLAG: {{ .Values.databases.mosip_idmap.dml | quote }} - GIT_REPO_URL: {{ .Values.databases.mosip_idmap.repoUrl | quote }} - GIT_BRANCH: {{ .Values.databases.mosip_idmap.branch | quote }} -{{- end }} diff --git a/helm/postgres-init/templates/idmap-job.yaml b/helm/postgres-init/templates/idmap-job.yaml deleted file mode 100644 index 4213cc8..0000000 --- a/helm/postgres-init/templates/idmap-job.yaml +++ /dev/null @@ -1,47 +0,0 @@ -{{- if .Values.databases.mosip_idmap.enabled }} -apiVersion: batch/v1 -kind: Job -metadata: - name: db-idmap-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-idmap-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.mosip_idmap.su.secret.name }} - key: {{ .Values.databases.mosip_idmap.su.secret.key }} - - - name: DBUSER_PWD - valueFrom: - secretKeyRef: - name: db-common-secrets - key: db-dbuser-password - - envFrom: - - configMapRef: - name: db-idmap-init-env-config -{{- end }} diff --git a/helm/postgres-init/templates/idrepo-env-configmap.yaml b/helm/postgres-init/templates/idrepo-env-configmap.yaml deleted file mode 100644 index 012d276..0000000 --- a/helm/postgres-init/templates/idrepo-env-configmap.yaml +++ /dev/null @@ -1,23 +0,0 @@ -{{- if .Values.databases.mosip_idrepo.enabled }} -apiVersion: v1 -kind: ConfigMap -metadata: - name: db-idrepo-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: mosip_idrepo - DB_SERVERIP: {{ .Values.databases.mosip_idrepo.host | quote }} - DB_PORT: {{ .Values.databases.mosip_idrepo.port | quote }} - SU_USER: {{ .Values.databases.mosip_idrepo.su.user | quote }} - DML_FLAG: {{ .Values.databases.mosip_idrepo.dml | quote }} - GIT_REPO_URL: {{ .Values.databases.mosip_idrepo.repoUrl | quote }} - GIT_BRANCH: {{ .Values.databases.mosip_idrepo.branch | quote }} -{{- end }} diff --git a/helm/postgres-init/templates/idrepo-job.yaml b/helm/postgres-init/templates/idrepo-job.yaml deleted file mode 100644 index 6d2f4c4..0000000 --- a/helm/postgres-init/templates/idrepo-job.yaml +++ /dev/null @@ -1,47 +0,0 @@ -{{- if .Values.databases.mosip_idrepo.enabled }} -apiVersion: batch/v1 -kind: Job -metadata: - name: db-idrepo-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-idrepo-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.mosip_idrepo.su.secret.name }} - key: {{ .Values.databases.mosip_idrepo.su.secret.key }} - - - name: DBUSER_PWD - valueFrom: - secretKeyRef: - name: db-common-secrets - key: db-dbuser-password - - envFrom: - - configMapRef: - name: db-idrepo-init-env-config -{{- end }} diff --git a/helm/postgres-init/templates/inji-certify-env-configmap.yaml b/helm/postgres-init/templates/inji-certify-env-configmap.yaml deleted file mode 100644 index b6fbf11..0000000 --- a/helm/postgres-init/templates/inji-certify-env-configmap.yaml +++ /dev/null @@ -1,23 +0,0 @@ -{{- if .Values.databases.inji_certify.enabled }} -apiVersion: v1 -kind: ConfigMap -metadata: - name: db-certify-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_certify - DB_SERVERIP: {{ .Values.databases.inji_certify.host | quote }} - DB_PORT: {{ .Values.databases.inji_certify.port | quote }} - SU_USER: {{ .Values.databases.inji_certify.su.user | quote }} - DML_FLAG: {{ .Values.databases.inji_certify.dml | quote }} - GIT_REPO_URL: {{ .Values.databases.inji_certify.repoUrl | quote }} - GIT_BRANCH: {{ .Values.databases.inji_certify.branch | quote }} -{{- end }} diff --git a/helm/postgres-init/templates/inji-certify-job.yaml b/helm/postgres-init/templates/inji-certify-job.yaml deleted file mode 100644 index 6f8e912..0000000 --- a/helm/postgres-init/templates/inji-certify-job.yaml +++ /dev/null @@ -1,47 +0,0 @@ -{{- if .Values.databases.inji_certify.enabled }} -apiVersion: batch/v1 -kind: Job -metadata: - name: db-certify-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-certify-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_certify.su.secret.name }} - key: {{ .Values.databases.inji_certify.su.secret.key }} - - - name: DBUSER_PWD - valueFrom: - secretKeyRef: - name: db-common-secrets - key: db-dbuser-password - - envFrom: - - configMapRef: - name: db-certify-init-env-config -{{- end }} diff --git a/helm/postgres-init/templates/inji-mimoto-env-configmap.yaml b/helm/postgres-init/templates/inji-mimoto-env-configmap.yaml deleted file mode 100644 index 93a60f9..0000000 --- a/helm/postgres-init/templates/inji-mimoto-env-configmap.yaml +++ /dev/null @@ -1,23 +0,0 @@ -{{- 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 deleted file mode 100644 index a8f8876..0000000 --- a/helm/postgres-init/templates/inji-mimoto-job.yaml +++ /dev/null @@ -1,47 +0,0 @@ -{{- 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/templates/inji-verify-env-configmap.yaml b/helm/postgres-init/templates/inji-verify-env-configmap.yaml deleted file mode 100644 index d38a438..0000000 --- a/helm/postgres-init/templates/inji-verify-env-configmap.yaml +++ /dev/null @@ -1,23 +0,0 @@ -{{- if .Values.databases.inji_verify.enabled }} -apiVersion: v1 -kind: ConfigMap -metadata: - name: db-inji-verify-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_verify - DB_SERVERIP: {{ .Values.databases.inji_verify.host | quote }} - DB_PORT: {{ .Values.databases.inji_verify.port | quote }} - SU_USER: {{ .Values.databases.inji_verify.su.user | quote }} - DML_FLAG: {{ .Values.databases.inji_verify.dml | quote }} - GIT_REPO_URL: {{ .Values.databases.inji_verify.repoUrl | quote }} - GIT_BRANCH: {{ .Values.databases.inji_verify.branch | quote }} -{{- end }} diff --git a/helm/postgres-init/templates/inji-verify-job.yaml b/helm/postgres-init/templates/inji-verify-job.yaml deleted file mode 100644 index 15f738f..0000000 --- a/helm/postgres-init/templates/inji-verify-job.yaml +++ /dev/null @@ -1,47 +0,0 @@ -{{- if .Values.databases.inji_verify.enabled }} -apiVersion: batch/v1 -kind: Job -metadata: - name: db-inji-verify-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-inji-verify-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_verify.su.secret.name }} - key: {{ .Values.databases.inji_verify.su.secret.key }} - - - name: DBUSER_PWD - valueFrom: - secretKeyRef: - name: db-common-secrets - key: db-dbuser-password - - envFrom: - - configMapRef: - name: db-inji-verify-init-env-config -{{- end }} diff --git a/helm/postgres-init/templates/job.yaml b/helm/postgres-init/templates/job.yaml new file mode 100644 index 0000000..af9871e --- /dev/null +++ b/helm/postgres-init/templates/job.yaml @@ -0,0 +1,48 @@ +{{- range $dbKey, $dbVal := .Values.databases }} + {{- if $dbVal.enabled }} +--- +apiVersion: batch/v1 +kind: Job +metadata: + name: db-{{ $dbKey | replace "_" "-" }}-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-{{ $dbKey | replace "_" "-" }}-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: {{ $dbVal.su.secret.name }} + key: {{ $dbVal.su.secret.key }} + - name: DBUSER_PWD + valueFrom: + secretKeyRef: + name: db-common-secrets + key: db-dbuser-password + envFrom: + - configMapRef: + name: db-{{ $dbKey | replace "_" "-" }}-init-env-config + {{- end }} + {{- end }} \ No newline at end of file diff --git a/helm/postgres-init/templates/kernel-env-configmap.yaml b/helm/postgres-init/templates/kernel-env-configmap.yaml deleted file mode 100644 index b43287a..0000000 --- a/helm/postgres-init/templates/kernel-env-configmap.yaml +++ /dev/null @@ -1,23 +0,0 @@ -{{- if .Values.databases.mosip_kernel.enabled }} -apiVersion: v1 -kind: ConfigMap -metadata: - name: db-kernel-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: mosip_kernel - DB_SERVERIP: {{ .Values.databases.mosip_kernel.host | quote }} - DB_PORT: {{ .Values.databases.mosip_kernel.port | quote }} - SU_USER: {{ .Values.databases.mosip_kernel.su.user | quote }} - DML_FLAG: {{ .Values.databases.mosip_kernel.dml | quote }} - GIT_REPO_URL: {{ .Values.databases.mosip_kernel.repoUrl | quote }} - GIT_BRANCH: {{ .Values.databases.mosip_kernel.branch | quote }} -{{- end }} diff --git a/helm/postgres-init/templates/kernel-job.yaml b/helm/postgres-init/templates/kernel-job.yaml deleted file mode 100644 index dd70c19..0000000 --- a/helm/postgres-init/templates/kernel-job.yaml +++ /dev/null @@ -1,47 +0,0 @@ -{{- if .Values.databases.mosip_kernel.enabled }} -apiVersion: batch/v1 -kind: Job -metadata: - name: db-kernel-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-kernel-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.mosip_kernel.su.secret.name }} - key: {{ .Values.databases.mosip_kernel.su.secret.key }} - - - name: DBUSER_PWD - valueFrom: - secretKeyRef: - name: db-common-secrets - key: db-dbuser-password - - envFrom: - - configMapRef: - name: db-kernel-init-env-config -{{- end }} diff --git a/helm/postgres-init/templates/keymgr-env-configmap.yaml b/helm/postgres-init/templates/keymgr-env-configmap.yaml deleted file mode 100644 index 6efa18b..0000000 --- a/helm/postgres-init/templates/keymgr-env-configmap.yaml +++ /dev/null @@ -1,23 +0,0 @@ -{{- if .Values.databases.mosip_keymgr.enabled }} -apiVersion: v1 -kind: ConfigMap -metadata: - name: db-keymgr-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: mosip_keymgr - DB_SERVERIP: {{ .Values.databases.mosip_keymgr.host | quote }} - DB_PORT: {{ .Values.databases.mosip_keymgr.port | quote }} - SU_USER: {{ .Values.databases.mosip_keymgr.su.user | quote }} - DML_FLAG: {{ .Values.databases.mosip_keymgr.dml | quote }} - GIT_REPO_URL: {{ .Values.databases.mosip_keymgr.repoUrl | quote }} - GIT_BRANCH: {{ .Values.databases.mosip_keymgr.branch | quote }} -{{- end }} diff --git a/helm/postgres-init/templates/keymgr-job.yaml b/helm/postgres-init/templates/keymgr-job.yaml deleted file mode 100644 index 1477cb1..0000000 --- a/helm/postgres-init/templates/keymgr-job.yaml +++ /dev/null @@ -1,47 +0,0 @@ -{{- if .Values.databases.mosip_keymgr.enabled }} -apiVersion: batch/v1 -kind: Job -metadata: - name: db-keymgr-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-keymgr-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.mosip_keymgr.su.secret.name }} - key: {{ .Values.databases.mosip_keymgr.su.secret.key }} - - - name: DBUSER_PWD - valueFrom: - secretKeyRef: - name: db-common-secrets - key: db-dbuser-password - - envFrom: - - configMapRef: - name: db-keymgr-init-env-config -{{- end }} diff --git a/helm/postgres-init/templates/master-env-configmap.yaml b/helm/postgres-init/templates/master-env-configmap.yaml deleted file mode 100644 index ff829d9..0000000 --- a/helm/postgres-init/templates/master-env-configmap.yaml +++ /dev/null @@ -1,23 +0,0 @@ -{{- if .Values.databases.mosip_master.enabled }} -apiVersion: v1 -kind: ConfigMap -metadata: - name: db-master-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: mosip_master - DB_SERVERIP: {{ .Values.databases.mosip_master.host | quote }} - DB_PORT: {{ .Values.databases.mosip_master.port | quote }} - SU_USER: {{ .Values.databases.mosip_master.su.user | quote }} - DML_FLAG: {{ .Values.databases.mosip_master.dml | quote }} - GIT_REPO_URL: {{ .Values.databases.mosip_master.repoUrl | quote }} - GIT_BRANCH: {{ .Values.databases.mosip_master.branch | quote }} -{{- end }} diff --git a/helm/postgres-init/templates/master-job.yaml b/helm/postgres-init/templates/master-job.yaml deleted file mode 100644 index 2fc18c1..0000000 --- a/helm/postgres-init/templates/master-job.yaml +++ /dev/null @@ -1,47 +0,0 @@ -{{- if .Values.databases.mosip_master.enabled }} -apiVersion: batch/v1 -kind: Job -metadata: - name: db-master-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-master-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.mosip_master.su.secret.name }} - key: {{ .Values.databases.mosip_master.su.secret.key }} - - - name: DBUSER_PWD - valueFrom: - secretKeyRef: - name: db-common-secrets - key: db-dbuser-password - - envFrom: - - configMapRef: - name: db-master-init-env-config -{{- end }} diff --git a/helm/postgres-init/templates/mockidentitysystem-env-configmap.yaml b/helm/postgres-init/templates/mockidentitysystem-env-configmap.yaml deleted file mode 100644 index ef182ea..0000000 --- a/helm/postgres-init/templates/mockidentitysystem-env-configmap.yaml +++ /dev/null @@ -1,23 +0,0 @@ -{{- if .Values.databases.mosip_mockidentitysystem.enabled }} -apiVersion: v1 -kind: ConfigMap -metadata: - name: db-mockidentitysystem-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: mosip_mockidentitysystem - DB_SERVERIP: {{ .Values.databases.mosip_mockidentitysystem.host | quote }} - DB_PORT: {{ .Values.databases.mosip_mockidentitysystem.port | quote }} - SU_USER: {{ .Values.databases.mosip_mockidentitysystem.su.user | quote }} - DML_FLAG: {{ .Values.databases.mosip_mockidentitysystem.dml | quote }} - GIT_REPO_URL: {{ .Values.databases.mosip_mockidentitysystem.repoUrl | quote }} - GIT_BRANCH: {{ .Values.databases.mosip_mockidentitysystem.branch | quote }} -{{- end }} diff --git a/helm/postgres-init/templates/mockidentitysystem-job.yaml b/helm/postgres-init/templates/mockidentitysystem-job.yaml deleted file mode 100644 index d1ba41b..0000000 --- a/helm/postgres-init/templates/mockidentitysystem-job.yaml +++ /dev/null @@ -1,47 +0,0 @@ -{{- if .Values.databases.mosip_mockidentitysystem.enabled }} -apiVersion: batch/v1 -kind: Job -metadata: - name: db-mockidentitysystem-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-mockidentitysystem-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.mosip_mockidentitysystem.su.secret.name }} - key: {{ .Values.databases.mosip_mockidentitysystem.su.secret.key }} - - - name: DBUSER_PWD - valueFrom: - secretKeyRef: - name: db-common-secrets - key: db-dbuser-password - - envFrom: - - configMapRef: - name: db-mockidentitysystem-init-env-config -{{- end }} diff --git a/helm/postgres-init/templates/otp-env-configmap.yaml b/helm/postgres-init/templates/otp-env-configmap.yaml deleted file mode 100644 index 7fc0646..0000000 --- a/helm/postgres-init/templates/otp-env-configmap.yaml +++ /dev/null @@ -1,24 +0,0 @@ -{{- if .Values.databases.mosip_otp.enabled }} -apiVersion: v1 -kind: ConfigMap -metadata: - name: db-otp-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: mosip_otp - DB_SERVERIP: {{ .Values.databases.mosip_otp.host | quote }} - DB_PORT: {{ .Values.databases.mosip_otp.port | quote }} - SU_USER: {{ .Values.databases.mosip_otp.su.user | quote }} - DML_FLAG: {{ .Values.databases.mosip_otp.dml | quote }} - GIT_REPO_URL: {{ .Values.databases.mosip_otp.repoUrl | quote }} - GIT_BRANCH: {{ .Values.databases.mosip_otp.branch | quote }} - {{- end }} - diff --git a/helm/postgres-init/templates/otp-job.yaml b/helm/postgres-init/templates/otp-job.yaml deleted file mode 100644 index ebcd7cf..0000000 --- a/helm/postgres-init/templates/otp-job.yaml +++ /dev/null @@ -1,48 +0,0 @@ -{{- if .Values.databases.mosip_otp.enabled }} -apiVersion: batch/v1 -kind: Job -metadata: - name: db-otp-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-otp-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.mosip_otp.su.secret.name }} - key: {{ .Values.databases.mosip_otp.su.secret.key }} - - - name: DBUSER_PWD - valueFrom: - secretKeyRef: - name: db-common-secrets - key: db-dbuser-password - - envFrom: - - configMapRef: - name: db-otp-init-env-config - {{- end }} - diff --git a/helm/postgres-init/templates/pms-env-configmap.yaml b/helm/postgres-init/templates/pms-env-configmap.yaml deleted file mode 100644 index cca1791..0000000 --- a/helm/postgres-init/templates/pms-env-configmap.yaml +++ /dev/null @@ -1,24 +0,0 @@ -{{- if .Values.databases.mosip_pms.enabled }} -apiVersion: v1 -kind: ConfigMap -metadata: - name: db-pms-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: mosip_pms - DB_SERVERIP: {{ .Values.databases.mosip_pms.host | quote }} - DB_PORT: {{ .Values.databases.mosip_pms.port | quote }} - SU_USER: {{ .Values.databases.mosip_pms.su.user | quote }} - DML_FLAG: {{ .Values.databases.mosip_pms.dml | quote }} - ENV_VERSION_FLAG: {{ .Values.databases.mosip_pms.ENV_VERSION_FLAG | quote }} - GIT_REPO_URL: {{ .Values.databases.mosip_pms.repoUrl | quote }} - GIT_BRANCH: {{ .Values.databases.mosip_pms.branch | quote }} -{{- end }} diff --git a/helm/postgres-init/templates/pms-job.yaml b/helm/postgres-init/templates/pms-job.yaml deleted file mode 100644 index fb6956c..0000000 --- a/helm/postgres-init/templates/pms-job.yaml +++ /dev/null @@ -1,47 +0,0 @@ -{{- if .Values.databases.mosip_pms.enabled }} -apiVersion: batch/v1 -kind: Job -metadata: - name: db-pms-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-pms-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.mosip_pms.su.secret.name }} - key: {{ .Values.databases.mosip_pms.su.secret.key }} - - - name: DBUSER_PWD - valueFrom: - secretKeyRef: - name: db-common-secrets - key: db-dbuser-password - - envFrom: - - configMapRef: - name: db-pms-init-env-config -{{- end }} diff --git a/helm/postgres-init/templates/prereg-env-configmap.yaml b/helm/postgres-init/templates/prereg-env-configmap.yaml deleted file mode 100644 index 700c235..0000000 --- a/helm/postgres-init/templates/prereg-env-configmap.yaml +++ /dev/null @@ -1,23 +0,0 @@ -{{- if .Values.databases.mosip_prereg.enabled }} -apiVersion: v1 -kind: ConfigMap -metadata: - name: db-prereg-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: mosip_prereg - DB_SERVERIP: {{ .Values.databases.mosip_prereg.host | quote }} - DB_PORT: {{ .Values.databases.mosip_prereg.port | quote }} - SU_USER: {{ .Values.databases.mosip_prereg.su.user | quote }} - DML_FLAG: {{ .Values.databases.mosip_prereg.dml | quote }} - GIT_REPO_URL: {{ .Values.databases.mosip_prereg.repoUrl | quote }} - GIT_BRANCH: {{ .Values.databases.mosip_prereg.branch | quote }} -{{- end }} diff --git a/helm/postgres-init/templates/prereg-job.yaml b/helm/postgres-init/templates/prereg-job.yaml deleted file mode 100644 index 9cbc0a5..0000000 --- a/helm/postgres-init/templates/prereg-job.yaml +++ /dev/null @@ -1,48 +0,0 @@ -{{- if .Values.databases.mosip_prereg.enabled }} -apiVersion: batch/v1 -kind: Job -metadata: - name: db-prereg-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-prereg-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.mosip_prereg.su.secret.name }} - key: {{ .Values.databases.mosip_prereg.su.secret.key }} - - - name: DBUSER_PWD - valueFrom: - secretKeyRef: - name: db-common-secrets - key: db-dbuser-password - - envFrom: - - configMapRef: - name: db-prereg-init-env-config - -{{- end }} diff --git a/helm/postgres-init/templates/regprc-env-configmap.yaml b/helm/postgres-init/templates/regprc-env-configmap.yaml deleted file mode 100644 index fa580ae..0000000 --- a/helm/postgres-init/templates/regprc-env-configmap.yaml +++ /dev/null @@ -1,23 +0,0 @@ -{{- if .Values.databases.mosip_regprc.enabled }} -apiVersion: v1 -kind: ConfigMap -metadata: - name: db-regprc-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: mosip_regprc - DB_SERVERIP: {{ .Values.databases.mosip_regprc.host | quote }} - DB_PORT: {{ .Values.databases.mosip_regprc.port | quote }} - SU_USER: {{ .Values.databases.mosip_regprc.su.user | quote }} - DML_FLAG: {{ .Values.databases.mosip_regprc.dml | quote }} - GIT_REPO_URL: {{ .Values.databases.mosip_regprc.repoUrl | quote }} - GIT_BRANCH: {{ .Values.databases.mosip_regprc.branch | quote }} -{{- end }} diff --git a/helm/postgres-init/templates/regprc-job.yaml b/helm/postgres-init/templates/regprc-job.yaml deleted file mode 100644 index 4aea72c..0000000 --- a/helm/postgres-init/templates/regprc-job.yaml +++ /dev/null @@ -1,47 +0,0 @@ -{{- if .Values.databases.mosip_regprc.enabled }} -apiVersion: batch/v1 -kind: Job -metadata: - name: db-regprc-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-regprc-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.mosip_regprc.su.secret.name }} - key: {{ .Values.databases.mosip_regprc.su.secret.key }} - - - name: DBUSER_PWD - valueFrom: - secretKeyRef: - name: db-common-secrets - key: db-dbuser-password - - envFrom: - - configMapRef: - name: db-regprc-init-env-config -{{- end }} diff --git a/helm/postgres-init/templates/resident-env-configmap.yaml b/helm/postgres-init/templates/resident-env-configmap.yaml deleted file mode 100644 index 6cf8aa2..0000000 --- a/helm/postgres-init/templates/resident-env-configmap.yaml +++ /dev/null @@ -1,23 +0,0 @@ -{{- if .Values.databases.mosip_resident.enabled }} -apiVersion: v1 -kind: ConfigMap -metadata: - name: db-resident-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: mosip_resident - DB_SERVERIP: {{ .Values.databases.mosip_resident.host | quote }} - DB_PORT: {{ .Values.databases.mosip_resident.port | quote }} - SU_USER: {{ .Values.databases.mosip_resident.su.user | quote }} - DML_FLAG: {{ .Values.databases.mosip_resident.dml | quote }} - GIT_REPO_URL: {{ .Values.databases.mosip_resident.repoUrl | quote }} - GIT_BRANCH: {{ .Values.databases.mosip_resident.branch | quote }} -{{- end }} diff --git a/helm/postgres-init/templates/resident-job.yaml b/helm/postgres-init/templates/resident-job.yaml deleted file mode 100644 index 326a390..0000000 --- a/helm/postgres-init/templates/resident-job.yaml +++ /dev/null @@ -1,47 +0,0 @@ -{{- if .Values.databases.mosip_resident.enabled }} -apiVersion: batch/v1 -kind: Job -metadata: - name: db-resident-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-audit-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.mosip_resident.su.secret.name }} - key: {{ .Values.databases.mosip_resident.su.secret.key }} - - - name: DBUSER_PWD - valueFrom: - secretKeyRef: - name: db-common-secrets - key: db-dbuser-password - - envFrom: - - configMapRef: - name: db-resident-init-env-config -{{- end }} diff --git a/helm/postgres-init/templates/toolkit-env-configmap.yaml b/helm/postgres-init/templates/toolkit-env-configmap.yaml deleted file mode 100644 index d18e958..0000000 --- a/helm/postgres-init/templates/toolkit-env-configmap.yaml +++ /dev/null @@ -1,23 +0,0 @@ -{{- if .Values.databases.mosip_toolkit.enabled }} -apiVersion: v1 -kind: ConfigMap -metadata: - name: db-toolkit-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: mosip_toolkit - DB_SERVERIP: {{ .Values.databases.mosip_toolkit.host | quote }} - DB_PORT: {{ .Values.databases.mosip_toolkit.port | quote }} - SU_USER: {{ .Values.databases.mosip_toolkit.su.user | quote }} - DML_FLAG: {{ .Values.databases.mosip_toolkit.dml | quote }} - GIT_REPO_URL: {{ .Values.databases.mosip_toolkit.repoUrl | quote }} - GIT_BRANCH: {{ .Values.databases.mosip_toolkit.branch | quote }} -{{- end }} diff --git a/helm/postgres-init/templates/toolkit-job.yaml b/helm/postgres-init/templates/toolkit-job.yaml deleted file mode 100644 index bd25ab8..0000000 --- a/helm/postgres-init/templates/toolkit-job.yaml +++ /dev/null @@ -1,47 +0,0 @@ -{{- if .Values.databases.mosip_toolkit.enabled }} -apiVersion: batch/v1 -kind: Job -metadata: - name: db-toolkit-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-audit-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.mosip_toolkit.su.secret.name }} - key: {{ .Values.databases.mosip_toolkit.su.secret.key }} - - - name: DBUSER_PWD - valueFrom: - secretKeyRef: - name: db-common-secrets - key: db-dbuser-password - - envFrom: - - configMapRef: - name: db-toolkit-init-env-config -{{- end }} diff --git a/helm/postgres-init/values.yaml b/helm/postgres-init/values.yaml index 633b2bd..c055eeb 100644 --- a/helm/postgres-init/values.yaml +++ b/helm/postgres-init/values.yaml @@ -26,7 +26,7 @@ serviceAccount: jobAnnotations: {} jobSecurityContext: {} - # fsGroup: 2000 +# fsGroup: 2000 securityContext: {} # capabilities: @@ -43,8 +43,8 @@ service: ingress: enabled: false annotations: {} - # kubernetes.io/ingress.class: nginx - # kubernetes.io/tls-acme: "true" + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" hosts: - host: chart-example.local paths: [] @@ -54,16 +54,12 @@ ingress: # - chart-example.local resources: {} - # We usually recommend not to specify default resources and to leave this as a conscious - # choice for the user. This also increases chances charts run on environments with little - # resources, such as Minikube. If you do want to specify resources, uncomment the following - # lines, adjust them as necessary, and remove the curly braces after 'resources:'. # limits: # cpu: 100m # memory: 128Mi - # requests: - # cpu: 100m - # memory: 128Mi +# requests: +# cpu: 100m +# memory: 128Mi nodeSelector: {} @@ -71,22 +67,37 @@ tolerations: [] affinity: {} -## Some common set of users are created across all postgres servers with same password. TODO: change this later. -## These user names are currently hardcoded in the sql scripts, so can't change from here. +## Some common set of users are created across all postgres servers with same password. dbUserPasswords: dbuserPassword: "" -## Superuser secret is required to setup DB. It is assumed that the secret was created while creating -## DB server(s) and is available in the same namespace. -## host: It could be in-cluster service name of postgres if running as pods inside cluster. -## su.user: Assumed 'postgres'. Change manually if you have given a different postgres superuser name -## su.secret.name: Default name 'postgres-postgresql' if you install bitnami postgres within cluster. -## su.secret.key: Default key 'postgres-password' if you install bitnami postgres within cluster. -## dml: whether dml is available to be loaded 0/1. Refer SQL scripts in module repos. +## Per-database configuration: +## +## enabled: Set to true to run the init job for this database. +## scriptsDir: Folder name inside db_scripts/ in the git repo. MUST match the repo +## structure exactly (e.g. mosip_master). Do NOT change this unless the +## repo folder is renamed. +## dbName: Actual Postgres database name to create. Can be anything +## (e.g. mosip_master, mosip_master02). This is what gets created in Postgres. +## dbUser: The DB user created/used by deploy.sh (DB_UNAME). Can be any name +## (e.g. masteruser, masteruser02). +## defaultDb: Default postgres DB to connect to before creating the target DB. +## host: In-cluster service name of postgres. +## port: Postgres port (default 5432). +## su.user: Postgres superuser name (default: postgres). +## su.secret.name: K8s secret name holding the superuser password. +## su.secret.key: Key inside the secret for the superuser password. +## dml: Whether DML scripts should be loaded: 0 (skip) or 1 (load). +## repoUrl: Git repo URL containing the db_scripts/ folder. +## branch: Git branch to clone from. databases: mosip_master: enabled: false + scriptsDir: mosip_master # fixed - must match db_scripts/ folder in repo + dbName: mosip_master # customize e.g. mosip_master02 + dbUser: masteruser # customize e.g. masteruser02 + defaultDb: postgres host: "postgres-postgresql" port: 5432 su: @@ -100,6 +111,10 @@ databases: mosip_audit: enabled: false + scriptsDir: mosip_audit # fixed - must match db_scripts/ folder in repo + dbName: mosip_audit # customize e.g. mosip_audit02 + dbUser: audituser # customize e.g. audituser02 + defaultDb: postgres host: "postgres-postgresql" port: 5432 su: @@ -113,6 +128,10 @@ databases: mosip_keymgr: enabled: false + scriptsDir: mosip_keymgr # fixed - must match db_scripts/ folder in repo + dbName: mosip_keymgr # customize e.g. mosip_keymgr02 + dbUser: keymgruser # customize e.g. keymgruser02 + defaultDb: postgres host: "postgres-postgresql" port: 5432 su: @@ -126,6 +145,10 @@ databases: mosip_kernel: enabled: false + scriptsDir: mosip_kernel # fixed - must match db_scripts/ folder in repo + dbName: mosip_kernel # customize e.g. mosip_kernel02 + dbUser: kerneluser # customize e.g. kerneluser02 + defaultDb: postgres host: "postgres-postgresql" port: 5432 su: @@ -139,6 +162,10 @@ databases: mosip_idmap: enabled: false + scriptsDir: mosip_idmap # fixed - must match db_scripts/ folder in repo + dbName: mosip_idmap # customize e.g. mosip_idmap02 + dbUser: idmapuser # customize e.g. idmapuser02 + defaultDb: postgres host: "postgres-postgresql" port: 5432 su: @@ -152,6 +179,10 @@ databases: mosip_prereg: enabled: false + scriptsDir: mosip_prereg # fixed - must match db_scripts/ folder in repo + dbName: mosip_prereg # customize e.g. mosip_prereg02 + dbUser: prereguser # customize e.g. prereguser02 + defaultDb: postgres host: "postgres-postgresql" port: 5432 su: @@ -165,6 +196,10 @@ databases: mosip_idrepo: enabled: false + scriptsDir: mosip_idrepo # fixed - must match db_scripts/ folder in repo + dbName: mosip_idrepo # customize e.g. mosip_idrepo02 + dbUser: idrepouser # customize e.g. idrepouser02 + defaultDb: postgres host: "postgres-postgresql" port: 5432 su: @@ -178,6 +213,10 @@ databases: mosip_ida: enabled: false + scriptsDir: mosip_ida # fixed - must match db_scripts/ folder in repo + dbName: mosip_ida # customize e.g. mosip_ida02 + dbUser: idauser # customize e.g. idauser02 + defaultDb: postgres host: "postgres-postgresql" port: 5432 su: @@ -191,6 +230,10 @@ databases: mosip_credential: enabled: false + scriptsDir: mosip_credential # fixed - must match db_scripts/ folder in repo + dbName: mosip_credential # customize e.g. mosip_credential02 + dbUser: credentialuser # customize e.g. credentialuser02 + defaultDb: postgres host: "postgres-postgresql" port: 5432 su: @@ -204,6 +247,10 @@ databases: mosip_regprc: enabled: false + scriptsDir: mosip_regprc # fixed - must match db_scripts/ folder in repo + dbName: mosip_regprc # customize e.g. mosip_regprc02 + dbUser: regprcuser # customize e.g. regprcuser02 + defaultDb: postgres host: "postgres-postgresql" port: 5432 su: @@ -217,10 +264,14 @@ databases: mosip_pms: enabled: false + scriptsDir: mosip_pms # fixed - must match db_scripts/ folder in repo + dbName: mosip_pms # customize e.g. mosip_pms02 + dbUser: pmsuser # customize e.g. pmsuser02 + defaultDb: postgres host: "postgres-postgresql" port: 5432 - # Note: This flag is used update datashare domain in partner policies according to deployment version( i.e v2/v3 ) - # Set flag ENV_VERSION_FLAG to true for v2 envs and false to v3 envs. + # Note: This flag is used to update datashare domain in partner policies according to deployment version (i.e v2/v3) + # Set flag ENV_VERSION_FLAG to true for v2 envs and false for v3 envs. ENV_VERSION_FLAG: false su: user: postgres @@ -233,6 +284,10 @@ databases: mosip_hotlist: enabled: false + scriptsDir: mosip_hotlist # fixed - must match db_scripts/ folder in repo + dbName: mosip_hotlist # customize e.g. mosip_hotlist02 + dbUser: hotlistuser # customize e.g. hotlistuser02 + defaultDb: postgres host: "postgres-postgresql" port: 5432 su: @@ -246,6 +301,10 @@ databases: mosip_resident: enabled: false + scriptsDir: mosip_resident # fixed - must match db_scripts/ folder in repo + dbName: mosip_resident # customize e.g. mosip_resident02 + dbUser: residentuser # customize e.g. residentuser02 + defaultDb: postgres host: "postgres-postgresql" port: 5432 su: @@ -259,6 +318,10 @@ databases: mosip_toolkit: enabled: false + scriptsDir: mosip_toolkit # fixed - must match db_scripts/ folder in repo + dbName: mosip_toolkit # customize e.g. mosip_toolkit02 + dbUser: toolkituser # customize e.g. toolkituser02 + defaultDb: postgres host: "postgres-postgresql" port: 5432 su: @@ -272,6 +335,10 @@ databases: mosip_digitalcard: enabled: false + scriptsDir: mosip_digitalcard # fixed - must match db_scripts/ folder in repo + dbName: mosip_digitalcard # customize e.g. mosip_digitalcard02 + dbUser: digitalcarduser # customize e.g. digitalcarduser02 + defaultDb: postgres host: "postgres-postgresql" port: 5432 su: @@ -285,6 +352,10 @@ databases: mosip_esignet: enabled: false + scriptsDir: mosip_esignet # fixed - must match db_scripts/ folder in repo + dbName: mosip_esignet # customize e.g. mosip_esignet02 + dbUser: esignetuser # customize e.g. esignetuser02 + defaultDb: postgres host: "postgres-postgresql" port: 5432 su: @@ -298,6 +369,10 @@ databases: mosip_mockidentitysystem: enabled: false + scriptsDir: mosip_mockidentitysystem # fixed - must match db_scripts/ folder in repo + dbName: mosip_mockidentitysystem # customize e.g. mosip_mockidentitysystem02 + dbUser: mockidentityuser # customize e.g. mockidentityuser02 + defaultDb: postgres host: "postgres-postgresql" port: 5432 su: @@ -311,6 +386,10 @@ databases: mosip_otp: enabled: false + scriptsDir: mosip_otp # fixed - must match db_scripts/ folder in repo + dbName: mosip_otp # customize e.g. mosip_otp02 + dbUser: otpuser # customize e.g. otpuser02 + defaultDb: postgres host: "postgres-postgresql" port: 5432 su: @@ -324,6 +403,10 @@ databases: inji_certify: enabled: false + scriptsDir: inji_certify # fixed - must match db_scripts/ folder in repo + dbName: inji_certify # customize e.g. inji_certify02 + dbUser: injicertifyuser # customize e.g. injicertifyuser02 + defaultDb: postgres host: "postgres-postgresql" port: 5432 su: @@ -337,6 +420,10 @@ databases: inji_verify: enabled: false + scriptsDir: inji_verify # fixed - must match db_scripts/ folder in repo + dbName: inji_verify # customize e.g. inji_verify02 + dbUser: injiverifyuser # customize e.g. injiverifyuser02 + defaultDb: postgres host: "postgres-postgresql" port: 5432 su: @@ -350,6 +437,10 @@ databases: inji_mimoto: enabled: false + scriptsDir: inji_mimoto # fixed - must match db_scripts/ folder in repo + dbName: inji_mimoto # customize e.g. inji_mimoto02 + dbUser: injimimotouser # customize e.g. injimimotouser02 + defaultDb: postgres host: "postgres-postgresql" port: 5432 su: diff --git a/postgres-init/Dockerfile b/postgres-init/Dockerfile index 406bf73..b824f41 100644 --- a/postgres-init/Dockerfile +++ b/postgres-init/Dockerfile @@ -8,54 +8,42 @@ LABEL source=${SOURCE} LABEL commit_hash=${COMMIT_HASH} LABEL commit_id=${COMMIT_ID} LABEL build_time=${BUILD_TIME} -RUN apt-get update -RUN apt-get install -y python3 python3-pip python3-xlrd git ARG container_user=mosip - -# can be passed during Docker build as build time environment for github branch to pickup configuration from. ARG container_user_group=mosip - -# can be passed during Docker build as build time environment for github branch to pickup configuration from. ARG container_user_uid=1001 - -# can be passed during Docker build as build time environment for github branch to pickup configuration from. ARG container_user_gid=1001 -# install packages and create user -RUN apt-get -y update \ -&& apt-get install -y unzip \ -&& groupadd -g ${container_user_gid} ${container_user_group} \ -&& useradd -u ${container_user_uid} -g ${container_user_group} -s /bin/sh -m ${container_user} +# Install packages and create user in a single layer to minimize image size +RUN apt-get update \ + && apt-get install -y --no-install-recommends git unzip ca-certificates \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* \ + && groupadd -g ${container_user_gid} ${container_user_group} \ + && useradd -u ${container_user_uid} -g ${container_user_group} -s /bin/sh -m ${container_user} WORKDIR /home/${container_user}/repos/ +# Runtime environment variables (overridden at deploy time via ConfigMap / secrets) ENV GIT_REPO_URL= - ENV GIT_BRANCH= - ENV MOSIP_DB_NAME= - +ENV DB_SCRIPTS_DIR= ENV DB_SERVERIP= - ENV DB_PORT=5432 - +ENV DEFAULT_DB_NAME=postgres ENV SU_USER=postgres - ENV SU_USER_PWD= - -ENV DEFAULT_DB_NAME=postgres - +ENV DB_UNAME= ENV DBUSER_PWD= - ENV DML_FLAG= -ADD postgres-init.sh postgres-init.sh +COPY postgres-init.sh postgres-init.sh -# change permissions of file inside working dir +# Change permissions of file inside working dir RUN chown -R ${container_user}:${container_user} /home/${container_user}/repos/ -# select container user for all tasks +# Run as non-root user USER ${container_user_uid}:${container_user_gid} -ENTRYPOINT ["./postgres-init.sh" ] \ No newline at end of file +ENTRYPOINT ["./postgres-init.sh"] \ No newline at end of file diff --git a/postgres-init/postgres-init.sh b/postgres-init/postgres-init.sh index 70c5e56..fcaa4aa 100755 --- a/postgres-init/postgres-init.sh +++ b/postgres-init/postgres-init.sh @@ -2,26 +2,29 @@ set -e -echo "Cloning "$GIT_BRANCH "of repo" $GIT_REPO_URL "for" $MOSIP_DB_NAME "db_scripts" - -git clone --depth 1 --branch $GIT_BRANCH $GIT_REPO_URL - -echo "Sucessfully cloned the repository" - -echo "extracting db_scripts" +echo "Cloning $GIT_BRANCH of repo $GIT_REPO_URL for $MOSIP_DB_NAME db_scripts" git_repo_name="$(basename "$GIT_REPO_URL" .git)" -cd $git_repo_name +# Use sparse checkout configured before clone so only db_scripts/ is fetched, +# saving bandwidth instead of cloning the full repo tree first. +git clone --depth 1 --branch "$GIT_BRANCH" --no-checkout --filter=blob:none "$GIT_REPO_URL" + +echo "Successfully cloned the repository" -git sparse-checkout init --cone && git sparse-checkout set db_scripts +cd "$git_repo_name" -find . -type f ! -path "./db_scripts/*" -exec rm -f {} \; +git sparse-checkout init --cone +git sparse-checkout set db_scripts +git checkout echo "Extracted only db_scripts" -cd db_scripts/$MOSIP_DB_NAME +# DB_SCRIPTS_DIR is the folder name inside db_scripts/ in the repo (e.g. mosip_master). +# MOSIP_DB_NAME is the actual Postgres database name to create (e.g. mosip_master02). +# These are decoupled so the repo folder structure never needs to change. +echo "Executing db_script for $MOSIP_DB_NAME (scripts dir: $DB_SCRIPTS_DIR)" -echo "Executing db_script" +cd "db_scripts/$DB_SCRIPTS_DIR" -bash deploy.sh +bash deploy.sh \ No newline at end of file