Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

correct determination of a host's container images #2680

Merged
merged 1 commit into from
Jul 5, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 15 additions & 9 deletions render/host.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,25 +35,31 @@ var HostRenderer = MakeReduce(
// If this function is given a node without a hostname
// (including other pseudo nodes), it will drop the node.
//
// Otherwise, this function will produce a node with the correct ID
// Otherwise, this function will produce nodes with the correct ID
// format for a host, but without any Major or Minor labels. It does
// not have enough info to do that, and the resulting graph must be
// merged with a host graph to get that info.
func MapX2Host(n report.Node, _ report.Networks) report.Nodes {
// Don't propagate all pseudo nodes - we do this in MapEndpoint2Host
// Don't propagate pseudo nodes - we do this in MapEndpoint2Host
if n.Topology == Pseudo {
return report.Nodes{}
}
hostNodeID, timestamp, ok := n.Latest.LookupEntry(report.HostNodeID)

hostIDs, ok := n.Parents.Lookup(report.Host)
if !ok {
return report.Nodes{}
}
id := report.MakeHostNodeID(report.ExtractHostID(n))
result := NewDerivedNode(id, n).WithTopology(report.Host)
result.Latest = result.Latest.Set(report.HostNodeID, timestamp, hostNodeID)
result.Counters = result.Counters.Add(n.Topology, 1)
result.Children = report.MakeNodeSet(n)
return report.Nodes{id: result}

result := report.Nodes{}
children := report.MakeNodeSet(n)
for _, id := range hostIDs {
node := NewDerivedNode(id, n).WithTopology(report.Host)
node.Counters = node.Counters.Add(n.Topology, 1)
node.Children = children
result[id] = node
}

return result
}

// MapEndpoint2Host takes nodes from the endpoint topology and produces
Expand Down