Skip to content

Commit

Permalink
style: 🎨 consistent capitalization on --entryPoints CLI flag
Browse files Browse the repository at this point in the history
  • Loading branch information
jnoordsij authored Apr 22, 2024
1 parent 579984c commit b1f6f96
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 67 deletions.
34 changes: 17 additions & 17 deletions traefik/templates/_podtemplate.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,9 @@
{{- end }}
{{- range $name, $config := .Values.ports }}
{{- if $config }}
- "--entrypoints.{{$name}}.address={{ $config.hostIP }}:{{ $config.port }}/{{ default "tcp" $config.protocol | lower }}"
- "--entryPoints.{{$name}}.address={{ $config.hostIP }}:{{ $config.port }}/{{ default "tcp" $config.protocol | lower }}"
{{- with $config.asDefault }}
- "--entrypoints.{{$name}}.asDefault={{ . }}"
- "--entryPoints.{{$name}}.asDefault={{ . }}"
{{- end }}
{{- end }}
{{- end }}
Expand Down Expand Up @@ -499,58 +499,58 @@
{{- fail "ERROR: Syntax of `ports.web.redirectTo` has changed to `ports.web.redirectTo.port`. Details in PR #934." }}
{{- end }}
{{- $toPort := index $.Values.ports $config.redirectTo.port }}
- "--entrypoints.{{ $entrypoint }}.http.redirections.entryPoint.to=:{{ $toPort.exposedPort }}"
- "--entrypoints.{{ $entrypoint }}.http.redirections.entryPoint.scheme=https"
- "--entryPoints.{{ $entrypoint }}.http.redirections.entryPoint.to=:{{ $toPort.exposedPort }}"
- "--entryPoints.{{ $entrypoint }}.http.redirections.entryPoint.scheme=https"
{{- if $config.redirectTo.priority }}
- "--entrypoints.{{ $entrypoint }}.http.redirections.entryPoint.priority={{ $config.redirectTo.priority }}"
- "--entryPoints.{{ $entrypoint }}.http.redirections.entryPoint.priority={{ $config.redirectTo.priority }}"
{{- end }}
{{- end }}
{{- if $config.middlewares }}
- "--entrypoints.{{ $entrypoint }}.http.middlewares={{ join "," $config.middlewares }}"
- "--entryPoints.{{ $entrypoint }}.http.middlewares={{ join "," $config.middlewares }}"
{{- end }}
{{- if $config.tls }}
{{- if $config.tls.enabled }}
- "--entrypoints.{{ $entrypoint }}.http.tls=true"
- "--entryPoints.{{ $entrypoint }}.http.tls=true"
{{- if $config.tls.options }}
- "--entrypoints.{{ $entrypoint }}.http.tls.options={{ $config.tls.options }}"
- "--entryPoints.{{ $entrypoint }}.http.tls.options={{ $config.tls.options }}"
{{- end }}
{{- if $config.tls.certResolver }}
- "--entrypoints.{{ $entrypoint }}.http.tls.certResolver={{ $config.tls.certResolver }}"
- "--entryPoints.{{ $entrypoint }}.http.tls.certResolver={{ $config.tls.certResolver }}"
{{- end }}
{{- if $config.tls.domains }}
{{- range $index, $domain := $config.tls.domains }}
{{- if $domain.main }}
- "--entrypoints.{{ $entrypoint }}.http.tls.domains[{{ $index }}].main={{ $domain.main }}"
- "--entryPoints.{{ $entrypoint }}.http.tls.domains[{{ $index }}].main={{ $domain.main }}"
{{- end }}
{{- if $domain.sans }}
- "--entrypoints.{{ $entrypoint }}.http.tls.domains[{{ $index }}].sans={{ join "," $domain.sans }}"
- "--entryPoints.{{ $entrypoint }}.http.tls.domains[{{ $index }}].sans={{ join "," $domain.sans }}"
{{- end }}
{{- end }}
{{- end }}
{{- if $config.http3 }}
{{- if $config.http3.enabled }}
- "--entrypoints.{{ $entrypoint }}.http3"
- "--entryPoints.{{ $entrypoint }}.http3"
{{- if $config.http3.advertisedPort }}
- "--entrypoints.{{ $entrypoint }}.http3.advertisedPort={{ $config.http3.advertisedPort }}"
- "--entryPoints.{{ $entrypoint }}.http3.advertisedPort={{ $config.http3.advertisedPort }}"
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- if $config.forwardedHeaders }}
{{- if $config.forwardedHeaders.trustedIPs }}
- "--entrypoints.{{ $entrypoint }}.forwardedHeaders.trustedIPs={{ join "," $config.forwardedHeaders.trustedIPs }}"
- "--entryPoints.{{ $entrypoint }}.forwardedHeaders.trustedIPs={{ join "," $config.forwardedHeaders.trustedIPs }}"
{{- end }}
{{- if $config.forwardedHeaders.insecure }}
- "--entrypoints.{{ $entrypoint }}.forwardedHeaders.insecure"
- "--entryPoints.{{ $entrypoint }}.forwardedHeaders.insecure"
{{- end }}
{{- end }}
{{- if $config.proxyProtocol }}
{{- if $config.proxyProtocol.trustedIPs }}
- "--entrypoints.{{ $entrypoint }}.proxyProtocol.trustedIPs={{ join "," $config.proxyProtocol.trustedIPs }}"
- "--entryPoints.{{ $entrypoint }}.proxyProtocol.trustedIPs={{ join "," $config.proxyProtocol.trustedIPs }}"
{{- end }}
{{- if $config.proxyProtocol.insecure }}
- "--entrypoints.{{ $entrypoint }}.proxyProtocol.insecure"
- "--entryPoints.{{ $entrypoint }}.proxyProtocol.insecure"
{{- end }}
{{- end }}
{{- end }}
Expand Down
6 changes: 3 additions & 3 deletions traefik/tests/deployment-config_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,10 @@ tests:
asserts:
- contains:
path: spec.template.spec.containers[0].args
content: "--entrypoints.web.http.redirections.entryPoint.to=:443"
content: "--entryPoints.web.http.redirections.entryPoint.to=:443"
- contains:
path: spec.template.spec.containers[0].args
content: "--entrypoints.web.http.redirections.entryPoint.scheme=https"
content: "--entryPoints.web.http.redirections.entryPoint.scheme=https"
- it: should have http redirections enabled, when enabled with redirectTo and priority
set:
ports:
Expand All @@ -209,4 +209,4 @@ tests:
asserts:
- contains:
path: spec.template.spec.containers[0].args
content: "--entrypoints.web.http.redirections.entryPoint.priority=10"
content: "--entryPoints.web.http.redirections.entryPoint.priority=10"
10 changes: 5 additions & 5 deletions traefik/tests/metrics-config_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ tests:
value:
- --global.checknewversion
- --global.sendanonymoususage
- --entrypoints.metrics.address=:9100/tcp
- --entrypoints.traefik.address=:9000/tcp
- --entrypoints.web.address=:8000/tcp
- --entrypoints.websecure.address=:8443/tcp
- --entryPoints.metrics.address=:9100/tcp
- --entryPoints.traefik.address=:9000/tcp
- --entryPoints.web.address=:8000/tcp
- --entryPoints.websecure.address=:8443/tcp
- --api.dashboard=true
- --ping=true
- --metrics.prometheus=true
- --metrics.prometheus.entrypoint=metrics
- --providers.kubernetescrd
- --providers.kubernetesingress
- --entrypoints.websecure.http.tls=true
- --entryPoints.websecure.http.tls=true
- --log.level=INFO

