[stable/postgresql] Make readiness probe compatible for most postgresql images (#14516)

* Make readiness probe compatible for most postgresql images

Signed-off-by: tompizmor <tompizmor@gmail.com>

* Simplify logic for generating readiness probe command

Signed-off-by: tompizmor <tompizmor@gmail.com>
This commit is contained in:
Tomas Pizarro
2019-06-05 06:53:54 -07:00
committed by Kubernetes Prow Robot
parent e05f71b98f
commit 60d89aa165
4 changed files with 18 additions and 11 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
apiVersion: v1
name: postgresql
version: 5.3.1
version: 5.3.2
appVersion: 11.3.0
description: Chart for PostgreSQL, an object-relational database management system (ORDBMS) with an emphasis on extensibility and on standards-compliance.
keywords:
+15
View File
@@ -295,3 +295,18 @@ imagePullSecrets:
{{- end }}
{{- end -}}
{{- end -}}
{{/*
Get the readiness probe command
*/}}
{{- define "postgresql.readinessProbeCommand" -}}
- |
{{- if (include "postgresql.database" .) }}
pg_isready -U {{ include "postgresql.username" . | quote }} -d {{ (include "postgresql.database" .) | quote }} -h 127.0.0.1 -p {{ template "postgresql.port" . }}
{{- else }}
pg_isready -U {{ include "postgresql.username" . | quote }} -h 127.0.0.1 -p {{ template "postgresql.port" . }}
{{- end }}
{{- if contains "bitnami/" .Values.image.repository }}
[ -f /opt/bitnami/postgresql/tmp/.initialized ]
{{- end -}}
{{- end -}}
@@ -155,11 +155,7 @@ spec:
command:
- sh
- -c
{{- if (include "postgresql.database" .) }}
- pg_isready -U {{ include "postgresql.username" . | quote }} -d {{ (include "postgresql.database" .) | quote }} -h 127.0.0.1 -p {{ template "postgresql.port" . }} && [ -f /opt/bitnami/postgresql/tmp/.initialized ]
{{- else }}
- pg_isready -U {{ include "postgresql.username" . | quote }} -h 127.0.0.1 -p {{ template "postgresql.port" . }} && [ -f /opt/bitnami/postgresql/tmp/.initialized ]
{{- end }}
{{- include "postgresql.readinessProbeCommand" . | nindent 12 }}
initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }}
+1 -5
View File
@@ -180,11 +180,7 @@ spec:
command:
- sh
- -c
{{- if (include "postgresql.database" .) }}
- pg_isready -U {{ include "postgresql.username" . | quote }} -d {{ (include "postgresql.database" .) | quote }} -h 127.0.0.1 -p {{ template "postgresql.port" . }} && [ -f /opt/bitnami/postgresql/tmp/.initialized ]
{{- else }}
- pg_isready -U {{ include "postgresql.username" . | quote }} -h 127.0.0.1 -p {{ template "postgresql.port" . }} && [ -f /opt/bitnami/postgresql/tmp/.initialized ]
{{- end }}
{{- include "postgresql.readinessProbeCommand" . | nindent 12 }}
initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }}