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: support uppercase letters in entrypoint names #1286

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
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