Commit Graph
60 Commits
Author SHA1 Message Date
Bryan Boreham e7f30106c0 Pass the WeaveDNS Domain into the proxy
instead of obtaining it via the http api
2018-01-29 15:55:36 +00:00
Matthias Radestock c25bfafcb2 refactor: make proxy log via a package-local var
which gets rid of a bunch of (dot) imports.
2016-03-20 08:31:23 +00:00
Adam Harrison ce25f58639 weave launch-proxy accepts --no-multicast-route 2015-12-14 11:53:06 +00:00
Paul Bellamy ec5a1a3977 When container is started in host (or container) networkMode, we mount a noop weavewait, so it can continue
review feedback
2015-11-03 10:18:05 +00:00
Paul Bellamy 375fd9140b review feedback
* Opted to remove json path traversal, as it added more code than it saved.
2015-10-12 15:53:07 +01:00
Paul Bellamy fbb2c213a9 [proxy] all request modification is done through map[string]interface{}
That way we are less likely fall victim to go-dockerclient, or the API changing.
2015-10-12 15:53:07 +01:00
Paul Bellamy 547c9e7f5a Removing confusing variable from getDNSDomain, just return "" when disabled 2015-09-22 15:09:32 +01:00
Paul Bellamy 74c3b0d079 [proxy] Override sneaky /start HostConfig params 2015-09-22 15:09:32 +01:00
Alfonso Acosta ce5dd847e9 [proxy] Add --hostname-from-label
This allows registering container hostnames based on a label provided when
creating the container.
2015-09-04 17:02:07 +01:00
Paul Bellamy 19ceb424c3 [proxy] refactoring out common marshalling logic 2015-09-04 13:40:07 +01:00
Matthias Radestock 8960a3a898 Merge branch '1.0'
Conflicts:
	proxy/create_exec_interceptor.go
	test/600_proxy_docker_py_test.sh
2015-08-28 20:29:43 +01:00
Paul Bellamy 6b5f35e574 [proxy] Only replace the request body if we've modified it.
This is a temporary fix for a failure in docker-py tests:
"test_valid_no_config_specified".
2015-08-28 15:09:33 +01:00
Matthias Radestock 375af0a7b9 Improve log messages for when the proxy ignores a container
- 'ignoring' could be misread as 'dropped request', so change that to
  'leaving container alone'
- more elaborate reasons
2015-08-17 16:15:45 +01:00
Paul Bellamy f55655216f [proxy] rewrite /etc/hosts from outside the container
Avoids problems when container user is non-root. Added a test for this
and the --no-rewrite-hosts flag.
2015-08-06 13:14:18 +01:00
Paul Bellamy 1d1ebc103d Merge remote-tracking branch 'upstream/1.0' 2015-08-04 14:29:12 +01:00
Paul Bellamy 7cc53c4c68 [proxy] Handle case where no command is specified.
The docker daemon can't do this because we set /w/w.
2015-08-04 12:32:42 +01:00
Paul Bellamy 55051f0194 Merge remote-tracking branch 'upstream/1.0' 2015-07-31 11:01:19 +01:00
Paul Bellamy 4958b8d37a [proxy] Mount /w from the host for weavewaited containers
We set it at container create. Had tried also setting it at start, but
it seems to cause weird behaviour, and there is no way to do it from the
CLI.
2015-07-30 15:11:03 +01:00
Matthias Radestock 3c107d675a Merge branch '1.0' 2015-07-21 11:42:49 +01:00
Paul Bellamy aa8466f688 [proxy] Mount weavewait readonly so it can't be tampered with 2015-07-21 11:30:56 +01:00
Paul Bellamy a0876becbc Merge remote-tracking branch 'upstream/1.0'
Conflicts:
	proxy/create_container_interceptor.go
	proxy/create_exec_interceptor.go
	proxy/proxy.go
	proxy/start_container_interceptor.go
2015-07-16 15:29:29 +01:00
Paul Bellamy c6fa9cb17e refactor weaveCIDRsFromConfig to return an error message 2015-07-16 15:15:32 +01:00
Paul Bellamy c13154eea9 updating comment as per golint 2015-07-16 13:58:30 +01:00
Paul Bellamy 1132d26d47 [proxy] do not weave attach containers in '--net=host|container:<name|id>' 2015-07-16 13:58:27 +01:00
Matthias Radestock 7ae06ef00d Merge pull request #1126 from weaveworks/issues/1018-more-flexible-hostname-derivation
[proxy] More flexible container name -> hostname derivation

Closes #1018.
2015-07-14 17:31:53 +01:00
Tom Wilkie 8b061fd555 Gossip-based DNS embedded in the router.
- Nameserver holds a sorted list of (hostname, peer, container id, ip) tuples.
- Entries are gossiped using topology gossip / broadcast - only new/updated entries
  are propogated as expected.