- it: "should support to set prometheus: null"
Expand Down
18 changes: 9 additions & 9 deletions traefik/tests/pod-config_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -366,10 +366,10 @@ tests:
asserts:
- contains:
path: spec.template.spec.containers[0].args
content: "--entrypoints.websecure.http3"
content: "--entryPoints.websecure.http3"
- contains:
path: spec.template.spec.containers[0].args
content: "--entrypoints.websecure.http3.advertisedPort=443"
content: "--entryPoints.websecure.http3.advertisedPort=443"
- it: should be possible to enable http3 enabled without a custom advertisedPort
set:
ports:
Expand All @@ -379,19 +379,19 @@ tests:
asserts:
- contains:
path: spec.template.spec.containers[0].args
content: "--entrypoints.websecure.http3"
content: "--entryPoints.websecure.http3"
- notContains:
path: spec.template.spec.containers[0].args
content: "--entrypoints.websecure.http3.advertisedPort=443"
content: "--entryPoints.websecure.http3.advertisedPort=443"

- it: should not have http3 config flag by default
asserts:
- notContains:
path: spec.template.spec.containers[0].args
content: "--entrypoints.websecure.http3"
content: "--entryPoints.websecure.http3"
- notContains:
path: spec.template.spec.containers[0].args
content: "--entrypoints.websecure.http3.advertisedPort=8443"
content: "--entryPoints.websecure.http3.advertisedPort=8443"
- it: should join entrypoints middleware when there are multiples
set:
ports:
Expand All @@ -402,7 +402,7 @@ tests:
asserts:
- contains:
path: spec.template.spec.containers[0].args
content: "--entrypoints.websecure.http.middlewares=auth@file,strip@kubernetes-crd"
content: "--entryPoints.websecure.http.middlewares=auth@file,strip@kubernetes-crd"
- it: should apply middleware on entrypoint
set:
ports:
Expand All @@ -412,7 +412,7 @@ tests:
asserts:
- contains:
path: spec.template.spec.containers[0].args
content: "--entrypoints.web.http.middlewares=auth@file"
content: "--entryPoints.web.http.middlewares=auth@file"
- it: should not complain when there are no middlewares on entrypoint
set:
ports:
Expand All @@ -421,7 +421,7 @@ tests:
asserts:
- notContains:
path: spec.template.spec.containers[0].args
content: "--entrypoints.web.http.middlewares="
content: "--entryPoints.web.http.middlewares="
- it: should fail when user want to use hostnetwork with hostport != containerport
set:
hostNetwork: true
Expand Down
31 changes: 15 additions & 16 deletions traefik/tests/ports-config_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ tests:
template: service.yaml
- contains:
path: spec.template.spec.containers[0].args
content: "--entrypoints.web.address=:8000/tcp"
content: "--entryPoints.web.address=:8000/tcp"
template: deployment.yaml
- it: should have port 8443 of pod published to 443 of service by default, and defined as entrypoint "websecure"
asserts:
Expand All @@ -43,7 +43,7 @@ tests:
template: service.yaml
- contains:
path: spec.template.spec.containers[0].args
content: "--entrypoints.websecure.address=:8443/tcp"
content: "--entryPoints.websecure.address=:8443/tcp"
template: deployment.yaml
- it: should have port 9000 of pod exposed for probes but NOT published to the service by default
asserts:
Expand All @@ -63,7 +63,7 @@ tests:
template: service.yaml
- contains:
path: spec.template.spec.containers[0].args
content: "--entrypoints.traefik.address=:9000/tcp"
content: "--entryPoints.traefik.address=:9000/tcp"
template: deployment.yaml
- it: should have a custom port when specified via values
set:
Expand All @@ -90,7 +90,7 @@ tests:
template: service.yaml
- contains:
path: spec.template.spec.containers[0].args
content: "--entrypoints.ssh.address=:22/tcp"
content: "--entryPoints.ssh.address=:22/tcp"
template: deployment.yaml
- it: should have a hostPort when specified via values
set:
Expand Down Expand Up @@ -119,7 +119,7 @@ tests:
template: service.yaml
- contains:
path: spec.template.spec.containers[0].args
content: "--entrypoints.ssh.address=:22/tcp"
content: "--entryPoints.ssh.address=:22/tcp"
template: deployment.yaml
- it: should have a UDP custom port when specified via values
set:
Expand Down Expand Up @@ -148,7 +148,7 @@ tests:
documentIndex: 0
- contains:
path: spec.template.spec.containers[0].args
content: "--entrypoints.udp.address=:51/udp"
content: "--entryPoints.udp.address=:51/udp"
template: deployment.yaml

