From 1fedb2fa4b33d859c805e3b6567fc9dd23cbf50e Mon Sep 17 00:00:00 2001 From: Ricardo Weir Date: Tue, 17 Jan 2023 16:11:14 -0700 Subject: [PATCH 1/2] Add startupProbe defaults when fields set Added startupProbe defaults when startupProbe.periodSeconds or startupProbe.failureThreshold are set. --- chart/templates/deployment.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/chart/templates/deployment.yaml b/chart/templates/deployment.yaml index 13f15910d22..7bbb23cf7a7 100644 --- a/chart/templates/deployment.yaml +++ b/chart/templates/deployment.yaml @@ -154,6 +154,14 @@ spec: port: 80 initialDelaySeconds: {{.Values.readinessProbe.initialDelaySeconds | default 5}} periodSeconds: {{ .Values.readinessProbe.periodSeconds | default 30}} +{{- if .Values.startupProbe }} + startupProbe: + httpGet: + path: /healthz + port: 80 + failureThreshold: {{.Values.startupProbe.failureThreshold | default 1}} + periodSeconds: {{ .Values.startupProbe.periodSeconds | default 30}} +{{- end }} resources: {{ toYaml .Values.resources | indent 10 }} volumeMounts: From 72966094a1ea1c84a6a7af2ea5e2af2d11bc582e Mon Sep 17 00:00:00 2001 From: Ricardo Weir Date: Tue, 17 Jan 2023 16:11:21 -0700 Subject: [PATCH 2/2] Add tests --- chart/tests/deployment_test.yaml | 36 ++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/chart/tests/deployment_test.yaml b/chart/tests/deployment_test.yaml index d628b7f4d3b..98c793488ea 100644 --- a/chart/tests/deployment_test.yaml +++ b/chart/tests/deployment_test.yaml @@ -342,3 +342,39 @@ tests: - equal: path: spec.template.spec.containers[0].readinessProbe.periodSeconds value: 60 +- it: should set startupProbe periodSeconds to 60 + set: + startupProbe.periodSeconds: 60 + asserts: + - equal: + path: spec.template.spec.containers[0].startupProbe.periodSeconds + value: 60 + - equal: + path: spec.template.spec.containers[0].startupProbe.failureThreshold + value: 1 + - equal: + path: spec.template.spec.containers[0].startupProbe.httpGet.port + value: 80 + - equal: + path: spec.template.spec.containers[0].startupProbe.httpGet.path + value: /healthz +- it: should set startupProbe failureThreshold to 10 + set: + startupProbe.failureThreshold: 10 + asserts: + - equal: + path: spec.template.spec.containers[0].startupProbe.periodSeconds + value: 30 + - equal: + path: spec.template.spec.containers[0].startupProbe.failureThreshold + value: 10 + - equal: + path: spec.template.spec.containers[0].startupProbe.httpGet.port + value: 80 + - equal: + path: spec.template.spec.containers[0].startupProbe.httpGet.path + value: /healthz +- it: should not have startupProbe if no startupProbe fields set + asserts: + - isNull: + path: spec.template.spec.containers[0].startupProbe