Skip to content

Commit

Permalink
feat: seed data through init container after flyway for PR deployments (
Browse files Browse the repository at this point in the history
#521)

Co-authored-by: goemen <[email protected]>
  • Loading branch information
sukanya-rath and goemen authored Jun 3, 2024
1 parent 5d80c32 commit 56981ea
Show file tree
Hide file tree
Showing 5 changed files with 660 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ spec:
- name: {{ include "backend.fullname" . }}-admin-session
persistentVolumeClaim:
claimName: {{ include "backend.fullname" . }}-admin-session
{{- if .Values.global.seedData }}
- name: {{ include "backend.fullname" . }}-seed-data-config
configMap:
name: {{ .Release.Name }}-seed-data-config
{{- end }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
initContainers:
Expand Down Expand Up @@ -70,6 +75,28 @@ spec:
value: "pay_transparency"
- name: FLYWAY_CONNECT_RETRIES
value: "10"
{{- if .Values.global.seedData }}
- name: {{ include "backend.fullname" . }}-seed
image: "artifacts.developer.gov.bc.ca/docker-remote/flyway/flyway:10-alpine"
command: ["flyway"]
args: ["info", "migrate", "info"]
imagePullPolicy: {{ .Values.image.pullPolicy }}
resources:
{{- toYaml .Values.initResources | nindent 12 }}
envFrom:
- secretRef:
name: {{.Release.Name}}
env:
- name: FLYWAY_URL
value: "jdbc:postgresql://{{.Release.Name}}-database:5432/{{ .Values.global.secrets.databaseName}}"
- name: FLYWAY_DEFAULT_SCHEMA
value: "pay_transparency"
- name: FLYWAY_CONNECT_RETRIES
value: "10"
volumeMounts:
- name: {{ include "backend.fullname" . }}-seed-data-config
mountPath: /flyway/sql
{{- end }}
containers:
- name: {{ include "backend.fullname" . }}
securityContext:
Expand Down
Loading

0 comments on commit 56981ea

Please sign in to comment.