Support Host NetworkMode for ECS provider
This commit is contained in:
parent
e8d63b2a3b
commit
93a46089ce
3 changed files with 70 additions and 1 deletions
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue