Commit Graph

422 Commits

Author SHA1 Message Date
Mike Lang
51999529a7 Add docker swarm Stack selector ala k8s namespace selector
We have to introduce the kinda hacky concept of a 'No Stack' stack
to reconcile it with the idea of a 'default' k8s namespace. This is important
because swarm services without a stack don't have the same docker labels as ones that do.
Curiously, they still have what appears to be a stack name 'prefix' on their names,
but I can't isolate that name anywhere easily so they'll just have to make do.

I basically copy-pasted updateFilters to make this work, todo go back and refactor
to not duplicate 90% of the code.
2017-04-18 09:08:22 -07:00
Mike Lang
2b208580ab Add new topology view for Docker Swarm services 2017-04-14 17:18:06 -07:00
Mike Lang
9f0f120bc5 Remove explicit listing of api topologies in render/detailed/node specs
Instead, we can infer them from the render topology and the primaryAPITopology map
2017-04-10 15:06:38 -07:00
Mike Lang
3656965ae7 Refactor Map2Parent and family into one function
This greatly improves code reuse while keeping the behaviour flexible
2017-04-10 14:30:53 -07:00
Mike Lang
9c88ad85e9 render/detailed/parents: Refactor for less repeated information
We replace the existing data structure with a simpler one that
only specifies how to get the parent label, which is the only
part of the Parent struct that can't be generated from the node info alone.

Future work: Standardize this concept of a label and put it in the topology instead.
Though that already exists...so just use it?
2017-04-10 14:30:52 -07:00
Mike Lang
2a74883cce If no node summary generator exists for topology, do a sane default
The default sets the node label to the node ID.
This is likely to not look very good, but the intent is that it creates an obvious problem,
ie. that the node ID is being used as the label, rather than a silent omission or more subtle problem.

Possible future work:
* For single-component IDs, extract the component automatically and use that instead.
* Instead of functions, in simple cases just have a LUT by topology with common behaviours like
  'stack = true or false', 'label = this key in node.Latest'
The latter opens up to eventually moving this info inside the report itself ala topology templates,
or at least centralizing it in the source.
2017-04-10 14:30:52 -07:00
Mike Lang
c16becc148 render/detailed: When summarising children, add fallback for unlisted topologies
Currently, if a topology does not have any specific info in nodeSummariesByID,
any children of the node that belong to that topology will be silently omitted.

This change adds a default behaviour for such topologies, with no special columns
but at least it is displayed at all.
Unlisted topologies are displayed after all listed ones, in arbitrary order.

Note that completely bogus or other special cases (eg. topology = Pseudo) still will not
be displayed as report.Topology() will fail.
2017-04-10 14:30:52 -07:00
Mike Lang
14ab5ccceb render: Maintain a list of 'primary' api topologies for each report topology
This gives us a single source of truth in a variety of situations where we want to
know what view to direct a user to in order to 'open' a particular node.

I wanted to put this in app/api_topologies where the views are defined, but that creates
a circular import.
2017-04-10 14:30:52 -07:00
Mike Lang
efb68fb2da api_topologies: Add a selectType field to option groups
This field changes the option group behaviour depending on its value.
Currently only supports two values:
"one" (default): Old behaviour, one option can be selected
"union": Any number of options can be selected, and the filters are OR-ed togther

It is written in such a way as to easily enable a future "intersection" option,
as per union but AND-ing the filters. But this is not done here. YAGNI.
2017-03-27 10:06:56 -07:00
Alfonso Acosta
8814e856e0 Merge pull request #2338 from weaveworks/2324-exclude-pause-from-k8s
Exclude pause containers when rendering k8s topologies
2017-03-23 23:48:17 +01:00
Mike Lang
da8b8d5095 Revert "Revert "Merge pull request #2285 from weaveworks/mike/k8s-ns-in-container-view""
This reverts commit d55c528fe2.
2017-03-20 10:05:10 -07:00
Mike Lang
d55c528fe2 Revert "Merge pull request #2285 from weaveworks/mike/k8s-ns-in-container-view"
This reverts commit 76ddc75fb8, reversing
changes made to 3ade2933eb.

We are rolling this back for now because it's causing a bug where sub-topologies
would have ~3000 repeated cases of the k8s filters, causing performance issues clientside.
2017-03-17 14:00:05 -07:00
Mike Lang
76ddc75fb8 Merge pull request #2285 from weaveworks/mike/k8s-ns-in-container-view
When k8s present, allow filtering of containers by namespace
2017-03-16 14:56:10 -07:00
Mike Lang
b01e890475 When k8s present, allow filtering of containers by namespace
To facilitate this, we replace the existing functionality of updateFilters which
sets k8s topologies to have the filters [namespace, managed], to instead append the namespace filter
to any existing. This lets it apply to both k8s and container topologies without overwriting existing
container filters. We instead set the managed filter in the static definition.

