Skip to content

Commit

Permalink
Merge pull request #2 from natrongmbh/enhancements
Browse files Browse the repository at this point in the history
add init container to check if db is ready, only when db is deployed
  • Loading branch information
janlauber authored Sep 7, 2022
2 parents 8b2060f + 736e9f2 commit d3bc3be
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions charts/safir/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,21 @@ spec:
{{- if .Values.initContainers }}
{{- include "common.tplvalues.render" (dict "value" .Values.initContainers "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.postgresql.enabled }}
# pg_isready init container to check if the database is ready
- name: pg-isready
image: postgres
command:
- 'sh'
- '-c'
- |
until pg_isready -h {{ .Release.Name }}-postgresql.{{ .Release.Namespace }}.svc.cluster.local -p 5432; do
echo "Waiting for PostgreSQL to be ready..."
sleep 2
done
- 'echo'
- 'PostgreSQL is ready'
{{- end }}
containers:
- name: apache
image: {{ include "safir.apache.image" . }}
Expand Down

0 comments on commit d3bc3be

Please sign in to comment.