Skip to content

Commit

Permalink
Review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Alfonso Acosta committed Jul 7, 2016
1 parent c843d24 commit 26c6249
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions probe/docker/reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ func (r *Reporter) containerTopology(localAddrs []net.IP) report.Topology {
}

var networkInfo func(prefix string) (report.Sets, bool)
networkInfo = func(prefix string) (ips report.Sets, isHostMapped bool) {
networkInfo = func(prefix string) (ips report.Sets, isInHostNamespace bool) {
container, ok := r.registry.GetContainerByPrefix(prefix)
if !ok {
return report.EmptySets, false
Expand All @@ -214,9 +214,13 @@ func (r *Reporter) containerTopology(localAddrs []net.IP) report.Topology {
if !ok {
continue
}
networkInfo, isHostMapped := networkInfo(id)
networkInfo, isInHostNamespace := networkInfo(id)
node = node.WithSets(networkInfo)
if isHostMapped {
// Indicate whether the container is in the host network
// The container's NetworkMode is not enough due to
// delegation (e.g. NetworkMode="container:foo" where
// foo is a container in the host networking namespace)
if isInHostNamespace {
node = node.WithLatests(map[string]string{IsInHostNetwork: "true"})
}
result.AddNode(node)
Expand Down

0 comments on commit 26c6249

Please sign in to comment.