This however has the side effect that the ordering of the namespace filter and the managed filter
in k8s topologies has been reversed, so it reads:
	Show Unmanaged | Hide Unmanaged
	foo | bar | default | baz | All Namespaces
instead of:
	foo | bar | default | baz | All Namespaces
	Show Unmanaged | Hide Unmanaged
2017-03-16 14:21:11 -07:00
Alfonso Acosta
806b27e785 Exclude pause containers when rendering k8s topologies 2017-03-16 12:18:28 +00:00
Iago López Galeiras
9920c4ea48 Add eBPF connection tracking without dependencies on kernel headers
Based on work from Lorenzo, updated by Iago, Alban, Alessandro and
Michael.

This PR adds connection tracking using eBPF. This feature is not enabled by default.
For now, you can enable it by launching scope with the following command:

```
sudo ./scope launch --probe.ebpf.connections=true
```

This patch allows scope to get notified of every connection event,
without relying on the parsing of /proc/$pid/net/tcp{,6} and
/proc/$pid/fd/*, and therefore improve performance.

We vendor https://github.com/iovisor/gobpf in Scope to load the
pre-compiled ebpf program and https://github.com/weaveworks/tcptracer-bpf
to guess the offsets of the structures we need in the kernel. In this
way we don't need a different pre-compiled ebpf object file per kernel.
The pre-compiled ebpf program is included in the vendoring of
tcptracer-bpf.

The ebpf program uses kprobes/kretprobes on the following kernel functions:
- tcp_v4_connect
- tcp_v6_connect
- tcp_set_state
- inet_csk_accept
- tcp_close

It generates "connect", "accept" and "close" events containing the
connection tuple but also pid and netns.
Note: the IPv6 events are not supported in Scope and thus not passed on.

probe/endpoint/ebpf.go maintains the list of connections. Similarly to
conntrack, it also keeps the dead connections for one iteration in order
to report short-lived connections.

The code for parsing /proc/$pid/net/tcp{,6} and /proc/$pid/fd/* is still
there and still used at start-up because eBPF only brings us the events
and not the initial state. However, the /proc parsing for the initial
state is now done in foreground instead of background, via
newForegroundReader().

NAT resolution on connections from eBPF works in the same way as it did
on connections from /proc: by using conntrack. One of the two conntrack
instances is only started to get the initial state and then it is
stopped since eBPF detects short-lived connections.

The Scope Docker image size comparison:
- weaveworks/scope in current master:  22 MB (compressed),  68 MB
  (uncompressed)
- weaveworks/scope with this patchset: 23 MB (compressed), 69 MB
  (uncompressed)

Fixes #1168 (walking /proc to obtain connections is very expensive)

Fixes #1260 (Short-lived connections not tracked for containers in
shared networking namespaces)

Fixes #1962 (Port ebpf tracker to Go)

Fixes #1961 (Remove runtime kernel header dependency from ebpf tracker)
2017-03-08 22:11:12 +01:00
Filip Barl
2e9255b190 Addressed the comments and fixed the tests. 2017-02-20 11:40:40 +01:00
Filip Barl
f1904a626f Fix filtering issue for uncontained nodes in DNS name view (#2170). 2017-02-20 11:38:21 +01:00
Mike Lang
fad3e88269 Rename ECS Service node ids to be cluster;serviceName
This is important for two reasons:
* It prevents nasty false-equality bugs when two different services from different ECS clusters
  are present in the same report
* It allows us to retrieve the cluster and service name - all the info we need to look up the service -
  using only the node ID. This matters, for example, when trying to handle a control request.
2017-02-03 13:45:18 -08:00
Alfonso Acosta
0a135e6330 Check for known services before external IPs
Known services can be internal (e.g. same VPC in AWS)
2017-01-31 15:37:57 +00:00
Mike Lang
fca76d661e Merge pull request #2145 from weaveworks/mike/render/fix-ecs-detailed-parents
render.detailed: Add ECS topologies to detailed parents conversion
2017-01-23 13:23:45 -08:00
Mike Lang
19b6d5b1c4 Merge pull request #2146 from weaveworks/mike/render/fix-ecs-detailed-children
render.detailed: Teach detailed node view how to display ECS topologies as children
2017-01-23 13:23:27 -08:00
Mike Lang
eb44e95922 render.detailed: Teach detailed node view how to display ECS topologies as children
Previously, they were omitted.
2017-01-20 18:07:54 -08:00
Mike Lang
39e735f99e render.detailed: Add ECS topologies to detailed parents conversion
so they will correctly show up in the details view.
Currently, since ECS topologies aren't considered, the ECS parents of nodes are silently dropped.
2017-01-20 17:12:40 -08:00
Filip Barl
d3466b5454 Refactored the table component/model and wrote the tests
Backward-compatibility fix
2017-01-16 17:05:36 +01:00
Filip Barl
31be525bd2 Created generic table model on backend
Replaced MetadataRow with generic Row in Table model

Sending through multicolumn tables from the backend
2017-01-16 12:22:10 +01:00
Jonathan Lange
1020fc5f85 Use test.Diff from common 2016-12-07 11:22:40 +00:00
Jonathan Lange
e8085b01b6 Use 'common' library 2016-12-07 11:22:38 +00:00
Alfonso Acosta
f8b1f71f06 Finish rendering for ECS topologies 2016-11-29 07:18:08 -08:00
Alfonso Acosta
78775bbdb8 Initial rendering for ECS
(not working yet)
2016-11-29 07:18:05 -08:00
Filip Barl
d15e884cb1 Table-mode: sort ips numerically (#2007)
Fix #1746 - sort IPs numerically in the table mode
2016-11-22 11:05:59 +01:00
CarltonSemple
9833a854b1 Added container filters as CLI arguments
gofmt load_container_filters.go

removed the environment variable for container label filters

Added the --app.container-label-filter command line argument, and load_container_filters.go now uses the results from that

Changed init() to InitializeTopologies()

Changed init() to InitializeTopologies() so that it can be called after the container filters are loaded from the command line argument. init() executes before main() in prog/main.go, so the flag parsing isn't finished before init() is called

Applied lint fixes

fixed lint issues

brought back the init function for api_topologies.go

Addressed many of the PR comments, except escaping colons

Renamed IsDesired to HasLabel in render/filters.go

Allows for the user to escape colons

added registry function for modifying the container filters

created a separate function that parses the container filter flags

simplified registry.addContainerFilters()

addressed review comments

switched API Topology Description IDs to constants

addressed review comments

joined constants

added test functions

addressed most of the review comments

Changed containerLabelFilters to an array of APItopologyOptions, placing the parsing in the Set() function. Removed parsing from HasLabel in render/filters.go

refactored code

added test that applies to the container filtering by labels

applied golint

made Registry items private and added a MakeRegistry() function

fixed usage of topologyRegistry.RendererForTopology

Added container label filters by exclusion

minor update to report_fixture

Modified container labels test to use existing report

I added labels to the existing containers in the fixed report for testing.

refactored code

refactored code

further code refactoring

addressed @ijsnellf's review comments

unexported Registry, and reduced duplicate code

addressed @ijsnellf's review comments

Addressed review comments

Addressed final review comments
2016-11-15 19:13:35 +00:00
Alfonso Acosta
3af7076f30 Review feedback 2016-11-02 14:46:56 +00:00
Alfonso Acosta
d0e022050e Fix and extend tests 2016-11-02 13:16:12 +00:00
Alfonso Acosta
216cc0d605 Add image table to container nodes
Also, extend metadata of images with sizes
2016-11-02 13:16:11 +00:00
Alfonso Acosta
b458c4c0c8 Merge pull request #1182 from weaveworks/1132-weave-topology
Add the basics for a Weave-specific topology.
2016-10-28 12:23:55 +02:00
Alfonso Acosta
f906511ded Add initial metadata in details panel and clarification comments 2016-10-26 09:09:01 +00:00
Alfonso Acosta
3023f4be80 Add Weave summary generator and fix Weave renderer 2016-10-26 07:40:14 +00:00
Alfonso Acosta
e80a01aab9 Filter out docker overlay peers 2016-10-24 17:37:53 +00:00
Alfonso Acosta
8e4dfd7987 Add Weave peers view 2016-10-24 15:33:30 +00:00
Alfonso Acosta
529759b603 Discard short-lived connections to/from Pods in the host net 2016-10-21 14:42:44 +00:00
Alfonso Acosta
16ae11da77 Merge pull request #1922 from kinvolk/lorenzo/lint-untyped-keys
Fix linter errors on unkeyed fields
2016-10-20 11:32:59 +02:00
Simon
f6e81cf4d6 Merge pull request #1912 from weaveworks/1844-visually-duplicate-rows
Add label_minor to tooltips in connections table
2016-10-19 15:03:38 +02:00
Simon Howe
2ca23507de label_minor -> labelMinor, closer to all camelCase api 2016-10-19 10:50:11 +02:00
Lorenzo Manacorda
7ed139b15b fix linter errors on unkeyed fields 2016-10-14 12:53:48 +02:00
Simon Howe
bec4d281c3 Add label_minor to tooltips in connections table
Sometimes label is not enough to distinguish between rows.
2016-10-10 15:15:31 +02:00
Alfonso Acosta
5eabf5436c Make linter happy 2016-10-05 13:07:17 +00:00
Alfonso Acosta
3f27d5f6cc Do not filter out the target nodes when obtaining the details panel 2016-10-05 12:22:50 +00:00
Simon Howe
70681e4694 Fixes BE tests after exposing Truncate to the FE. 2016-09-28 12:18:12 +02:00
Matthias Radestock
5ce5d541d3 show forward DNS name for internet addresses
...if available.

Follow-up to #1863.
2016-09-22 21:01:44 +01:00