- Entries for a given peer are removed when the connection to the peer is lost.
- Entries are tombstoned when containers die.  Tombstones are kept for 10mins,
  as they do not need to survive partition, only gossip propagation delay.
2015-07-14 16:00:38 +00:00
Alfonso Acosta 4f82dc97fd [proxy] More flexible container name -> hostname derivation
Provides to new two new flags: `--hostname-match <regexp>`
and `--hostname-replacement <replacement>`. When launching a container, its name
matched against regular expression `<regexp>`. Then, based on that match,
`<replacement>` will be used to generate a hostname, which will ultimately be
handed over to weaveDNS for registration.

The substitution is implemented with
https://golang.org/pkg/regexp/#Regexp.ReplaceAllString . Thus, references to
regexp substitution groups should be prepended with a dollar sign.

For instance, if we provide `--hostname-match '^aws-[0-9]+-(.*)$'` and
`--hostname-replacement 'my-app-$1'`, running a container named
`aws-12798186823-foo` through WeaveProxy will lead to WeaveDNS registering
`my-app-foo`.

Closes #1018
2015-07-14 14:41:44 +00:00
Paul Bellamy e4458372e8 [proxy] weavewait rewrites /etc/hosts so weave ip is returned first from 'hostname -i'
Adds a --no-rewrite-hosts flag to the proxy, and be default, removes the
docker IP from hosts. We only discard the docker host when it exists, so
--net=none works.
2015-07-10 13:57:20 +01:00
Matthias Radestock 07ee2df822 cosmetic(ish): use dotted import. like everywhere else 2015-07-02 21:07:51 +01:00
Paul Bellamy 5b79e274e8 fixup logging changes, so it compiles 2015-07-02 17:04:21 +01:00
Matthias Radestock e25d1b8365 Merge branch '1.0' 2015-07-02 16:35:40 +01:00
Adam Harrison 3914c4c018 Enforce maximum length on proxy hostname derivation 2015-07-02 14:29:34 +01:00
Bryan Boreham a5ddb63fca Remove Info.Print in favour of Log.Info 2015-07-01 14:01:45 +01:00
Matthias Radestock 657bbbffbc tiny refactor: raise abstraction level 2015-06-24 18:17:15 +01:00
Paul Bellamy 34aa2e32d8 [proxy] Only prepend weavewait if not already present
This way `docker commit` will not stack up weavewaits.
2015-06-22 15:24:49 +01:00
Matthias Radestock 3732f968d0 include image name in errors
The go docker client's ErrNoSuchImage does not include the image
name. However, it is imperative that this name appears in error
messages sent to clients, since the docker client, as of version
1.7.0, only automatically pulls images when their name is present in
the error.

Fixes #967.
2015-06-20 23:36:48 +01:00
Paul Bellamy 6c26a55b5a [proxy] refactor weaveCIDRsFromConfig slightly 2015-06-17 14:51:12 +01:00
Paul Bellamy ca681bce13 [proxy] Add support for WEAVE_CIDR=none
Tells the proxy not to do anything with this container. We set it when
running weaveexec/weave/etc containers, so that the weave script works
through the proxy.
2015-06-17 14:51:12 +01:00
Paul Bellamy 220c80c3ed [proxy] --with-ipam -> --no-default-ipam 2015-06-17 11:31:33 +01:00
Paul Bellamy 2c3baa9119 use weavedns search-domain by default
iff no hostname/dns-search specified
2015-06-16 15:13:19 +01:00
Paul Bellamy 8873d69b77 [proxy] Add --without-dns flag, and change meaning of --with-dns flag 2015-06-16 14:07:40 +01:00
Bryan Boreham 79db00a90e Strip trailing period from hostname generated from weavedns domain.
We strip at the calling point rather than in the server, because DNS
servers do see the domain as ending with a '.'  representing the root.
2015-06-16 10:26:11 +01:00
Paul Bellamy 96bda1639e define weavedns http port as a constant 2015-06-11 10:27:35 +01:00
Paul Bellamy 99d9ad7042 [proxy] query weavedns for domain 2015-06-11 10:27:34 +01:00
Paul Bellamy b9850ac200 [proxy] Set hostname and domainname based on container name, when dns
Had to make the assert_dns_record test helper more robust against
'getent hosts' returning duplicates
2015-06-11 10:27:29 +01:00
Matthias Radestock 5c70c7c71a simplify interceptor structs by referencing proxy 2015-06-09 14:45:50 +01:00
Matthias Radestock f9c325c793 refactor: more sensible field order 2015-06-08 21:57:49 +01:00
Paul Bellamy e3e5934c51 Merge remote-tracking branch 'upstream/0.11'
Conflicts:
	proxy/common.go
2015-05-28 17:43:30 +01:00
Paul Bellamy c8b95a2527 fix bug in proxy handling of minimal request bodies 2015-05-28 16:24:04 +01:00
Matthias Radestock ba064a906e cosmetic: remove dead code 2015-05-28 15:17:20 +01:00