From 3879b59f43f36f516a460da12912177c0f6d0dcc Mon Sep 17 00:00:00 2001 From: Jirka Kremser Date: Mon, 3 Oct 2022 17:36:14 +0200 Subject: [PATCH] Add a way to customize liveness and readiness probes in helm chart Signed-off-by: Jirka Kremser --- charts/podinfo/templates/deployment.yaml | 18 ++++++++++++++---- charts/podinfo/values.yaml | 15 +++++++++++++++ 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/charts/podinfo/templates/deployment.yaml b/charts/podinfo/templates/deployment.yaml index 689bb0c..1344609 100644 --- a/charts/podinfo/templates/deployment.yaml +++ b/charts/podinfo/templates/deployment.yaml @@ -136,8 +136,13 @@ spec: - check - http - localhost:{{ .Values.service.httpPort | default 9898 }}/healthz - initialDelaySeconds: 1 - timeoutSeconds: 5 + {{- with .Values.probes.liveness }} + initialDelaySeconds: {{ .initialDelaySeconds | default 1 }} + timeoutSeconds: {{ .timeoutSeconds | default 5 }} + failureThreshold: {{ .failureThreshold | default 3 }} + successThreshold: {{ .successThreshold | default 1 }} + periodSeconds: {{ .periodSeconds | default 10 }} + {{- end }} readinessProbe: exec: command: @@ -145,8 +150,13 @@ spec: - check - http - localhost:{{ .Values.service.httpPort | default 9898 }}/readyz - initialDelaySeconds: 1 - timeoutSeconds: 5 + {{- with .Values.probes.readiness }} + initialDelaySeconds: {{ .initialDelaySeconds | default 1 }} + timeoutSeconds: {{ .timeoutSeconds | default 5 }} + failureThreshold: {{ .failureThreshold | default 3 }} + successThreshold: {{ .successThreshold | default 1 }} + periodSeconds: {{ .periodSeconds | default 10 }} + {{- end }} volumeMounts: - name: data mountPath: /data diff --git a/charts/podinfo/values.yaml b/charts/podinfo/values.yaml index 6e2a5c2..68ed887 100644 --- a/charts/podinfo/values.yaml +++ b/charts/podinfo/values.yaml @@ -140,3 +140,18 @@ tolerations: [] affinity: {} podAnnotations: {} + +# https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes +probes: + readiness: + initialDelaySeconds: 1 + timeoutSeconds: 5 + failureThreshold: 3 + successThreshold: 1 + periodSeconds: 10 + liveness: + initialDelaySeconds: 1 + timeoutSeconds: 5 + failureThreshold: 3 + successThreshold: 1 + periodSeconds: 10