Example #1
0
func pseudoNodeSummary(base NodeSummary, n report.Node) (NodeSummary, bool) {
	base.Pseudo = true
	base.Rank = n.ID

	if template, ok := map[string]struct{ Label, LabelMinor string }{
		render.TheInternetID:      {render.InboundMajor, ""},
		render.IncomingInternetID: {render.InboundMajor, render.InboundMinor},
		render.OutgoingInternetID: {render.OutboundMajor, render.OutboundMinor},
	}[n.ID]; ok {
		base.Label = template.Label
		base.LabelMinor = template.LabelMinor
		base.Shape = report.Cloud
		return base, true
	}

	// try rendering it as an uncontained node
	if strings.HasPrefix(n.ID, render.MakePseudoNodeID(render.UncontainedID)) {
		base.Label = render.UncontainedMajor
		base.LabelMinor = report.ExtractHostID(n)
		base.Shape = report.Square
		base.Stack = true
		return base, true
	}

	// try rendering it as an unmanaged node
	if strings.HasPrefix(n.ID, render.MakePseudoNodeID(render.UnmanagedID)) {
		base.Label = render.UnmanagedMajor
		base.Shape = report.Square
		base.Stack = true
		base.LabelMinor = report.ExtractHostID(n)
		return base, true
	}

	// try rendering it as an endpoint
	if addr, ok := n.Latest.Lookup(endpoint.Addr); ok {
		base.Label = addr
		base.Shape = report.Circle
		return base, true
	}

	return NodeSummary{}, false
}
Example #2
0
			}
			return n
		}
	}
	pseudo                = node(render.Pseudo)
	endpoint              = node(report.Endpoint)
	processNode           = node(report.Process)
	processNameNode       = node(render.MakeGroupNodeTopology(report.Process, process.Name))
	container             = node(report.Container)
	containerHostnameNode = node(render.MakeGroupNodeTopology(report.Container, docker.ContainerHostname))
	containerImage        = node(report.ContainerImage)
	pod                   = node(report.Pod)
	service               = node(report.Service)
	hostNode              = node(report.Host)

	UnknownPseudoNode1ID = render.MakePseudoNodeID(fixture.UnknownClient1IP)
	UnknownPseudoNode2ID = render.MakePseudoNodeID(fixture.UnknownClient3IP)

	unknownPseudoNode1 = func(adjacent ...string) report.Node {
		return pseudo(UnknownPseudoNode1ID, adjacent...).
			WithChildren(report.MakeNodeSet(
				RenderedEndpoints[fixture.UnknownClient1NodeID],
				RenderedEndpoints[fixture.UnknownClient2NodeID],
			))
	}
	unknownPseudoNode2 = func(adjacent ...string) report.Node {
		return pseudo(UnknownPseudoNode2ID, adjacent...).
			WithChildren(report.MakeNodeSet(
				RenderedEndpoints[fixture.UnknownClient3NodeID],
			))
	}