Commit Graph

477 Commits

Author SHA1 Message Date
Mike Lang
1a2ad9c013 Merge pull request #2685 from weaveworks/mike/render/fix-map2parent-pseudo-id
render/pod: Fix a typo in Map2Parent where UnmanagedID will always be used for noParentsPseudoID
2017-07-05 14:02:38 -07:00
Matthias Radestock
d22d9d0768 Merge pull request #2682 from weaveworks/2681-image-counts
don't show container count in host detail panel image list

Fixes #2681.
2017-07-05 20:39:33 +01:00
Matthias Radestock
fd4f1f9d42 Merge pull request #2680 from weaveworks/2629-host-image-list
correct determination of a host's container images
2017-07-05 20:38:32 +01:00
Mike Lang
399cca026c render/pod: Fix a typo in Map2Parent where UnmanagedID will always be used for noParentsPseudoID
Thankfully we only ever set it to UnmanagedID right now, so no user-facing bug.
2017-07-05 11:33:06 -07:00
Matthias Radestock
c7a3f7c2fd Merge pull request #2675 from weaveworks/less-copy
refactor: remove unnecessary and dead Copy()
2017-07-05 14:33:31 +01:00
Matthias Radestock
0f4d17d868 don't show container count in host detail panel image list
The figure is inaccurate since it counts containers across all
hosts. Getting the count correct is non-trivial, so it's better to not
show the figure at all.

NB: the count still shows up on mouse-over of the link, but that is
defensible and not (very) confusing since the link represents the
image, not the image on a particular host, and it's the same count
that show up as the minor label in the container images view.

Fixes #2681.
2017-07-05 14:03:44 +01:00
Matthias Radestock
a0fb2e1d73 cosmetic(ish) 2017-07-05 12:49:23 +01:00
Matthias Radestock
0c122acf06 correct determination of a host's container images
The same container image may be in use on multiple hosts. The
latest-map HostNodeID of a node in the ContainerImage topology is
therefore meaningless - it gets set to whatever host reported that
image last in the time window covered by the report. Hence using it as
a basis for mapping to hosts, as we did, a) fails to associate images
with all the right hosts (hence they are missing from the host details
panel), and b) causes that association to change semi-randomly (hence
the list in the details panel is unstable).

By contrast, the host topology parents of container image nodes is the
complete set of all hosts the image is used on. So making that the
basis for mapping fixes the problem.

The same technique - mapping based on host parents rather than
latest-map HostNodeID - also works for the other nodes we are mapping:
processes, containers and pods. So we might as well use it there
too. That's also what Map2Parent does in other topology renderers.

Fixes #2629.
2017-07-05 09:09:32 +01:00
Matthias Radestock
57bc34f411 Merge pull request #2673 from weaveworks/mike/render/simplify-pods
render/pod: Remove unused options and incorrect code
2017-07-04 20:38:45 +01:00
Matthias Radestock
d4d3e5f184 correct comment 2017-07-04 20:37:55 +01:00
Matthias Radestock
a6491a35c3 refactor: remove unnecessary Copy() code 2017-07-04 07:35:30 +01:00
Matthias Radestock
f0ae2bd98c refactor: use inline StringSet constructor 2017-07-04 06:29:19 +01:00
Mike Lang
73b7641d9f render/pod: Remove unused code and options 2017-07-03 13:50:56 -07:00
Mike Lang
b7e24e82b5 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.
2017-07-03 11:49:31 -07:00
Matthias Radestock
1f023890e4 refactor: optimise report.Map.Render() 2017-07-03 07:54:32 +01:00
Matthias Radestock
7119fb9de8 refactor: rename report.NewNetworks to MakeNetworks
for consistency - all the other report set constructors are called
'Make...'
2017-07-03 01:26:22 +01:00
Matthias Radestock
9dc50b5202 refactor: hide "empty set" constants
They are an implementation detail.
2017-07-03 01:26:22 +01:00
Matthias Radestock
c5b2c9dc3d Merge pull request #2668 from weaveworks/2665-connection-pid-attribution
ignore endpoints with >1 adjacency in process rendering

This eliminates the worst effects of #2665.
2017-06-30 13:10:10 +01:00
Matthias Radestock
708931f98a ignore endpoints with >1 adjacency in process rendering
This eliminates the worst effects of #2665.
2017-06-29 22:34:05 +01:00
Mike Lang
ef2b6f6c55 Remove replica sets
Use a special kind of selector renderer to elide replica sets from pod nodes
and directly reference deployment parents instead.
Do the inverse (replace replica sets with pods) during the mapping from pod to deployment.

