1
0
mirror of https://github.com/containous/traefik.git synced 2024-12-25 23:21:40 +03:00

Merge pull request #728 from containous/fix-marathon-dots-ID

fIx marathon template with dots in ID
This commit is contained in:
Emile Vauge 2016-10-13 16:23:00 +02:00 committed by GitHub
commit 084d00a156
2 changed files with 15 additions and 15 deletions

View File

@ -114,7 +114,7 @@ func TestMarathonLoadConfig(t *testing.T) {
applications: &marathon.Applications{
Apps: []marathon.Application{
{
ID: "/testLoadBalancerAndCircuitBreaker",
ID: "/testLoadBalancerAndCircuitBreaker.dot",
Ports: []int{80},
Labels: &map[string]string{
"traefik.backend.loadbalancer.method": "drr",
@ -126,29 +126,29 @@ func TestMarathonLoadConfig(t *testing.T) {
tasks: &marathon.Tasks{
Tasks: []marathon.Task{
{
ID: "testLoadBalancerAndCircuitBreaker",
AppID: "/testLoadBalancerAndCircuitBreaker",
ID: "testLoadBalancerAndCircuitBreaker.dot",
AppID: "/testLoadBalancerAndCircuitBreaker.dot",
Host: "127.0.0.1",
Ports: []int{80},
},
},
},
expectedFrontends: map[string]*types.Frontend{
`frontend-testLoadBalancerAndCircuitBreaker`: {
Backend: "backend-testLoadBalancerAndCircuitBreaker",
`frontend-testLoadBalancerAndCircuitBreaker.dot`: {
Backend: "backend-testLoadBalancerAndCircuitBreaker.dot",
PassHostHeader: true,
EntryPoints: []string{},
Routes: map[string]types.Route{
`route-host-testLoadBalancerAndCircuitBreaker`: {
Rule: "Host:testLoadBalancerAndCircuitBreaker.docker.localhost",
`route-host-testLoadBalancerAndCircuitBreaker.dot`: {
Rule: "Host:testLoadBalancerAndCircuitBreaker.dot.docker.localhost",
},
},
},
},
expectedBackends: map[string]*types.Backend{
"backend-testLoadBalancerAndCircuitBreaker": {
"backend-testLoadBalancerAndCircuitBreaker.dot": {
Servers: map[string]types.Server{
"server-testLoadBalancerAndCircuitBreaker": {
"server-testLoadBalancerAndCircuitBreaker-dot": {
URL: "http://127.0.0.1:80",
Weight: 0,
},

View File

@ -1,35 +1,35 @@
{{$apps := .Applications}}
[backends]{{range .Tasks}}
[backends.backend{{getBackend . $apps}}.servers.server-{{.ID | replace "." "-"}}]
[backends."backend{{getBackend . $apps}}".servers."server-{{.ID | replace "." "-"}}"]
url = "{{getProtocol . $apps}}://{{.Host}}:{{getPort . $apps}}"
weight = {{getWeight . $apps}}
{{end}}
{{range .Applications}}
{{ if hasMaxConnLabels . }}
[backends.backend{{getFrontendBackend . }}.maxconn]
[backends."backend{{getFrontendBackend . }}".maxconn]
amount = {{getMaxConnAmount . }}
extractorfunc = "{{getMaxConnExtractorFunc . }}"
{{end}}
{{ if hasLoadBalancerLabels . }}
[backends.backend{{getFrontendBackend . }}.loadbalancer]
[backends."backend{{getFrontendBackend . }}".loadbalancer]
method = "{{getLoadBalancerMethod . }}"
sticky = {{getSticky .}}
{{end}}
{{ if hasCircuitBreakerLabels . }}
[backends.backend{{getFrontendBackend . }}.circuitbreaker]
[backends."backend{{getFrontendBackend . }}".circuitbreaker]
expression = "{{getCircuitBreakerExpression . }}"
{{end}}
{{end}}
[frontends]{{range .Applications}}
[frontends.frontend{{.ID | replace "/" "-"}}]
[frontends."frontend{{.ID | replace "/" "-"}}"]
backend = "backend{{getFrontendBackend .}}"
passHostHeader = {{getPassHostHeader .}}
priority = {{getPriority .}}
entryPoints = [{{range getEntryPoints .}}
"{{.}}",
{{end}}]
[frontends.frontend{{.ID | replace "/" "-"}}.routes.route-host{{.ID | replace "/" "-"}}]
[frontends."frontend{{.ID | replace "/" "-"}}".routes."route-host{{.ID | replace "/" "-"}}"]
rule = "{{getFrontendRule .}}"
{{end}}