Skip to content

Commit

Permalink
Add all docker subnets to overlay topology
Browse files Browse the repository at this point in the history
  • Loading branch information
Alfonso Acosta committed Jun 15, 2016
1 parent 0587c6a commit e1afe22
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions probe/docker/reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,17 +245,18 @@ func (r *Reporter) containerImageTopology() report.Topology {
}

func (r *Reporter) overlayTopology() report.Topology {
localSubnets := []string{}
subnets := []string{}
r.registry.WalkNetworks(func(network docker_client.Network) {
if network.Scope == "local" {
for _, config := range network.IPAM.Config {
localSubnets = append(localSubnets, config.Subnet)
}
for _, config := range network.IPAM.Config {
subnets = append(subnets, config.Subnet)
}

})
peerID := OverlayPeerPrefix + r.hostID
// Add both local and global networks to the LocalNetworks Set
// since we treat container IPs as local
node := report.MakeNode(report.MakeOverlayNodeID(peerID)).WithSets(
report.MakeSets().Add(host.LocalNetworks, report.MakeStringSet(localSubnets...)))
report.MakeSets().Add(host.LocalNetworks, report.MakeStringSet(subnets...)))
return report.MakeTopology().AddNode(node)
}

Expand Down

0 comments on commit e1afe22

Please sign in to comment.