Commit Graph
14 Commits
Author SHA1 Message Date
Matthias Radestock f7f0369bff improve logging in proxy
- always info-log when we encounter an 'interesting' container
- s/CIDR/WEAVE_CIDR
- some other minor tweaks
2015-05-19 19:46:53 +01:00
Paul Bellamy 610bc46970 proxy should provide reasonable error when execing on a container which doesn't exist 2015-05-19 17:37:23 +01:00
Paul Bellamy e6b587ea8d proxy needs to add weavewait to execs as well
Bug came up in a test where we are restarting and doing an exec checking
a network interface right away. weavewait is only added if the container
has a WEAVE_CIDR var set, the same as at container creation.
2015-05-19 17:36:53 +01:00
Paul Bellamy 62242cb640 fixup bad golint refactor 2015-05-19 11:46:03 +01:00
Paul Bellamy ee07d645b4 golint cleanup of else block 2015-05-19 10:47:57 +01:00
Paul Bellamy b71a428369 proxy should be sending error code to client, instead of exiting 2015-05-19 10:34:46 +01:00
Paul Bellamy 2f8c5d7bd9 proxy interceptors implicitly modify arguments, instead of returning them 2015-05-19 10:34:46 +01:00
Matthias Radestock 126d4f4079 some refactoring and tidying
- some inlining
- compile regexps once
- consistent error messages
- always mention container id in startContainerInterceptor errors
2015-05-19 10:34:46 +01:00
Paul Bellamy ca4b8e6f8e add proxy support for 'docker restart' 2015-05-19 10:34:46 +01:00
Paul Bellamy 2a120e5565 refactor proxy rawStream handler 2015-05-19 10:34:46 +01:00
Paul Bellamy bedc20c7c1 extract docker-bridge-ip fetching from proxy into bash script 2015-05-19 10:34:46 +01:00
Paul Bellamy 96a69d2303 Add dns support for the proxy
In the proxy, I swapped the 'flag' library for
'code.google.com/p/getopt', which uses double-dash flags.

proxy lets 'weave attach' do dns registration on container start

proxy needs to set DNSSearch if not specified
2015-05-19 10:34:45 +01:00
Paul Bellamy 444b1482fa add weavewait
binocarlos/wait-for-weave is Apache2 licensed, so attribution/etc applies. Thus, we
re-invent the wheel here.
2015-05-19 10:34:45 +01:00
Michael Bridgen 6d7de3ddff Proxy implementation
This adds a docker remote API proxy to the weaveexec image. The proxy
has hooks for (post-) container start and (pre-) container create; the
former attaches a weave interface to a container given a WEAVE_CIDR
environment entry, and the latter adjusts the entrypoint of a container
to wait for the ethwe interface.

Notes:

None of the hooks need to inspect/change large bodies. In order to avoid
a crash when handling images larger than memory we need to ensure that
the entire request body is never loaded into memory (i.e. No
ioutils.ReadAll).

When proxying a raw-stream response, we can't use http.WriteHeader. It
sets the Transfer-Encoding to chunked, which will throw off the clients.
Instead we have to hijack the socket, and write out http status code
manually.

For chunked transfer-encodings, clients (docker-py) depend on each http
chunk containing exactly one JSON object. Therefore, we cannot re-chunk
the body, and have to pass it across verbatim.

Proxy needs to pass multi-cidrs separately when calling weave. Otherwise
they get smashed together on the command line, and the call fails.

When creating the image, if no entrypoint is specified on the container,
it should use the entrypoint of the image. Code for this is based on
powerstrip-weave.

We handle WEAVE_CIDR='' by acting like it is not set. The reason being,
that because WEAVE_CIDR is inherited from images (along with env vars),
setting it to blank is equivalent to unsetting it.
2015-05-19 09:48:12 +01:00