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

fix: 💥 BREAKING CHANGE on healthchecks and traefik port #898

Merged
merged 3 commits into from
Aug 1, 2023
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
9 changes: 4 additions & 5 deletions traefik/templates/_podtemplate.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,11 @@
{{- with .Values.resources }}
{{- toYaml . | nindent 10 }}
{{- end }}
{{- $healthchecksPort := .Values.ports.web.port }}
{{- $healthchecksScheme := "HTTP" }}
{{- if .Values.ports.traefik }}
{{- $healthchecksPort = (default .Values.ports.traefik.port .Values.ports.traefik.healthchecksPort) }}
{{- $healthchecksScheme = (default "HTTP" .Values.ports.traefik.healthchecksScheme) }}
{{- if (and (empty .Values.ports.traefik) (empty .Values.deployment.healthchecksPort)) }}
{{- fail "ERROR: When disabling traefik port, you need to specify `deployment.healthchecksPort`" }}
{{- end }}
{{- $healthchecksPort := (default (.Values.ports.traefik).port .Values.deployment.healthchecksPort) }}
{{- $healthchecksScheme := (default "HTTP" .Values.deployment.healthchecksScheme) }}
readinessProbe:
httpGet:
path: /ping
Expand Down
52 changes: 51 additions & 1 deletion traefik/tests/ports-config_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,8 @@ tests:
template: deployment.yaml
- it: should be possible to disable traefik & metrics port
set:
deployment:
healthchecksPort: 80
ports:
web:
port: 80
Expand Down Expand Up @@ -272,4 +274,52 @@ tests:
kind: Service
apiVersion: v1
template: service.yaml

- it: should be possible to disable web, metrics & websecure port
set:
ports:
web: null
websecure: null
metrics: null
traefik:
port: 8082
http-internal:
port: 8443
tls:
enabled: true
expose: true
http-external:
port: 8445
tls:
enabled: true
expose: true
asserts:
- containsDocument:
kind: Deployment
apiVersion: apps/v1
template: deployment.yaml
- notContains:
path: spec.template.spec.containers[0].ports
content:
name: "metrics"
containerPort: 9100
protocol: "TCP"
template: deployment.yaml
- notContains:
path: spec.template.spec.containers[0].ports
content:
name: "traefik"
containerPort: 9100
protocol: "TCP"
template: deployment.yaml
- containsDocument:
kind: Service
apiVersion: v1
template: service.yaml
- it: should fail when disabling traefik port and not specifying an healthcheck port
set:
ports:
traefik: null
asserts:
- failedTemplate:
errorMessage: "When disabling traefik port, you need to specify `deployment.healthchecksPort`"
template: deployment.yaml
8 changes: 5 additions & 3 deletions traefik/tests/traefik-config_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -233,10 +233,11 @@ tests:
additionalArguments:
- --ping
- --ping.entrypoint=web
deployment:
healthchecksPort: 9001
ports:
traefik:
port: 9000
healthchecksPort: 9001
exposedPort: 9000
asserts:
- equal:
Expand All @@ -259,11 +260,12 @@ tests:
additionalArguments:
- --ping
- --ping.entrypoint=websecure
deployment:
healthchecksScheme: HTTPS
healthchecksPort: 8443
ports:
traefik:
port: 9000
healthchecksPort: 8443
healthchecksScheme: HTTPS
exposedPort: 9000
asserts:
- equal:
Expand Down
20 changes: 9 additions & 11 deletions traefik/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ deployment:
terminationGracePeriodSeconds: 60
# -- The minimum number of seconds Traefik needs to be up and running before the DaemonSet/Deployment controller considers it available
minReadySeconds: 0
## Override the liveness/readiness port. This is useful to integrate traefik
## with an external Load Balancer that performs healthchecks.
## Default: ports.traefik.port
# healthchecksPort: 9000
## Override the liveness/readiness scheme. Useful for getting ping to
## respond on websecure entryPoint.
# healthchecksScheme: HTTPS
# -- Additional deployment annotations (e.g. for jaeger-operator sidecar injection)
annotations: {}
# -- Additional deployment labels (e.g. for filtering deployment by custom labels)
Expand Down Expand Up @@ -112,7 +119,7 @@ experimental:
#This value is no longer used, set the image.tag to a semver higher than 3.0, e.g. "v3.0.0-beta3"
#v3:
# -- Enable traefik version 3
# enabled: false
# enabled: false
plugins:
# -- Enable traefik experimental plugins
enabled: false
Expand Down Expand Up @@ -564,15 +571,6 @@ ports:
# only.
# hostIP: 192.168.100.10

# Override the liveness/readiness port. This is useful to integrate traefik
# with an external Load Balancer that performs healthchecks.
# Default: ports.traefik.port
# healthchecksPort: 9000

# Override the liveness/readiness scheme. Useful for getting ping to
# respond on websecure entryPoint.
# healthchecksScheme: HTTPS

# Defines whether the port is exposed if service.type is LoadBalancer or
# NodePort.
#
Expand Down Expand Up @@ -877,7 +875,7 @@ affinity: {}
nodeSelector: {}
# -- Tolerations allow the scheduler to schedule pods with matching taints.
tolerations: []
# -- You can use topology spread constraints to control
# -- You can use topology spread constraints to control
# how Pods are spread across your cluster among failure-domains.
topologySpreadConstraints: []
# This example topologySpreadConstraints forces the scheduler to put traefik pods
Expand Down