Commit Graph

672 Commits

Author SHA1 Message Date
Matthias Radestock
f0ae2bd98c refactor: use inline StringSet constructor 2017-07-04 06:29:19 +01:00
Alfonso Acosta
6c03540b1f Merge pull request #2659 from weaveworks/use-new-k8s-go-client
Use new k8s go client
2017-07-03 23:23:41 +02:00
Alfonso Acosta
84afe9fe70 Fix typo 2017-07-03 20:20:28 +00:00
Alfonso Acosta
34bfc22b4f Fix tests 2017-07-03 20:20:28 +00:00
Alfonso Acosta
7d59936d8c HostNetwork is now inlined in the pod spec 2017-07-03 20:20:28 +00:00
Alfonso Acosta
8bbbf25809 Migrate probe to new new kubernetes go-client
This namely involved importing new libraries and using the new Clientset.

Changes worth mentioning:

* The new kubernetes library doesn't provide StoreToLister wrappers, so now I am going the casting directly.
* Deleting the pods and getting their logs is done in a cleaner way (using the
  Clientset instead of the lower-level RESTclient).
2017-07-03 20:20:27 +00:00
Matthias Radestock
d12603c516 tiny refactor: use inline string set constructor in test 2017-07-03 07:55:17 +01:00
Matthias Radestock
430e74a80a refactor: remove report latest map Delete()
It wasn't used, and is problematic in any case since it introduces
non-monotonicity.
2017-07-03 02:06:21 +01:00
Matthias Radestock
9dc50b5202 refactor: hide "empty set" constants
They are an implementation detail.
2017-07-03 01:26:22 +01:00
Roland Schilter
e6bc1d6ec2 Merge pull request #2649 from weaveworks/1975-honor-docker-host-in-probe
Honor DOCKER_* env variables in probe and app
2017-06-28 09:07:52 +02: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
Roland Schilter
651e52b5a5 Honor DOCKER_* env variables in probe and app
Changed default for flag `-app.docker` to use the DOCKER_* env variables
instead of hardcoded /var/run/docker.sock; uses docker's default if
no DOCKER_HOST defined, for both probe and app.

Fixes #1975
2017-06-27 17:14:49 +02:00
Matthias Radestock
286e481771 Merge pull request #2645 from weaveworks/2644-initial-ebpf-polarity
correct polarity of initial connections

Fixes #2644.
2017-06-26 09:10:46 +01:00
Matthias Radestock
b43003fd2b refactor: remove superfluous pointering 2017-06-25 11:25:51 +01:00
Matthias Radestock
bd6cdc44a8 refactor: extract some common code 2017-06-25 11:22:32 +01:00
Matthias Radestock
181a548122 correct polarity of initial connections
Fixes #2644
2017-06-25 11:08:24 +01:00
Matthias Radestock
30e0444914 ensure connections from /proc/net/tcp{,6} get the right pid
ProcNet.Next does not allocate Connection structs, for efficiency.
Instead it always returns a *Connection pointing to the same instance.
As a result, any mutations by the caller to struct elements that
aren't actually set by ProcNet.Next, in particular Connection.Proc,
are carried across to subsequent calls.

This had hilarious consequences: connections referencing an inode
which we hadn't come across during proc walking would be associated
with the process corresponding to the last successfully looked up
inode.

The fix is to clear out the garbage left over from previous calls.

