Skip to content

Commit

Permalink
fix: 🐛 declare http3 udp port, with or without hostport
Browse files Browse the repository at this point in the history
  • Loading branch information
mloiseleur authored Nov 14, 2023
1 parent ddd6cee commit 76dcb02
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
9 changes: 4 additions & 5 deletions traefik/templates/_podtemplate.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,13 @@
hostIP: {{ $config.hostIP }}
{{- end }}
protocol: {{ default "TCP" $config.protocol | quote }}
{{- if $config.http3 }}
{{- if and $config.http3.enabled $config.hostPort }}
{{- $http3Port := default $config.hostPort $config.http3.advertisedPort }}
{{- if ($config.http3).enabled }}
- name: "{{ $name }}-http3"
containerPort: {{ $config.port }}
hostPort: {{ $http3Port }}
protocol: UDP
{{- if $config.hostPort }}
hostPort: {{ default $config.hostPort $config.http3.advertisedPort }}
{{- end }}
protocol: UDP
{{- end }}
{{- end }}
{{- end }}
Expand Down
2 changes: 1 addition & 1 deletion traefik/templates/_service.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
{{- $http3Port := default $config.exposedPort $config.http3.advertisedPort }}
- port: {{ $http3Port }}
name: "{{ $name }}-http3"
targetPort: {{ default $config.port $config.targetPort }}
targetPort: {{ $name }}-http3
protocol: UDP
{{- if $config.nodePort }}
nodePort: {{ $config.nodePort }}
Expand Down
12 changes: 7 additions & 5 deletions traefik/tests/pod-config_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ tests:
of: Deployment
- isAPIVersion:
of: apps/v1
- it: should have only one http3 port when not using hostport
- it: should have two http3 port when not using hostport
set:
ports:
websecure:
Expand All @@ -514,15 +514,17 @@ tests:
asserts:
- contains:
path: spec.template.spec.containers[0].ports
any: true
count: 1
content:
containerPort: 8443
- notContains:
name: websecure
protocol: TCP
- contains:
path: spec.template.spec.containers[0].ports
content:
containerPort: 8443
name: websecure-http3
- it: should have two separate http3 port when using hostport
protocol: UDP
- it: should be possible to use hostport with http3
set:
ports:
websecure:
Expand Down
4 changes: 2 additions & 2 deletions traefik/tests/service-config_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ tests:
value: 443
- equal:
path: spec.ports[2].targetPort
value: 8443
value: websecure-http3
- equal:
path: spec.ports[2].protocol
value: UDP
Expand All @@ -240,7 +240,7 @@ tests:
value: 4443
- equal:
path: spec.ports[2].targetPort
value: 8443
value: websecure-http3
- equal:
path: spec.ports[2].protocol
value: UDP
Expand Down

0 comments on commit 76dcb02

Please sign in to comment.