Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: ability to override liveness and readiness probe paths #1041

Merged
merged 3 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions traefik/templates/_podtemplate.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,14 @@
{{- $healthchecksPort := (default (.Values.ports.traefik).port .Values.deployment.healthchecksPort) }}
{{- $healthchecksHost := (default (.Values.ports.traefik).hostIP .Values.deployment.healthchecksHost) }}
{{- $healthchecksScheme := (default "HTTP" .Values.deployment.healthchecksScheme) }}
{{- $readinessPath := (default "/ping" .Values.deployment.readinessPath) }}
{{- $livenessPath := (default "/ping" .Values.deployment.livenessPath) }}
readinessProbe:
httpGet:
{{- with $healthchecksHost }}
host: {{ . }}
{{- end }}
path: /ping
path: {{ $readinessPath }}
port: {{ $healthchecksPort }}
scheme: {{ $healthchecksScheme }}
{{- toYaml .Values.readinessProbe | nindent 10 }}
Expand All @@ -80,7 +82,7 @@
{{- with $healthchecksHost }}
host: {{ . }}
{{- end }}
path: /ping
path: {{ $livenessPath }}
port: {{ $healthchecksPort }}
scheme: {{ $healthchecksScheme }}
{{- toYaml .Values.livenessProbe | nindent 10 }}
Expand Down
20 changes: 20 additions & 0 deletions traefik/tests/traefik-config_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -278,12 +278,18 @@ tests:
- equal:
path: spec.template.spec.containers[0].livenessProbe.httpGet.port
value: 9001
- equal:
path: spec.template.spec.containers[0].livenessProbe.httpGet.path
value: "/ping"
- equal:
path: spec.template.spec.containers[0].readinessProbe.httpGet.port
value: 9001
- equal:
path: spec.template.spec.containers[0].readinessProbe.httpGet.scheme
value: "HTTP"
- equal:
path: spec.template.spec.containers[0].readinessProbe.httpGet.path
value: "/ping"
- contains:
path: spec.template.spec.containers[0].args
content: "--ping"
Expand Down Expand Up @@ -318,6 +324,20 @@ tests:
- contains:
path: spec.template.spec.containers[0].args
content: "--ping.entrypoint=websecure"
- it: should set custom probe paths
set:
additionalArguments:
- --ping
deployment:
readinessPath: /ready
livenessPath: /alive
asserts:
- equal:
path: spec.template.spec.containers[0].livenessProbe.httpGet.path
value: /alive
- equal:
path: spec.template.spec.containers[0].readinessProbe.httpGet.path
value: /ready
- it: should enable tls on websecure entrypoints by default
asserts:
- contains:
Expand Down
6 changes: 6 additions & 0 deletions traefik/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ deployment:
## Override the liveness/readiness scheme. Useful for getting ping to
## respond on websecure entryPoint.
# healthchecksScheme: HTTPS
## Override the readiness path.
## Default: /ping
# readinessPath: /ping
# Override the liveness path.
# Default: /ping
# livenessPath: /ping
# -- Additional deployment annotations (e.g. for jaeger-operator sidecar injection)
annotations: {}
# -- Additional deployment labels (e.g. for filtering deployment by custom labels)
Expand Down