fix: docker service name.

This commit is contained in:
Ludovic Fernandez 2019-09-26 12:26:05 +02:00 committed by Traefiker Bot
parent 29efac3e5e
commit c8fa059064
3 changed files with 8 additions and 3 deletions

View file

@ -77,7 +77,7 @@ func (s *DockerComposeSuite) TestComposeScale(c *check.C) {
services := rtconf.Services
c.Assert(services, checker.HasLen, 1)
for k, v := range services {
c.Assert(k, checker.Equals, composeService+"_integrationtest"+composeProject+"@docker")
c.Assert(k, checker.Equals, composeService+"-integrationtest"+composeProject+"@docker")
c.Assert(v.LoadBalancer.Servers, checker.HasLen, serviceCount)
// We could break here, but we don't just to keep us honest.
}

View file

@ -331,5 +331,5 @@ func getServiceName(container dockerData) string {
serviceName = values[labelDockerComposeService] + "_" + values[labelDockerComposeProject]
}
return serviceName
return provider.Normalize(serviceName)
}

View file

@ -142,7 +142,12 @@ func (p *Provider) createClient() (client.APIClient, error) {
apiVersion = SwarmAPIVersion
}
return client.NewClient(p.Endpoint, apiVersion, httpClient, httpHeaders)
return client.NewClientWithOpts(
client.WithHost(p.Endpoint),
client.WithVersion(apiVersion),
client.WithHTTPClient(httpClient),
client.WithHTTPHeaders(httpHeaders),
)
}
// Provide allows the docker provider to provide configurations to traefik using the given configuration channel.