fIx marathon template with dots in ID
This commit is contained in:
parent
3b2410d904
commit
404a73a712
2 changed files with 15 additions and 15 deletions
|
@ -114,7 +114,7 @@ func TestMarathonLoadConfig(t *testing.T) {
|
||||||
applications: &marathon.Applications{
|
applications: &marathon.Applications{
|
||||||
Apps: []marathon.Application{
|
Apps: []marathon.Application{
|
||||||
{
|
{
|
||||||
ID: "/testLoadBalancerAndCircuitBreaker",
|
ID: "/testLoadBalancerAndCircuitBreaker.dot",
|
||||||
Ports: []int{80},
|
Ports: []int{80},
|
||||||
Labels: &map[string]string{
|
Labels: &map[string]string{
|
||||||
"traefik.backend.loadbalancer.method": "drr",
|
"traefik.backend.loadbalancer.method": "drr",
|
||||||
|
@ -126,29 +126,29 @@ func TestMarathonLoadConfig(t *testing.T) {
|
||||||
tasks: &marathon.Tasks{
|
tasks: &marathon.Tasks{
|
||||||
Tasks: []marathon.Task{
|
Tasks: []marathon.Task{
|
||||||
{
|
{
|
||||||
ID: "testLoadBalancerAndCircuitBreaker",
|
ID: "testLoadBalancerAndCircuitBreaker.dot",
|
||||||
AppID: "/testLoadBalancerAndCircuitBreaker",
|
AppID: "/testLoadBalancerAndCircuitBreaker.dot",
|
||||||
Host: "127.0.0.1",
|
Host: "127.0.0.1",
|
||||||
Ports: []int{80},
|
Ports: []int{80},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
expectedFrontends: map[string]*types.Frontend{
|
expectedFrontends: map[string]*types.Frontend{
|
||||||
`frontend-testLoadBalancerAndCircuitBreaker`: {
|
`frontend-testLoadBalancerAndCircuitBreaker.dot`: {
|
||||||
Backend: "backend-testLoadBalancerAndCircuitBreaker",
|
Backend: "backend-testLoadBalancerAndCircuitBreaker.dot",
|
||||||
PassHostHeader: true,
|
PassHostHeader: true,
|
||||||
EntryPoints: []string{},
|
EntryPoints: []string{},
|
||||||
Routes: map[string]types.Route{
|
Routes: map[string]types.Route{
|
||||||
`route-host-testLoadBalancerAndCircuitBreaker`: {
|
`route-host-testLoadBalancerAndCircuitBreaker.dot`: {
|
||||||
Rule: "Host:testLoadBalancerAndCircuitBreaker.docker.localhost",
|
Rule: "Host:testLoadBalancerAndCircuitBreaker.dot.docker.localhost",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
expectedBackends: map[string]*types.Backend{
|
expectedBackends: map[string]*types.Backend{
|
||||||
"backend-testLoadBalancerAndCircuitBreaker": {
|
"backend-testLoadBalancerAndCircuitBreaker.dot": {
|
||||||
Servers: map[string]types.Server{
|
Servers: map[string]types.Server{
|
||||||
"server-testLoadBalancerAndCircuitBreaker": {
|
"server-testLoadBalancerAndCircuitBreaker-dot": {
|
||||||
URL: "http://127.0.0.1:80",
|
URL: "http://127.0.0.1:80",
|
||||||
Weight: 0,
|
Weight: 0,
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,35 +1,35 @@
|
||||||
{{$apps := .Applications}}
|
{{$apps := .Applications}}
|
||||||
[backends]{{range .Tasks}}
|
[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}}"
|
url = "{{getProtocol . $apps}}://{{.Host}}:{{getPort . $apps}}"
|
||||||
weight = {{getWeight . $apps}}
|
weight = {{getWeight . $apps}}
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
{{range .Applications}}
|
{{range .Applications}}
|
||||||
{{ if hasMaxConnLabels . }}
|
{{ if hasMaxConnLabels . }}
|
||||||
[backends.backend{{getFrontendBackend . }}.maxconn]
|
[backends."backend{{getFrontendBackend . }}".maxconn]
|
||||||
amount = {{getMaxConnAmount . }}
|
amount = {{getMaxConnAmount . }}
|
||||||
extractorfunc = "{{getMaxConnExtractorFunc . }}"
|
extractorfunc = "{{getMaxConnExtractorFunc . }}"
|
||||||
{{end}}
|
{{end}}
|
||||||
{{ if hasLoadBalancerLabels . }}
|
{{ if hasLoadBalancerLabels . }}
|
||||||
[backends.backend{{getFrontendBackend . }}.loadbalancer]
|
[backends."backend{{getFrontendBackend . }}".loadbalancer]
|
||||||
method = "{{getLoadBalancerMethod . }}"
|
method = "{{getLoadBalancerMethod . }}"
|
||||||
sticky = {{getSticky .}}
|
sticky = {{getSticky .}}
|
||||||
{{end}}
|
{{end}}
|
||||||
{{ if hasCircuitBreakerLabels . }}
|
{{ if hasCircuitBreakerLabels . }}
|
||||||
[backends.backend{{getFrontendBackend . }}.circuitbreaker]
|
[backends."backend{{getFrontendBackend . }}".circuitbreaker]
|
||||||
expression = "{{getCircuitBreakerExpression . }}"
|
expression = "{{getCircuitBreakerExpression . }}"
|
||||||
{{end}}
|
{{end}}
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
[frontends]{{range .Applications}}
|
[frontends]{{range .Applications}}
|
||||||
[frontends.frontend{{.ID | replace "/" "-"}}]
|
[frontends."frontend{{.ID | replace "/" "-"}}"]
|
||||||
backend = "backend{{getFrontendBackend .}}"
|
backend = "backend{{getFrontendBackend .}}"
|
||||||
passHostHeader = {{getPassHostHeader .}}
|
passHostHeader = {{getPassHostHeader .}}
|
||||||
priority = {{getPriority .}}
|
priority = {{getPriority .}}
|
||||||
entryPoints = [{{range getEntryPoints .}}
|
entryPoints = [{{range getEntryPoints .}}
|
||||||
"{{.}}",
|
"{{.}}",
|
||||||
{{end}}]
|
{{end}}]
|
||||||
[frontends.frontend{{.ID | replace "/" "-"}}.routes.route-host{{.ID | replace "/" "-"}}]
|
[frontends."frontend{{.ID | replace "/" "-"}}".routes."route-host{{.ID | replace "/" "-"}}"]
|
||||||
rule = "{{getFrontendRule .}}"
|
rule = "{{getFrontendRule .}}"
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
Loading…
Add table
Reference in a new issue