1
0
Fork 0

Support Host NetworkMode for ECS provider

This commit is contained in:
Félix P 2017-10-31 11:44:03 +01:00 committed by Traefiker
parent e8d63b2a3b
commit 93a46089ce
3 changed files with 70 additions and 1 deletions

View file

@ -429,7 +429,7 @@ func (p *Provider) label(i ecsInstance, k string) string {
}
func (p *Provider) filterInstance(i ecsInstance) bool {
if len(i.container.NetworkBindings) == 0 {
if labelPort := p.label(i, types.LabelPort); len(i.container.NetworkBindings) == 0 && labelPort == "" {
log.Debugf("Filtering ecs instance without port %s (%s)", i.Name, i.ID)
return false
}
@ -554,6 +554,9 @@ func (p *Provider) getHost(i ecsInstance) string {
}
func (p *Provider) getPort(i ecsInstance) string {
if port := p.label(i, types.LabelPort); port != "" {
return port
}
return strconv.FormatInt(*i.container.NetworkBindings[0].HostPort, 10)
}