Skip to content

Commit

Permalink
feat(application): add cmd option to live & ready probes (#32)
Browse files Browse the repository at this point in the history
Extend `livenessProbe` and `readinessProbe` with the option `cmd`,
to enable probe execution from inside the container using a custom command.
  • Loading branch information
beiertu-mms authored Jun 2, 2023
1 parent ceb8deb commit 2268883
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
livenessProbe:
cmd: ['curl', '-f', 'http://localhost:8080/.well-known/live']

readinessProbe:
cmd: ['curl', '-f', 'http://localhost:8080/.well-known/ready']
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.1.0
version: 1.2.0
16 changes: 16 additions & 0 deletions charts/application/templates/k8s-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,33 @@ spec:
protocol: {{ $ap.protocol }}
{{- end }}
livenessProbe:
{{- if .Values.livenessProbe.cmd }}
exec:
command:
{{- range .Values.livenessProbe.cmd }}
- {{ . | quote }}
{{- end }}
{{ else }}
httpGet:
path: {{ .Values.livenessProbe.path }}
port: {{ .Values.container.port }}
{{- end }}
initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
failureThreshold: {{ .Values.livenessProbe.failureThreshold }}
timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
readinessProbe:
{{- if .Values.readinessProbe.cmd }}
exec:
command:
{{- range .Values.readinessProbe.cmd }}
- {{ . | quote }}
{{- end }}
{{ else }}
httpGet:
path: {{ .Values.readinessProbe.path }}
port: {{ .Values.container.port }}
{{- end }}
initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }}
Expand Down
6 changes: 6 additions & 0 deletions charts/application/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ autoscaling:
# Check if the container is running
livenessProbe:
path: /.well-known/live
# Use a command to check liveness from inside the container, for example ['curl', '-f', 'http://localhost/health/live'].
# 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.
Expand All @@ -28,6 +31,9 @@ livenessProbe:
# Check if the container are able to service requests
readinessProbe:
path: /.well-known/ready
# Use a command to check readiness 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.
Expand Down

0 comments on commit 2268883

Please sign in to comment.