Skip to content

Commit

Permalink
Merge pull request #166 from MediaMarktSaturn/knabben-addstartupprobe
Browse files Browse the repository at this point in the history
feat(application): add startupProbe for container, and sidecars. Adju…
  • Loading branch information
heubeck authored Dec 3, 2024
2 parents e72f104 + 56fd18b commit 11d023a
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 1 deletion.
3 changes: 3 additions & 0 deletions chart-tests/application/ci/test-image-lifecycle-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ lifecycle:
preStop:
exec:
command: ["/bin/sh", "-c", "echo exiting"]
startupProbe:
enabled: true
cmd: ['ls']
livenessProbe:
cmd: ['ls']
readinessProbe:
Expand Down
8 changes: 8 additions & 0 deletions chart-tests/application/ci/test-sidecar-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ sidecars:
env:
ECHO_VALUE: yehaaa
QUARKUS_HTTP_PORT: 9090
startupProbe:
enabled: true
path: /.well-known/live
port: 9090
livenessProbe:
path: /.well-known/live
port: 9090
Expand All @@ -39,6 +43,10 @@ sidecars:
env:
ECHO_VALUE: wohooo
QUARKUS_HTTP_PORT: 7070
startupProbe:
enabled: true
path: /.well-known/live
port: 7070
livenessProbe:
path: /.well-known/live
port: 7070
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
startupProbe:
enabled: true
cmd: ['curl', '-f', 'http://localhost:8080/.well-known/live']

livenessProbe:
cmd: ['curl', '-f', 'http://localhost:8080/.well-known/live']

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ sidecars:
env:
ECHO_VALUE: yehaaa
QUARKUS_HTTP_PORT: 9090
startupProbe:
enabled: true
path: /.well-known/live
port: 9090
livenessProbe:
path: /.well-known/live
port: 9090
Expand All @@ -38,6 +42,10 @@ sidecars:
env:
ECHO_VALUE: wohooo
QUARKUS_HTTP_PORT: 7070
startupProbe:
enabled: true
path: /.well-known/live
port: 7070
livenessProbe:
path: /.well-known/live
port: 7070
Expand Down
2 changes: 1 addition & 1 deletion charts/application/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ maintainers:
- name: MediaMarktSaturn
url: https://github.com/MediaMarktSaturn
appVersion: 1.0.0
version: 1.28.0
version: 1.29.0
36 changes: 36 additions & 0 deletions charts/application/templates/_podTemplate.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,24 @@ spec:
mountPath: {{ .mountPath }}
{{- end }}
{{- end }}
{{- if $s.startupProbe }}
startupProbe:
{{- if $s.startupProbe.cmd }}
exec:
command:
{{- range $s.startupProbe.cmd }}
- {{ . | quote }}
{{- end }}
{{ else }}
httpGet:
path: {{ $s.startupProbe.path }}
port: {{ $s.startupProbe.port }}
{{- end }}
initialDelaySeconds: {{ $.Values.startupProbe.initialDelaySeconds }}
periodSeconds: {{ $.Values.startupProbe.periodSeconds }}
failureThreshold: {{ $.Values.startupProbe.failureThreshold }}
timeoutSeconds: {{ $.Values.startupProbe.timeoutSeconds }}
{{- end }}
{{- if $s.livenessProbe }}
livenessProbe:
{{- if $s.livenessProbe.cmd }}
Expand Down Expand Up @@ -273,6 +291,24 @@ spec:
containerPort: {{ $ap.containerPort }}
protocol: {{ $ap.protocol }}
{{- end }}
{{- if .Values.startupProbe.enabled }}
startupProbe:
{{- if .Values.startupProbe.cmd }}
exec:
command:
{{- range .Values.startupProbe.cmd }}
- {{ . | quote }}
{{- end }}
{{ else }}
httpGet:
path: {{ .Values.startupProbe.path }}
port: {{ .Values.container.port }}
{{- end }}
initialDelaySeconds: {{ .Values.startupProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.startupProbe.periodSeconds }}
failureThreshold: {{ .Values.startupProbe.failureThreshold }}
timeoutSeconds: {{ .Values.startupProbe.timeoutSeconds }}
{{- end }}
{{- if .Values.livenessProbe.enabled }}
livenessProbe:
{{- if .Values.livenessProbe.cmd }}
Expand Down
17 changes: 17 additions & 0 deletions charts/application/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,23 @@ autoscaling:
cpu: 80
# memory: 80

# Check if the container is started
startupProbe:
# Allows to disable the startup probe
enabled: false
path: /.well-known/live
# Use a command to check startup from inside the container, for example ['curl', '-f', 'http://localhost/health/ready'].
# This will take precedence over the given `path` value, if provided.
cmd: []
# Number of seconds after the container has started before liveness or readiness probes are initiated.
initialDelaySeconds: 10
# How often (in seconds) to perform the probe.
periodSeconds: 10
# When a probe fails, Kubernetes will try failureThreshold times before giving up.
failureThreshold: 3
# Number of seconds after which the probe times out.
timeoutSeconds: 5

# Check if the container is running
livenessProbe:
# Allows to disable the liveness probe
Expand Down

0 comments on commit 11d023a

Please sign in to comment.