Note we can no longer use renderParents since we're using a non-standard Selector
2017-06-29 10:13:15 -07:00
Matthias Radestock
3209d65d52 filter out unconnected pseudo nodes on the outside
The change is necessitated by the removal of procspied/ebpf endpoint
filtering in the renderers, as a result of which the odd
conntracked-only, unconnected pseudo node can sneak through.

This new way of doing things also makes renderers more composable and
robust, and more directly reflects the objective:
- in the process topologies, filter out all unconnected nodes
- in all other topologies, filter out unconnected pseudo nodes
2017-06-27 20:28:30 +01:00
Matthias Radestock
e5a04ec5a4 do not filter endpoints by procspied/ebpf in renderers
The filtering of endpoints causes some connections to get missed for
non-eBPF-tracked connections. Furthermore, the filtering of endpoints
is entirely pointless when the probes run eBPF since the filters just
pass through eBPF-tracked endpoints (for good reason too; because
otherwise some connections would be missed). So in that case it is
just costing CPU and removing it actually improves performance.

Note that removing the filtering does not result in over-counting
connections since that is done by source ip:port pairs.

Fixes #2551.
Fixes #2558.
2017-06-27 20:28:13 +01:00
Mike Lang
f7913ab550 Rewrite renderers for k8s/ecs/swarm to abstract common parts
Since all the renderers were doing almost-exactly the same thing, we abstract that out into a common function.
2017-06-27 10:19:04 -07:00
Mike Lang
f101f83c3d controllers topology: Map metrics for single nodes
* Maps metrics if there is a single pod in the controller, as per all other views.
* Also added heavy commenting on the increasingly-complex render chain
2017-06-27 10:19:04 -07:00
Mike Lang
8eb72cf276 Remove deployment and daemonset views, change combined to controllers and remove bare pods and replica sets
Since we still need to map through replica sets to find matching deployments, we simply filter them out as a post-step.
2017-06-27 10:19:04 -07:00
Mike Lang
889972c48a Display node type on k8s controller nodes
Since there are multiple types in the same topology, displaying the type is important.
We do this in multiple places:

* Add node type to minor label

* Add node type as metadata and include in metadata template.
  Even though this will always be the same for every node of that topology, this was
  the easiest way to add it so it displays in the table view.
  Note we can't control ordering of columns in table view, it's always alphabetical.
2017-06-27 10:19:04 -07:00
Mike Lang
13b2ed69bd Improve renderer for combined view by refactoring Map2Parent
The existing technique of "reducing" the two rendered graphs for daemonsets and deployments
had a glaring issue that no connections would ever be made between nodes of different types,
since that information would've been discarded earlier in the process.
It also makes it hard to identify "parentless" pods.

This commit extends the Map2Parent function, teaching it:
	* To check multiple topologies for parents
	* To pass through nodes with no parents found without modification

Since we already had two 'modes' for what to do with nodes without parents,
and it would've been clunky to try to encode the third option into the existing PseudoNodeID
arg in some way, we instead split it into two args, with the first being an enum specifying
either the old pseudo node behaviour, the old drop behaviour, or the new keep behaviour.

We then use the new Map2Parent to map pods to:
	* A replica set, if it has one
	* A daemonset, if it has one
	* Itself, if neither of the above
and then map again from the results to any deployment, leaving as-is any nodes that
don't map to a deployment. Hence we are left with:
	* Deployments
	* Daemonsets
	* Replica sets, but only if they map to no deployment
	* Pods, but only if they map to none of the above
and connections between all these will be calculated correctly.
2017-06-27 10:19:04 -07:00
Mike Lang
d0cbf47c1c Add an option group to Combined view to select group type (daemonset or deployment)
This is a union set, so it will be suitable even as we continue to add more node types to this view.
2017-06-27 10:19:04 -07:00
Mike Lang
6dae014352 Add new view for 'combined' daemonset/deployment view
The idea is that this view shows all 'pods or groups of pods' at 'the highest level of abstraction'.
For now, we just show daemonsets and deployments.
2017-06-27 10:19:04 -07:00
Matthias Radestock
d66b28de2a performance: only color connected once
ProcessRenderer was coloring connected nodes because we need that info
for rendering details panels. However, the main process topology view
renderers depending on ProcessRenderer were also doing coloring
themselves. For the 'processes' topology that was literally
duplicating work. For the 'processes-by-name' topology that was
throwing away the process coloring, and then coloring at the name
level.

