Skip to content

Commit

Permalink
fix(Traefik Proxy): support uppercase letters in entrypoint names
Browse files Browse the repository at this point in the history
  • Loading branch information
uvNikita authored Jan 15, 2025
1 parent 883969e commit 7f37bab
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
2 changes: 1 addition & 1 deletion traefik/templates/_podtemplate.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
{{- fail "ERROR: All hostPort must match their respective containerPort when `hostNetwork` is enabled" }}
{{- end }}
{{- end }}
- name: {{ $name | quote }}
- name: {{ $name | lower | quote }}
containerPort: {{ default $config.port $config.containerPort }}
{{- if $config.hostPort }}
hostPort: {{ $config.hostPort }}
Expand Down
3 changes: 2 additions & 1 deletion traefik/templates/_service.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@
{{- end }}

{{- define "traefik.service-ports" }}
{{- range $name, $config := .ports }}
{{- range $portName, $config := .ports }}
{{- $name := $portName | lower -}}
{{- if (index (default dict $config.expose) $.serviceName) }}
{{- $port := default $config.port $config.exposedPort }}
{{- if empty $port }}
Expand Down
23 changes: 23 additions & 0 deletions traefik/tests/ports-config_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -357,3 +357,26 @@ tests:
asserts:
- failedTemplate:
errorMessage: "ERROR: Cannot create ssh port on Service without .port or .exposedPort"
- it: should support uppercase letters in entrypoint names
set:
ports:
UPPERCASE:
port: 443
expose:
default: true
asserts:
- contains:
path: spec.template.spec.containers[0].ports
content:
name: uppercase
containerPort: 443
protocol: TCP
template: deployment.yaml
- contains:
path: spec.ports
content:
name: uppercase
port: 443
protocol: TCP
targetPort: uppercase
template: service.yaml

0 comments on commit 7f37bab

Please sign in to comment.