From d447bcc72eff6ba03731df04e976999be406ca32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=B6ran=20P=C3=B6hner?= <10630407+groundhog2k@users.noreply.github.com> Date: Thu, 30 Dec 2021 13:07:21 +0100 Subject: [PATCH] Add startup probe for postgres (#763) --- charts/postgres/Chart.yaml | 2 +- charts/postgres/README.md | 4 +++- charts/postgres/templates/statefulset.yaml | 20 ++++++++++++++++++++ charts/postgres/values.yaml | 12 ++++++++++++ 4 files changed, 36 insertions(+), 2 deletions(-) diff --git a/charts/postgres/Chart.yaml b/charts/postgres/Chart.yaml index 35a7ecaf..93f3ba44 100644 --- a/charts/postgres/Chart.yaml +++ b/charts/postgres/Chart.yaml @@ -7,6 +7,6 @@ type: application maintainers: - name: groundhog2k -version: 0.3.1 +version: 0.3.2 appVersion: "14.1" diff --git a/charts/postgres/README.md b/charts/postgres/README.md index ce6fbdce..76bf5083 100644 --- a/charts/postgres/README.md +++ b/charts/postgres/README.md @@ -1,6 +1,6 @@ # PostgreSQL -   +   A Helm chart for PostgreSQL on Kubernetes @@ -59,8 +59,10 @@ $ helm uninstall my-release | image.repository | string | `"postgres"` | Image name | | image.tag | string | `""` | Image tag | | imagePullSecrets | list | `[]` | Image pull secrets | +| startupProbe | object | `see values.yaml` | Startup probe configuration | | livenessProbe | object | `see values.yaml` | Liveness probe configuration | | readinessProbe | object | `see values.yaml` | Readiness probe configuration | +| customStartupProbe | object | `{}` | Custom startup probe (overwrites default startup probe configuration) | | customLivenessProbe | object | `{}` | Custom liveness probe (overwrites default liveness probe configuration) | | customReadinessProbe | object | `{}` | Custom readiness probe (overwrites default readiness probe configuration) | | resources | object | `{}` | Resource limits and requests | diff --git a/charts/postgres/templates/statefulset.yaml b/charts/postgres/templates/statefulset.yaml index 0a862bcf..1a7ad7c5 100644 --- a/charts/postgres/templates/statefulset.yaml +++ b/charts/postgres/templates/statefulset.yaml @@ -64,6 +64,26 @@ spec: envFrom: - secretRef: name: {{ include "postgres.fullname" . }} + {{- if .Values.customStartupProbe }} + startupProbe: + {{- toYaml .Values.customStartupProbe | nindent 12 }} + {{- else }} + {{- if .Values.startupProbe.enabled }} + startupProbe: + exec: + command: + - sh + - -c + - pg_isready -h localhost + {{- with .Values.startupProbe }} + initialDelaySeconds: {{ .initialDelaySeconds }} + timeoutSeconds: {{ .timeoutSeconds }} + failureThreshold: {{ .failureThreshold }} + successThreshold: {{ .successThreshold }} + periodSeconds: {{ .periodSeconds }} + {{- end }} + {{- end }} + {{- end }} {{- if .Values.customLivenessProbe }} livenessProbe: {{- toYaml .Values.customLivenessProbe | nindent 12 }} diff --git a/charts/postgres/values.yaml b/charts/postgres/values.yaml index 66f8abd7..87f367f3 100644 --- a/charts/postgres/values.yaml +++ b/charts/postgres/values.yaml @@ -73,6 +73,18 @@ affinity: {} ## Maximum number of revisions maintained in revision history revisionHistoryLimit: +## Custom startup probe (overwrites default startup probe) +customStartupProbe: {} + +## Default startup check +startupProbe: + enabled: true + initialDelaySeconds: 10 + timeoutSeconds: 5 + failureThreshold: 30 + successThreshold: 1 + periodSeconds: 10 + ## Custom liveness probe (overwrites default liveness probe) customLivenessProbe: {} -- GitLab