Solution: remove the coloring from the ProcessRenderer, thus
eliminating the duplicate/thrown-away work, and introduce a
ColorConnectedProcessRenderer which is only used in places that
populate details panels.
2017-06-22 10:28:39 +01:00
Matthias Radestock
8c6a171553 refactor: extract a couple of heavily used constants 2017-06-21 21:12:55 +01:00
Matthias Radestock
ae2a5edc18 make nodeSummaryGroupSpecs only include what's needed 2017-06-21 18:24:14 +01:00
Matthias Radestock
b6c886e0d1 cosmetic 2017-06-21 18:19:10 +01:00
Matthias Radestock
a306867610 fast network membership check
The rendering code checks whether endpoint IPs are part of
cluster-local networks. Due to the prevalence of endpoints - medium
sized reports can contain many thousands of endpoints - this is
performance critical. Alas the existing code performs the check via a
linear scan of a list of networks. That is slow when there are more
than a few, which will be the case in the context of k8s, since there
the probes register service IPs as local /32 networks.

Here we change representation of the set of networks to a prefix
tree (aka trie), which is well-suited for IP network membership checks
since networks are in fact a bitstring prefixes.

The specific representation is a crit-bit tree, but that choice was
purely based on implementation convenience - the chosen library is the
only one I could find that directly supports IP networks.
2017-06-21 03:03:49 +01:00
Matthias Radestock
9e75331e9a Revert "fast network membership check"
This reverts commit 98f036359b.
2017-06-20 20:51:27 +01:00
Matthias Radestock
98f036359b fast network membership check
The rendering code checks whether endpoint IPs are part of
cluster-local networks. Due to the prevalence of endpoints - medium
sized reports can contain many thousands of endpoints - this is
performance critical. Alas the existing code performs the check via a
linear scan of a list of networks. That is slow when there are more
than a few. Unfortunately in some common k8s network setups, e.g. on
AWS, a cluster can contain hundreds of networks, due to /32 networks
derived from interfaces with multiple IPs.

Here we change representation of the set of networks to a prefix
tree (aka trie), which is well-suited for IP network membership checks
since networks are in fact a bitstring prefixes.

The specific representation is a crit-bit tree, but that choice was
purely based on implementation convenience - the chosen library is the
only one I could find that directly supports IP networks.
2017-06-20 19:31:11 +01:00
Matthias Radestock
873fac12ac memoize isKnownServices for improved performance 2017-06-19 13:29:43 +01:00
Matthias Radestock
0d0414d348 faster matching of known services
We hit this code *a lot* during rendering.
2017-06-18 16:02:34 +01:00
Mike Lang
f403d01885 Forgot to include daemonsets in renderKubernetesTopologies
Yay, needing to remember 10 different obscure places to add a new topology every time.
2017-06-12 10:13:54 -07:00
Matthias Radestock
afbc1decab drop addr and port from Endpoint.Latest map
the information is constant and already present in the id, so we can
extract it from there.

That reduces the report size and improves report encoding/decoding
performance. It should reduce memory usage too and improve report
merging performance too.

NB: Probes with this change are incompatible with old apps.
2017-06-10 19:19:56 +01:00
Matthias Radestock
912c684e65 optimise memoisation for parallel execution
don't start the same piece of work twice
2017-06-05 10:30:11 +01:00
Matthias Radestock
91d3497f7d parallelise 'reduce' 2017-06-05 08:44:17 +01:00
Matthias Radestock
6eaffb44e0 fix bug: handle short-lived ebpf-tracked connections again
This got broken in #2559.

The problem here is similar to #2551.
2017-06-04 18:42:54 +01:00
Matthias Radestock
30c38a958f remove blatant falsehoods from comments 2017-06-04 16:23:03 +01:00
Matthias Radestock
ebcf9dcf10 refactor: rename ShortLivedConnectionJoin to ConnectionJoin
since it's dealing with *all* connections, not just short-lived ones.
2017-06-04 16:10:21 +01:00
Matthias Radestock
9bc7b30f0f extract and expand endpoint procspied filter
The filter needs to exclude both procspied and eBPF-tracked endpoints,
since both will be picked up by the process topology.
2017-06-04 16:10:21 +01:00
Matthias Radestock
707add13a3 refactor: simplify some filters 2017-06-04 16:10:21 +01:00
Matthias Radestock
ee0736df69 refactor: extract constant mapEndpoint2IP 2017-06-04 16:10:21 +01:00
Matthias Radestock
6697f4a897 refactor: declosure ShortLivedConnectionJoin 2017-06-04 16:10:21 +01:00
Matthias Radestock
ff4a4c08ce refactor: remove pointless optimisation 2017-06-04 10:36:55 +01:00