Skip to content

Commit

Permalink
SPAR: Added Postgres init. Fixed nested dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
lalithkota committed Feb 2, 2024
1 parent 7298ced commit c74b403
Show file tree
Hide file tree
Showing 13 changed files with 99 additions and 12 deletions.
14 changes: 10 additions & 4 deletions charts/social-payments-account-registry/Chart.lock
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
dependencies:
- name: postgresql
repository: oci://registry-1.docker.io/bitnamicharts
version: 13.2.24
version: 13.4.4
- name: redis
repository: oci://registry-1.docker.io/bitnamicharts
version: 18.5.0
digest: sha256:f7a78c28904bfb08c2c1b1daf44c8ffa57faeb9a5df4ae82274e68e54b7cc31b
generated: "2023-12-11T21:54:58.092231288+05:30"
version: 18.12.0
- name: spar-g2pconnect-id-mapper
repository: ""
version: 0.1.0
- name: sunbird-rc-g2p-mapper-registry
repository: ""
version: 0.1.0
digest: sha256:1e9deadb92614547a6635a0a81e152362d46ceb9d9dd8f7e6cac6eb208c7dd7c
generated: "2024-02-02T02:08:46.452615943+05:30"
6 changes: 6 additions & 0 deletions charts/social-payments-account-registry/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,9 @@ dependencies:
repository: oci://registry-1.docker.io/bitnamicharts
version: 18.x.x
condition: redis.enabled
- name: spar-g2pconnect-id-mapper
version: 0.1.0
condition: spar-g2pconnect-id-mapper.enabled
- name: sunbird-rc-g2p-mapper-registry
version: 0.1.0
condition: sunbird-rc-g2p-mapper-registry.enabled
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
23 changes: 23 additions & 0 deletions charts/social-payments-account-registry/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,26 @@ Render Env values section
{{- end }}
{{- end }}
{{- end }}

{{/*
Render Postgres Init Env values
*/}}
{{- define "spar.postgresInitEnvVars" -}}
{{- range $k, $v := .Values.postgresInit.envVars }}
- name: {{ $k }}
value: {{ tpl $v $ | quote }}
{{- end }}
{{- range $k, $v := .Values.postgresInit.envVarsFrom }}
- name: {{ $k }}
valueFrom:
{{- if $v.configMapKeyRef }}
configMapKeyRef:
name: {{ tpl $v.configMapKeyRef.name $ | quote }}
key: {{ tpl $v.configMapKeyRef.key $ | quote }}
{{- else if $v.secretKeyRef }}
secretKeyRef:
name: {{ tpl $v.secretKeyRef.name $ | quote }}
key: {{ tpl $v.secretKeyRef.key $ | quote }}
{{- end }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{{- if .Values.postgresInit.enabled }}
apiVersion: batch/v1
kind: Job
metadata:
name: {{ include "spar.fullname" . }}-postgres-init
labels:
{{- include "spar.labels" . | nindent 4 }}
annotations:
"helm.sh/hook": post-install,post-upgrade
spec:
backoffLimit: {{ .Values.postgresInit.backoffLimit }}
template:
spec:
restartPolicy: {{ .Values.postgresInit.restartPolicy }}
serviceAccountName: {{ include "spar.serviceAccountName" . }}
containers:
- name: postgres-init
image: {{ .Values.postgresInit.image }}
imagePullPolicy: {{ .Values.postgresInit.imagePullPolicy }}
env:
{{ include "spar.envVars" . | nindent 10 }}
{{ include "spar.postgresInitEnvVars" . | nindent 10 }}
command: {{ toYaml .Values.postgresInit.command | nindent 10 }}
{{- end }}
33 changes: 29 additions & 4 deletions charts/social-payments-account-registry/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,11 @@ spar-g2pconnect-id-mapper:
postgresql:
enabled: false
envVars:
SPAR_G2PCONNECT_MAPPER_DB_HOSTNAME: '{{ include "postgresql.v1.primary.fullname" .Subcharts.postgresql }}'
SPAR_G2PCONNECT_MAPPER_DB_HOSTNAME: spar-postgresql # Change this value acc to name of the helm release.
envVarsFrom:
SPAR_G2PCONNECT_MAPPER_DB_PASSWORD:
secretKeyRef:
name: '{{ include "postgresql.v1.primary.fullname" .Subcharts.postgresql }}'
name: spar-postgresql # Change this value acc to name of the helm release.

sunbird-rc-g2p-mapper-registry:
enabled: false
Expand All @@ -164,10 +164,35 @@ sunbird-rc-g2p-mapper-registry:
postgresql:
enabled: false
envVars:
connectionInfo_uri: 'jdbc:postgresql://{{ include "postgresql.v1.primary.fullname" .Subcharts.postgresql }}:5432/spardb'
connectionInfo_uri: 'jdbc:postgresql://spar-postgresql:5432/spardb' # Change this value acc to name of the helm release.
connectionInfo_username: sparuser
envVarsFrom:
connectionInfo_password:
secretKeyRef:
name: '{{ include "postgresql.v1.primary.fullname" .Subcharts.postgresql }}'
name: 'spar-postgresql' # Change this value acc to name of the helm release.
key: password

postgresInit:
enabled: true
image: jbergknoff/postgresql-client
imagePullPolicy: Always
restartPolicy: Never
envVars:
GIT_REPO_URL: 'https://github.com/lalithkota/social-payments-account-registry'
GIT_BRANCH: 'develop'
DEPLOY_DDL: 'false'
envVarsFrom: {}
backoffLimit: 1
command:
- sh
- -c
- >-
sleep 10s;
apk --no-cache add bash gettext git;
export DB_HOST=$SPAR_CORE_DB_HOSTNAME;
export DB_USER=$SPAR_CORE_DB_USERNAME;
export DB_USER_PASSWORD=$SPAR_CORE_DB_PASSWORD;
git_repo_name="$(basename "$GIT_REPO_URL" .git)";
git clone --depth 1 --branch $GIT_BRANCH $GIT_REPO_URL &&
cd $git_repo_name/db_scripts &&
./deploy.sh
3 changes: 0 additions & 3 deletions charts/spar-g2pconnect-id-mapper/README.md

This file was deleted.

1 change: 1 addition & 0 deletions charts/spar-self-service-ui/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ affinity: {}
envVars:
NEXT_PUBLIC_BASE_PATH: "/selfservice"
NEXT_PUBLIC_BASE_API_PATH: "/spar/v1"
NEXT_PUBLIC_DEFAULT_GET_FA_RAW: 'true'

envVarsFrom: {}

Expand Down
6 changes: 6 additions & 0 deletions charts/sunbird-rc-g2p-mapper-registry/Chart.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dependencies:
- name: sunbird-rc-core
repository: ""
version: 0.1.0
digest: sha256:24f4549722655b1465bab18e796ed8431b8d7fbd10d2068ff672eff3ece06f67
generated: "2024-02-02T02:10:39.540261102+05:30"
1 change: 0 additions & 1 deletion charts/sunbird-rc-g2p-mapper-registry/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@ appVersion: "v0.1.0"
dependencies:
- name: sunbird-rc-core
version: 0.1.0
repository: file://charts/sunbird-rc-core
alias: registry
condition: registry.enabled

0 comments on commit c74b403

Please sign in to comment.