Skip to content

Commit

Permalink
refactor(charts): wait-postgresql initContainer moved to the Helm hel…
Browse files Browse the repository at this point in the history
…per templates

Signed-off-by: Kaan Yagci <[email protected]>
  • Loading branch information
kaanyagci committed Oct 5, 2023
1 parent 3e14d9b commit e4a8800
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 13 deletions.
9 changes: 8 additions & 1 deletion charts/substra-backend/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -194,4 +194,11 @@ The hostname we should connect to (external is defined, otherwise integrated)
{{- else }}
{{- template "postgresql.primary.fullname" .Subcharts.postgresql }}.{{ .Release.Namespace }}
{{- end }}
{{- end -}}
{{- end -}}
# charts/<your_chart>/templates/_helpers.tpl
{{- define "common.waitPostgresqlInitContainer" -}}
- name: wait-postgresql
image: jwilder/dockerize:0.6.1
command: ['dockerize', '-wait', 'tcp://{{ template "substra-backend.database.host" . }}:{{ .Values.database.port }}']
{{- end -}}
4 changes: 1 addition & 3 deletions charts/substra-backend/templates/deployment-api-events.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,7 @@ spec:
- mountPath: /tmp/certs/
name: ssl-certs
{{- end }}
- name: wait-postgresql
image: jwilder/dockerize:0.6.1
command: ['dockerize', '-wait', 'tcp://{{ template "substra-backend.database.host" . }}:{{ .Values.database.port }}']
{{- include "common.waitPostgresqlInitContainer" . | nindent 8 }}
- name: wait-init-migrations
image: {{ include "substra-backend.images.name" (dict "img" .Values.api.events.image "defaultTag" $.Chart.AppVersion) }}
command: ['bash', '/usr/src/app/wait-init-migration.sh']
Expand Down
4 changes: 1 addition & 3 deletions charts/substra-backend/templates/deployment-server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,7 @@ spec:
- mountPath: /tmp/certs/
name: ssl-certs
{{- end }}
- name: wait-postgresql
image: jwilder/dockerize:0.6.1
command: ['dockerize', '-wait', 'tcp://{{ template "substra-backend.database.host" . }}:{{ .Values.database.port }}']
{{- include "common.waitPostgresqlInitContainer" . | nindent 6 }}
- name: wait-minio
image: jwilder/dockerize:0.6.1
command: ['dockerize', '-wait', 'tcp://{{ .Release.Name }}-minio:9000']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,7 @@ spec:
- mountPath: /tmp/certs/
name: ssl-certs
{{- end }}
- name: wait-postgresql
image: jwilder/dockerize:0.6.1
command: ['dockerize', '-wait', 'tcp://{{ template "substra-backend.database.host" . }}:{{ .Values.database.port }}']
{{- include "common.waitPostgresqlInitContainer" . | nindent 8 }}
- name: wait-init-migrations
image: {{ include "substra-backend.images.name" (dict "img" .Values.worker.events.image "defaultTag" $.Chart.AppVersion) }}
command: ['bash', '/usr/src/app/wait-init-migration.sh']
Expand Down
4 changes: 1 addition & 3 deletions charts/substra-backend/templates/statefulset-worker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,7 @@ spec:
mountPath: /kaniko/.docker
{{- end }}
{{- end}}
- name: wait-postgresql
image: jwilder/dockerize:0.6.1
command: ['dockerize', '-wait', 'tcp://{{ template "substra-backend.database.host" . }}:{{ .Values.database.port }}']
{{- include "common.waitPostgresqlInitContainer" . | nindent 6 }}
- name: wait-minio
image: jwilder/dockerize:0.6.1
command: ['dockerize', '-wait', 'tcp://{{ .Release.Name }}-minio:9000']
Expand Down

0 comments on commit e4a8800

Please sign in to comment.