Skip to content

Commit 11d023a

Browse files
authored
Merge pull request #166 from MediaMarktSaturn/knabben-addstartupprobe
feat(application): add startupProbe for container, and sidecars. Adju…
2 parents e72f104 + 56fd18b commit 11d023a

7 files changed

+77
-1
lines changed

chart-tests/application/ci/test-image-lifecycle-values.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ lifecycle:
1717
preStop:
1818
exec:
1919
command: ["/bin/sh", "-c", "echo exiting"]
20+
startupProbe:
21+
enabled: true
22+
cmd: ['ls']
2023
livenessProbe:
2124
cmd: ['ls']
2225
readinessProbe:

chart-tests/application/ci/test-sidecar-values.yaml

+8
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ sidecars:
1818
env:
1919
ECHO_VALUE: yehaaa
2020
QUARKUS_HTTP_PORT: 9090
21+
startupProbe:
22+
enabled: true
23+
path: /.well-known/live
24+
port: 9090
2125
livenessProbe:
2226
path: /.well-known/live
2327
port: 9090
@@ -39,6 +43,10 @@ sidecars:
3943
env:
4044
ECHO_VALUE: wohooo
4145
QUARKUS_HTTP_PORT: 7070
46+
startupProbe:
47+
enabled: true
48+
path: /.well-known/live
49+
port: 7070
4250
livenessProbe:
4351
path: /.well-known/live
4452
port: 7070

chart-tests/application/ci/test-liveness-readiness-with-cmd.yaml chart-tests/application/ci/test-startup-liveness-readiness-with-cmd.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
startupProbe:
2+
enabled: true
3+
cmd: ['curl', '-f', 'http://localhost:8080/.well-known/live']
4+
15
livenessProbe:
26
cmd: ['curl', '-f', 'http://localhost:8080/.well-known/live']
37

chart-tests/application/ci/test-statefulset-sidecar-values.yaml

+8
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ sidecars:
2121
env:
2222
ECHO_VALUE: yehaaa
2323
QUARKUS_HTTP_PORT: 9090
24+
startupProbe:
25+
enabled: true
26+
path: /.well-known/live
27+
port: 9090
2428
livenessProbe:
2529
path: /.well-known/live
2630
port: 9090
@@ -38,6 +42,10 @@ sidecars:
3842
env:
3943
ECHO_VALUE: wohooo
4044
QUARKUS_HTTP_PORT: 7070
45+
startupProbe:
46+
enabled: true
47+
path: /.well-known/live
48+
port: 7070
4149
livenessProbe:
4250
path: /.well-known/live
4351
port: 7070

charts/application/Chart.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ maintainers:
77
- name: MediaMarktSaturn
88
url: https://github.com/MediaMarktSaturn
99
appVersion: 1.0.0
10-
version: 1.28.0
10+
version: 1.29.0

charts/application/templates/_podTemplate.tpl

+36
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,24 @@ spec:
169169
mountPath: {{ .mountPath }}
170170
{{- end }}
171171
{{- end }}
172+
{{- if $s.startupProbe }}
173+
startupProbe:
174+
{{- if $s.startupProbe.cmd }}
175+
exec:
176+
command:
177+
{{- range $s.startupProbe.cmd }}
178+
- {{ . | quote }}
179+
{{- end }}
180+
{{ else }}
181+
httpGet:
182+
path: {{ $s.startupProbe.path }}
183+
port: {{ $s.startupProbe.port }}
184+
{{- end }}
185+
initialDelaySeconds: {{ $.Values.startupProbe.initialDelaySeconds }}
186+
periodSeconds: {{ $.Values.startupProbe.periodSeconds }}
187+
failureThreshold: {{ $.Values.startupProbe.failureThreshold }}
188+
timeoutSeconds: {{ $.Values.startupProbe.timeoutSeconds }}
189+
{{- end }}
172190
{{- if $s.livenessProbe }}
173191
livenessProbe:
174192
{{- if $s.livenessProbe.cmd }}
@@ -273,6 +291,24 @@ spec:
273291
containerPort: {{ $ap.containerPort }}
274292
protocol: {{ $ap.protocol }}
275293
{{- end }}
294+
{{- if .Values.startupProbe.enabled }}
295+
startupProbe:
296+
{{- if .Values.startupProbe.cmd }}
297+
exec:
298+
command:
299+
{{- range .Values.startupProbe.cmd }}
300+
- {{ . | quote }}
301+
{{- end }}
302+
{{ else }}
303+
httpGet:
304+
path: {{ .Values.startupProbe.path }}
305+
port: {{ .Values.container.port }}
306+
{{- end }}
307+
initialDelaySeconds: {{ .Values.startupProbe.initialDelaySeconds }}
308+
periodSeconds: {{ .Values.startupProbe.periodSeconds }}
309+
failureThreshold: {{ .Values.startupProbe.failureThreshold }}
310+
timeoutSeconds: {{ .Values.startupProbe.timeoutSeconds }}
311+
{{- end }}
276312
{{- if .Values.livenessProbe.enabled }}
277313
livenessProbe:
278314
{{- if .Values.livenessProbe.cmd }}

charts/application/values.yaml

+17
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,23 @@ autoscaling:
2222
cpu: 80
2323
# memory: 80
2424

25+
# Check if the container is started
26+
startupProbe:
27+
# Allows to disable the startup probe
28+
enabled: false
29+
path: /.well-known/live
30+
# Use a command to check startup from inside the container, for example ['curl', '-f', 'http://localhost/health/ready'].
31+
# This will take precedence over the given `path` value, if provided.
32+
cmd: []
33+
# Number of seconds after the container has started before liveness or readiness probes are initiated.
34+
initialDelaySeconds: 10
35+
# How often (in seconds) to perform the probe.
36+
periodSeconds: 10
37+
# When a probe fails, Kubernetes will try failureThreshold times before giving up.
38+
failureThreshold: 3
39+
# Number of seconds after which the probe times out.
40+
timeoutSeconds: 5
41+
2542
# Check if the container is running
2643
livenessProbe:
2744
# Allows to disable the liveness probe

0 commit comments

Comments
 (0)