Fixes #2638.
2017-06-25 10:59:58 +01:00
Alfonso Acosta
4006040cc1 Review feedback 2017-06-23 23:52:30 +00:00
Alfonso Acosta
9778be760b Use a global lock instead 2017-06-23 09:18:51 +00:00
Alfonso Acosta
22a31fc5f1 Review feedback 2017-06-22 16:33:36 +00:00
Alfonso Acosta
4139494783 Avoid race conditions in DNSSnooper's cached domains 2017-06-22 12:58:57 +00:00
Matthias Radestock
a7cfd043fc fix fmt string error in test, found by linter 2017-06-21 21:56:34 +01:00
Matthias Radestock
4a54b75419 forgot this one in #2622 2017-06-20 20:43:26 +01:00
Matthias Radestock
4e0065a57d refactor: put all network detection code in one place 2017-06-20 09:23:52 +01:00
Matthias Radestock
19a6551de2 ignore local IPv6 addresses/networks
There is no point in paying attention to them since scope connection
tracking only deals in IPv4.
2017-06-20 09:04:08 +01:00
Alfonso Acosta
43c5ed2aaf Merge pull request #2554 from weaveworks/never-localhost
Use 127.0.0.1 instead of localhost, more
2017-06-19 22:40:37 +02:00
Alfonso Acosta
62f2c0920f Do not read tcp6 files if TCP version 6 isn't supported 2017-06-15 10:16:14 +00: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
c8f97878d2 re-target app clients when name resolution changes
Fixes #2578.
2017-06-09 12:30:26 +01:00
Matthias Radestock
fb735b65c4 cosmetic: correct comment 2017-06-09 11:31:20 +01:00
Matthias Radestock
d0b40ee4b9 correct type for "Observed Gen."
It's a number. This enables numeric sorting of Observed Gen in the
table mode of the Deployment and Replicaset views.
2017-06-08 04:27:10 +01:00
Roland Schilter
56cb02675b Back off upon errored kubernetes api requests (#2562)
closes #1009
2017-06-06 16:19:41 +02:00
Bryan Boreham
1898b67e1f Use 127.0.0.1 instead of localhost in case that name resolves to something else 2017-06-05 10:31:27 +00:00
Matthias Radestock
59f777a066 don't read all of /proc when probe.proc.spy=false
Previously we were doing the reading even though we weren't looking at
the result.
2017-06-02 14:01:25 +01:00
Matthias Radestock
b52b2078ca refactor: remove unnecessary conditional
we always have a flowWalker when not using ebpf
2017-05-25 23:04:45 +01:00
Matthias Radestock
b80a51bc39 cosmetic: remove outdated comment
we now do correctly fall back to proc scanning when eBPF fails
2017-05-25 23:04:45 +01:00
Matthias Radestock
a6cc8ece4f simplify connection tracker initialization
- eliminate the code duplication when falling back to procfs scanning
- trim some superfluous comments

Also fix a bug in the procvess: when falling back to procfs scanning
in ReportConnections, the scanner was given a "--any-nat" param, which
is wrong.
2017-05-25 23:02:19 +01:00
Alfonso Acosta
0aec26653b Guard against null DaemonSet store 2017-05-24 11:36:26 +00:00
Mike Lang
c0751cd4e2 probe/kubernetes: Propagate errors in getting label selectors 2017-05-19 15:06:53 -07:00
Mike Lang
d4a5360d4c k8s probe: Collect info on daemonsets for new DaemonSet topology 2017-05-19 15:06:51 -07:00
Alban Crequy
d715ccc391 ebpf: handle fd_install events from tcptracer-bpf
Since https://github.com/weaveworks/tcptracer-bpf/pull/39, tcptracer-bpf
can generate "fd_install" events when a process installs a new file
descriptor in its fd table. Those events must be requested explicitely
on a per-pid basis with tracer.AddFdInstallWatcher(pid).

This is useful to know about "accept" events that would otherwise be
missed because kretprobes are not triggered for functions that were
called before the installation of the kretprobe.

This patch find all the processes that are currently blocked on an
accept() syscall during the EbpfTracker initialization.
feedInitialConnections() will use tracer.AddFdInstallWatcher() to
subscribe to fd_install  events. When a fd_install event is received,
synthesise an accept event with the connection tuple and the network
namespace (from /proc).
2017-05-19 14:49:38 +02:00
Alfonso Acosta
dbdb648ada Merge pull request #2527 from weaveworks/2494-track-non-natted-shortlived-conns
Let conntrack track non-NATed short-lived connections
2017-05-19 01:42:02 +02:00
Alfonso Acosta
2d6034a2e5 Re-enable pod shortcut reports 2017-05-18 10:21:32 +00:00
Alfonso Acosta
7497c7d432 Let conntrack track non-NATed short-lived connections 2017-05-16 23:15:16 +00:00
Alfonso Acosta
5079c114bc Merge pull request #2507 from kinvolk/alban/perf-map-fixes
ebpf connection tracker: perf map fixes
2017-05-16 21:57:42 +02:00
Alban Crequy
9079677873 ebpf tracker: add callback for lost events
Lost events were previously unnoticed. This patch adds an error in the
log and stops the ebpf tracker if an event is lost.
2017-05-10 18:37:32 +02:00
Alfonso Acosta
aec715653a Avoid null dereferences in ECS client (encore) 2017-05-10 16:25:32 +00:00
Alfonso Acosta
26eaadbbaa Avoid null dereferences in ECS client 2017-05-10 15:28:53 +00:00
Alfonso Acosta
88874782be Log specific error when deployments are not supported 2017-05-05 14:30:59 +02:00
Alban Crequy
598c6a0238 proc walker: cache limits and cmdline/name after parsing 2017-05-05 13:05:08 +02:00