render/pod: Remove redundant deployment mapping

This map function isn't actually needed.
Children are only populated from mapping to parents during rendering,
so there's no pre-existing replicasets to map.
Simply having the Map2Parent function map pods to deployments has it do the right thing.
This commit is contained in:
Mike Lang
2017-07-03 11:49:31 -07:00
parent c5b2c9dc3d
commit b7e24e82b5
+1 -21
View File
@@ -79,7 +79,7 @@ var PodServiceRenderer = ConditionalRenderer(renderKubernetesTopologies,
var KubeControllerRenderer = ConditionalRenderer(renderKubernetesTopologies,
renderParents(
report.Pod, []string{report.Deployment, report.DaemonSet},
NoParentsPseudo, UnmanagedID, makePodsChildren,
NoParentsPseudo, UnmanagedID, nil,
PodRenderer,
),
)
@@ -135,26 +135,6 @@ func (s selectPodsWithDeployments) Stats(rpt report.Report, _ Decorator) Stats {
return Stats{}
}
// When mapping from pods to deployments, complete the two-way relation by making the
// mapped-from pod a child of the mapped-to deployment, and remove any replica set children.
// This is needed because pods were originally mapped to deployments via an intermediate replica set
// which we need to remove.
func makePodsChildren(parent, original report.Node) report.Node {
children := parent.Children
// Gather all the replica sets...
replicaSetIDs := []string{}
children.ForEach(func(n report.Node) {
if n.Topology == report.ReplicaSet {
replicaSetIDs = append(replicaSetIDs, n.ID)
}
})
// ...and delete them.
children = children.Delete(replicaSetIDs...)
// Then add in the mapped-from pod.
children = children.Add(original)
return parent.WithChildren(children)
}
// MapPod2IP maps pod nodes to their IP address. This allows pods to
// be joined directly with the endpoint topology.
func MapPod2IP(m report.Node) []string {