Skip to content

Commit

Permalink
feat: ability to override liveness and readiness probe paths
Browse files Browse the repository at this point in the history
  • Loading branch information
matkam committed Apr 29, 2024
1 parent c204014 commit ea95df0
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
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

0 comments on commit ea95df0

Please sign in to comment.