Add unique ID to Docker services replicas

This commit is contained in:
NicoMen 2017-10-25 10:00:03 +02:00 committed by Traefiker
parent 44b82e6231
commit f0371da838
2 changed files with 4 additions and 4 deletions

View file

@ -356,7 +356,7 @@ func TestDockerLoadDockerServiceConfig(t *testing.T) {
expectedBackends: map[string]*types.Backend{ expectedBackends: map[string]*types.Backend{
"backend-foo-service": { "backend-foo-service": {
Servers: map[string]types.Server{ Servers: map[string]types.Server{
"service": { "service-0": {
URL: "http://127.0.0.1:2503", URL: "http://127.0.0.1:2503",
Weight: 0, Weight: 0,
}, },
@ -426,7 +426,7 @@ func TestDockerLoadDockerServiceConfig(t *testing.T) {
expectedBackends: map[string]*types.Backend{ expectedBackends: map[string]*types.Backend{
"backend-foobar": { "backend-foobar": {
Servers: map[string]types.Server{ Servers: map[string]types.Server{
"service": { "service-0": {
URL: "https://127.0.0.1:2503", URL: "https://127.0.0.1:2503",
Weight: 80, Weight: 80,
}, },
@ -435,7 +435,7 @@ func TestDockerLoadDockerServiceConfig(t *testing.T) {
}, },
"backend-test2-anotherservice": { "backend-test2-anotherservice": {
Servers: map[string]types.Server{ Servers: map[string]types.Server{
"service": { "service-0": {
URL: "http://127.0.0.1:8079", URL: "http://127.0.0.1:8079",
Weight: 33, Weight: 33,
}, },

View file

@ -26,7 +26,7 @@
{{if hasServices $server}} {{if hasServices $server}}
{{$services := getServiceNames $server}} {{$services := getServiceNames $server}}
{{range $serviceIndex, $serviceName := $services}} {{range $serviceIndex, $serviceName := $services}}
[backends.backend-{{getServiceBackend $server $serviceName}}.servers.service] [backends.backend-{{getServiceBackend $server $serviceName}}.servers.service-{{$serverName}}]
url = "{{getServiceProtocol $server $serviceName}}://{{getIPAddress $server}}:{{getServicePort $server $serviceName}}" url = "{{getServiceProtocol $server $serviceName}}://{{getIPAddress $server}}:{{getServicePort $server $serviceName}}"
weight = {{getServiceWeight $server $serviceName}} weight = {{getServiceWeight $server $serviceName}}
{{end}} {{end}}