feat(consul-catalog-provider): + setting unique backend name + backend redirecting to internal container ip

This commit is contained in:
Samuel BERTHE 2016-04-08 15:08:28 +02:00 committed by Poney baker
parent 9a407f79ff
commit 4f044cf2f9
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}}