Commit Graph

36 Commits

Author SHA1 Message Date
Bryan Boreham
5ab00ae664 Build: update to Go 1.10
So that we can rely on the fix to runtime.LockOSThread()
2018-06-02 21:48:01 +00:00
Marc Carré
4e58b83024 Add org.opencontainers.image.* labels to Dockerfiles
- This should ultimately help for image-to-code back references.
- `org.label-schema.*` labels are now deprecated, in favour of `org.opencontainers.image.*` labels.
  See also: https://github.com/opencontainers/image-spec/blob/master/annotations.md#back-compatibility-with-label-schema
- Git revision (`git rev-parse HEAD`) is now injected at `docker build` time.
2018-05-14 11:54:33 +01:00
Bryan Boreham
3db91bced4 Upgrade Go to 1.9.2 2017-12-16 23:24:22 +00:00
Bryan Boreham
6acb397d5d Install yapf and flake8 required by build-tools lint 2017-07-13 16:11:59 +00:00
Roland Schilter
c1b56c81b7 Use latest go1.8.3 2017-06-21 14:41:51 +02:00
Alfonso Acosta
d5ad391721 Add build-essential package 2017-06-20 20:09:50 +00:00
Alfonso Acosta
1520444ab6 Use Go 1.8 2017-06-20 13:56:02 +00:00
Roland Schilter
b78745f615 Execute tests in the prog/ directory (#2567)
Also fixed prog/main_test.go (which has never been part of the test suite so far)
2017-06-08 15:41:53 +02:00
Alfonso Acosta
cb0afade3e Use shfmt v1.3.0 instead of gopkg.in's v1
"inspired" by 1ba9d6d82c
2017-05-22 17:27:35 +02: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
Alessandro Puccetti
3f497dd82a backend: fix permissions and add hclfmt
After updating build-tools, I got new errors:

> ./tools/lint: line 134: hclfmt: command not found

> go install net: open /usr/local/go/pkg/linux_amd64_race/net.a:
> permission denied

This patch works around that by doing the same thing as:
https://github.com/weaveworks/build-tools/pull/44/files
2017-02-21 17:19:19 +01:00
Tom Wilkie
fe81ef98f4 Update to go1.7.4 (#2147) 2017-01-22 19:51:38 +00:00
Iago López Galeiras
43d9f38c5e Fix various linter issues
Found via shellcheck.
2017-01-18 11:51:41 +01:00
Iago López Galeiras
ec0b6dd8d0 backend: add shfmt command to the docker image 2017-01-09 16:40:16 +01:00
Tom Wilkie
d1cf9f60fc Upgrade to go1.7 (#1797)
* Upgrade to go1.7

* Use the 1.7.1 tag
2016-09-13 12:40:33 +01:00
Jonathan Lange
ddf80d05cb Actually run shell-lint on tools 2016-07-12 14:22:09 +01:00
Tom Wilkie
fb8704f82d Upgrade to go1.6.2 2016-04-21 10:04:08 +01:00
Tom Wilkie
31a90c76c4 Update to go 1.6.1 2016-04-13 13:29:34 +01:00
Tom Wilkie
b9233561d8 Remove temporary files in the build container to shrink it down by ~100MB 2016-03-24 12:06:25 +00:00
Tom Wilkie
a4e707d179 Project specific changes for misspell.
- Add misspell to build container.
- Add file to build container.
- Ignore dagre spelling
2016-03-23 10:51:21 +00:00
Alfonso Acosta
783297672c Invoke Go consistently and remove GO15VENDOREXPERIMENT from container 2016-03-10 11:25:15 +01:00
Tom Wilkie
b9f788993b Upgrade to go1.6 2016-03-01 12:31:54 +00:00
Paul Bellamy
2fc05672db containerize build of prog/static.go 2016-02-16 13:55:51 +00:00
Tom Wilkie
baec4688cb Various improvements to build & tests
- Fix broken wait in tests.
- Run lint in the build container.
- Merge two quick steps in the circle plan.
- Increase number of test VMs to 3 (again).
2016-01-15 10:00:41 -08:00
Tom Wilkie
e5541b965b Update to go1.5.3 2016-01-13 16:21:51 -08:00
Tom Wilkie
4ea7453008 Update Makefile inline with some comments from weave's build. 2016-01-11 11:37:23 +00:00
Tom Wilkie
d6052973af Pass -i to go build to speed up builds. 2016-01-04 16:48:41 +00:00
Tom Wilkie
1ad7b4fce5 Speed up tests on circle.
- Ensure we use up to date build container when running tests.
- Parallelise host setup for integration tests.
- Pass some more circle env vars through to ./tools/tests so the scheduler works.
- Gather coverage from multiple shards.
- Create files as the right owner inside the container.
- Parallelise the circle.yaml
- Parallelise the intergration tests using existing machinery
- Build experimental in parallel.
- Use custom scheduler prefix for integration tests, so schedules don't clash with weave.
2015-11-04 15:35:21 +00:00
Tom Wilkie
43f6cf7114 Fix build warning with go1.5 2015-11-03 17:25:39 +00:00
Tom Wilkie
fb49e146ad Build experimental stuff in a container too 2015-10-26 16:11:16 +00:00
Tom Wilkie
c05b76373f Review feedback 2015-10-26 14:23:30 +00:00
Tom Wilkie
147db96567 Make the build-in-container vs not clearer to make, so it doesn't always rebuild the exes. 2015-10-26 14:02:39 +00:00
Tom Wilkie
e8c96a0242 Turn on GO15VENDOREXPERIMENT in build container; don't go get. 2015-10-24 10:24:59 +01:00
Tom Wilkie
7fd5a315e3 Build inside the build container, using go1.5, by default
Also build for GOOS=darwin and GOARCH=arm
2015-10-23 16:35:11 +00:00
Peter Bourgon
b97407a540 Use local checkout 2015-09-10 16:58:49 +02:00
Peter Bourgon
fc95067bd3 First cut of Docker build for backend 2015-09-10 15:38:48 +02:00