- it: should set entrypoint to default when configured
Expand All @@ -162,13 +162,13 @@ tests:
asserts:
- contains:
path: spec.template.spec.containers[0].args
content: "--entrypoints.web.asDefault=true"
content: "--entryPoints.web.asDefault=true"
- notContains:
path: spec.template.spec.containers[0].args
content: "--entrypoints.websecure.asDefault=false"
content: "--entryPoints.websecure.asDefault=false"
- notContains:
path: spec.template.spec.containers[0].args
content: "--entrypoints.websecure.asDefault=true"
content: "--entryPoints.websecure.asDefault=true"

- it: should set entrypoint host when hostIP is configured
template: deployment.yaml
Expand All @@ -179,13 +179,13 @@ tests:
asserts:
- contains:
path: spec.template.spec.containers[0].args
content: "--entrypoints.web.address=127.0.0.1:8000/tcp"
content: "--entryPoints.web.address=127.0.0.1:8000/tcp"
- contains:
path: spec.template.spec.containers[0].args
content: "--entrypoints.websecure.address=:8443/tcp"
content: "--entryPoints.websecure.address=:8443/tcp"
- contains:
path: spec.template.spec.containers[0].args
content: "--entrypoints.traefik.address=:9000/tcp"
content: "--entryPoints.traefik.address=:9000/tcp"

- it: should set probes host when hostIP is configured
template: deployment.yaml
Expand All @@ -196,7 +196,7 @@ tests:
asserts:
- contains:
path: spec.template.spec.containers[0].args
content: "--entrypoints.traefik.address=localhost:9000/tcp"
content: "--entryPoints.traefik.address=localhost:9000/tcp"
- equal:
path: spec.template.spec.containers[0].livenessProbe.httpGet.host
value: localhost
Expand Down Expand Up @@ -230,7 +230,7 @@ tests:
template: service.yaml
- contains:
path: spec.template.spec.containers[0].args
content: "--entrypoints.ssh.address=:2222/tcp"
content: "--entryPoints.ssh.address=:2222/tcp"
template: deployment.yaml
- it: should be possible to use same custom containerPort and keep default exposedPort
set:
Expand Down Expand Up @@ -258,7 +258,7 @@ tests:
template: service.yaml
- contains:
path: spec.template.spec.containers[0].args
content: "--entrypoints.web.address=:666/tcp"
content: "--entryPoints.web.address=:666/tcp"
template: deployment.yaml
- it: should be possible to disable traefik & metrics port
set:
Expand Down Expand Up @@ -357,4 +357,3 @@ tests:
asserts:
- failedTemplate:
errorMessage: "ERROR: Cannot create ssh port on Service without .port or .exposedPort"

Loading

0 comments on commit b1f6f96

Please sign in to comment.