Merge branch 'v1.4' into v1.5
This commit is contained in:
commit
23c1a9ca8e
6 changed files with 49 additions and 15 deletions
|
@ -418,9 +418,9 @@ func getServiceNames(container dockerData) []string {
|
|||
// Extract backend from labels for a given service and a given docker container
|
||||
func getServiceBackend(container dockerData, serviceName string) string {
|
||||
if value, ok := getContainerServiceLabel(container, serviceName, types.SuffixFrontendBackend); ok {
|
||||
return container.ServiceName + "-" + value
|
||||
return provider.Normalize(container.ServiceName + "-" + value)
|
||||
}
|
||||
return strings.TrimPrefix(container.ServiceName, "/") + "-" + getBackend(container) + "-" + provider.Normalize(serviceName)
|
||||
return provider.Normalize(container.ServiceName + "-" + getBackend(container) + "-" + serviceName)
|
||||
}
|
||||
|
||||
// Extract rule from labels for a given service and a given docker container
|
||||
|
|
|
@ -94,12 +94,22 @@ func TestDockerGetServiceBackend(t *testing.T) {
|
|||
container: containerJSON(name("foo")),
|
||||
expected: "foo-foo-myservice",
|
||||
},
|
||||
{
|
||||
container: containerJSON(name("foo.bar")),
|
||||
expected: "foo-bar-foo-bar-myservice",
|
||||
},
|
||||
{
|
||||
container: containerJSON(labels(map[string]string{
|
||||
types.LabelBackend: "another-backend",
|
||||
})),
|
||||
expected: "fake-another-backend-myservice",
|
||||
},
|
||||
{
|
||||
container: containerJSON(labels(map[string]string{
|
||||
types.LabelBackend: "another.backend",
|
||||
})),
|
||||
expected: "fake-another-backend-myservice",
|
||||
},
|
||||
{
|
||||
container: containerJSON(labels(map[string]string{
|
||||
"traefik.myservice.frontend.backend": "custom-backend",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue