Merge pull request #294 from samber/TRAEFIK-275-consul-catalog-backend-using-container-internal-ip

feat(consul-catalog-provider): + setting unique backend name + backendd redirecting to internal container ip
This commit is contained in:
Vincent Demeester 2016-04-13 09:38:09 +02:00
commit 2bcc5a2ac7
2 changed files with 4 additions and 3 deletions

View file

@ -63,6 +63,7 @@ func TestConsulCatalogBuildConfig(t *testing.T) {
{
Service: &api.AgentService{
Service: "test",
Address: "127.0.0.1",
Port: 80,
},
Node: &api.Node{
@ -86,7 +87,7 @@ func TestConsulCatalogBuildConfig(t *testing.T) {
expectedBackends: map[string]*types.Backend{
"backend-test": {
Servers: map[string]types.Server{
"server-localhost-80": {
"test--127-0-0-1--80": {
URL: "http://127.0.0.1:80",
},
},

View file

@ -1,6 +1,6 @@
[backends]{{range .Nodes}}
[backends.backend-{{getBackend .}}.servers.server-{{.Node.Node | replace "." "-"}}-{{.Service.Port}}]
url = "http://{{.Node.Address}}:{{.Service.Port}}"
[backends.backend-{{getBackend .}}.servers.{{.Service.Service | replace "." "-"}}--{{.Service.Address | replace "." "-"}}--{{.Service.Port}}]
url = "http://{{.Service.Address}}:{{.Service.Port}}"
{{end}}
[frontends]{{range .Services}}