Commit Graph
118 Commits
Author SHA1 Message Date
Bryan Boreham e89fc8f66a Merge pull request #2929 from weaveworks/issues/2906-plugin-v2-docker-sock
Work around missing docker.sock in plugin-v2
2017-05-09 10:14:47 +01:00
Martynas Pumputis 34ec7bd1c9 Do not populate network info map in plugin-v2
Avoids unnecessary locking.
2017-05-08 23:47:40 +03:00
Bryan Boreham 9a90898c7d Merge branch 1.9 2017-05-05 20:54:46 +01:00
Martynas Pumputis 2ebd358aeb Workaround missing docker.sock in plugin-v2
"docker.sock" is used to access Docker API which is required to:

1. subscribe to Docker events to configure-arp,
2. query Docker network info to detect whether multicast should be
   enabled.
3. get list of Swarm peers before starting the plugin.

(1) is currently not implemented.

(2) is replaced by WEAVE_MULTICAST env var which
can enable multicast for all Weave networks created by
the plugin (not ideal, but better than nothing).

(3) is fixed by not removing "restart.sentinel".
2017-05-05 17:25:17 +00:00
Marc CARRE be11db45d8 Ignore error when deleting a container's interface.
Fixes #2921, as all errors are now ignored, including `ENOENT`.
This command typically attempts to delete the network interface `eth0` of a container being destroyed by Kubernetes.
If this interface has already been destroyed or is missing for whatever reason, we still want to remove this container's entry from IPAM in order to free associated resources.
2017-05-05 17:24:08 +00:00
Marc CARRE 30213bd71e Comply to CNI 0.5 spec by always returning nil on DEL.
See also:
  "Plugins should generally complete a DEL action without error even if some resources are missing."
in:
  https://github.com/containernetworking/cni/blob/v0.5.0/SPEC.md
2017-05-05 17:24:08 +00:00
Bryan Boreham d2cbb2749e Move plugin network creation from shell script to Go
In the process, use the default subnet instead of the whole IP
allocation range.
2017-04-27 17:07:59 +00:00
Bryan Boreham f05bb6c4e0 Don't assume we always run in in host pid space
Pass the path to the proc filesystem down
2017-04-17 19:41:47 +00:00
Marc CARRE 0f0f3649a4 Fix typo: 'JSON encode payload' -> 'JSON encoded'. 2017-04-13 12:26:50 +01:00
Martynas Pumputis cfe26ae346 Add an ugly way to match whether network is ours to plugin
Docker Plugin V2 does not expose a plugin name to the plugin, so we
check for "net-plugin" within driver name of a network to detect
whether network is ours.
2017-04-12 13:05:40 +00:00
Martynas Pumputis 1a3537a8f4 Replace noDNS by dns in plugin
Just to avoid double negation.
2017-04-12 13:05:40 +00:00
Martynas Pumputis 735a7f9154 Use correct path to netns of container in plugin-v2
Used when configuring ARP settings of a container upon ContainerStarted
event.
2017-04-12 13:05:40 +00:00
Martynas Pumputis 01bfa602ad Pass noDNS and isPluginV2 flags to plugin
- "noDNS" controls whether upon ContainerStarted event a container
  should be registered within the Weave DNS.
- "isPluginV2" will be used to determine a path to host's /proc.
2017-04-12 13:05:40 +00:00
Martynas Pumputis 332762201a Reuse docker client instance in plugin
Instead of creating a new one, reuse one created in weaver.

The change removes the pinning of client API versions (1.21 in our
case).
2017-04-12 13:05:40 +00:00
Martynas Pumputis d3d2de5f1f Make NetworkAllocate to return original options
NetworkAllocate is called on Swarm master node which creates a network.
The return option map is used to describe the network, and is passed
to CreateNetwork  which is called on all nodes when a service is
created.

Returning nil instead the actual options made Docker to omit
the "works.weave.multicast" flag, thus no multicast could be used
in Swarm.
2017-04-12 13:05:40 +00:00
Martynas Pumputis d7306c66f7 Get rid of deprecated --no-multicast-route 2017-04-12 13:05:40 +00:00
Martynas Pumputis 1f42a9d2f9 Merge plugin into weaver
This simplifies the following:

- plugin-v2 does not need to start "plugin" as a separate process, thus
  Docker is able to properly restart plugin-v2 in a case of any child
  process failing.
- No need for weaveplugin container.

plugin is enabled by default when running "weave launch". when starting
only the router, you should pass "--plugin" parameter to enable it.

The env var WEAVE_NO_PLUGIN is no more.
2017-04-12 13:05:40 +00:00
Bryan Boreham 090878c157 Implement GetCapabilities on IPAM interface to eliminate warning message 2017-04-12 10:19:06 +00:00
Martynas Pumputis 53cc270f47 Make compatible with Docker Swarmkit
Implement (empty) endpoints for new NetworkAllocate and NetworkFree calls
Also update libnetwork and docker dependencies
2017-04-12 10:19:06 +00:00
Bryan Boreham 56155d0819 Extra checks on return value from IPAM plugin 2017-03-21 11:39:36 +00:00
Bryan Boreham c711826996 Blank out container ID when exec-ing a CNI ipam plugin to get bridge address 2017-03-21 11:39:36 +00:00
Bryan Boreham b5172f46c1 Honour the input version number 2017-03-16 18:23:20 +00:00
Bryan Boreham 5a6cb8e708 Allow CNI netns to be blank on DEL
Also don't error on DEL with no namespace and no addresses
2017-03-16 18:23:20 +00:00
Bryan Boreham c3c28ea27e Update CNI library to version 0.5.0 2017-03-16 18:23:20 +00:00
Bryan Boreham 6ef302b8a1 Extract FindBridgeIP to net package 2016-12-23 11:57:04 +00:00
Bryan Boreham a07e3301b1 Add 'weave expose' NAT iptables rules inside CNI plugin
This avoids a race between the plugin and the script
2016-11-14 12:37:42 +00:00
Bryan Boreham 2b4d13c5b1 Don't error on bridge address already there 2016-11-14 12:37:42 +00:00
Marc CARRE 0544901357 Factorise "_" duplicates as a constant. 2016-11-11 17:00:26 +00:00
Martynas Pumputis e611f04f41 Move NetDev utils from common/ to net/ 2016-10-19 17:03:30 +01:00
Martynas Pumputis 3492cd93d0 Use safe version of WithNetNS 2016-10-19 16:15:59 +01:00
Bryan Boreham b38a55ca7c Include more context in error messages from CNI operations 2016-10-18 17:45:09 +01:00
Martynas Pumputis 4a49ff3083 Replace usage of WithNetNSUnsafe in plugin/net/watcher.go with safer version
Unsafe version was in ConfigureARPforVeths; replacement is via `weaveutil configure-arp`
2016-10-06 15:25:05 +01:00
Adam Harrison 5cc0826ca0 Merge branch '1.6' 2016-08-10 13:16:24 +01:00
Bryan Boreham 081b95dfd0 CNI plugin assigns an IP to the bridge by itself
No need to call `weave expose` before use.
2016-08-08 15:28:26 +01:00
Bryan Boreham 88bf64722f Merge branch '1.6' 2016-07-12 10:33:38 +00:00
Martynas Pumputis 89221f117b Denote WithNetNS* functions with unsafe
Please see https://github.com/weaveworks/weave/issues/2388#issuecomment-228365069
for more details.
2016-07-05 15:12:39 +01:00
Martynas Pumputis 05baa566c6 Refactor common.GetBridgeNetDev
- Optimize. Use LinkByName instead of iterating over list of available
  links. Linux does not support interfaces with the same names.
- Remove unnecessary indirection in utility functions which return
  common.NetDev.
2016-07-05 15:12:39 +01:00
Matthias Radestock 954cd0b86a Merge branch '1.6' 2016-07-04 16:27:59 +01:00
Matthias Radestock 0635ed1854 highlight the need for weave expose in CNI/k8s (#2411)
* highlight the need for `weave expose` in CNI/k8s

Fixes #2405

* Extend error message

* rearranged the sentences

weave launch <peer hosts> seems a bit orphaned here maybe include the weave connect command as well, since it's being mentioned.
2016-07-04 16:27:11 +01:00
Bryan Boreham afe882cd94 Use more chars from endpointID to reduce clashes in veth names
Import library to get max name length IFNAMSIZ
2016-07-01 16:05:02 +01:00
Bryan Boreham ceb5f8c714 Move endpoint creation into CreateEndpoint so we can return the MAC address 2016-06-29 17:38:07 +01:00
Bryan Boreham 8bb8f70bb6 Perform arp configuration for plugin-connected containers 2016-06-14 17:53:34 +01:00
Bryan Boreham c71c630cf6 Use driver name to detect 'our' endpoints
so we don't have to remember all the endpoint IDs, or load them up
after a restart.
2016-06-14 17:52:45 +01:00
Martynas Pumputis 7670fed72c Add AWSVPC setup routines to the attach script
When running in the AWSVPC mode, we need to do the following:

- Keep the HW TX offloading on.
- Check that the allocated address belongs to the default subnet,
  because only one subnet is allowed and it should be the default one.

If it is not possible to determine whether AWSVPC is on, we ignore
all the steps, because the attachment routines have to work
regardless whether the router is running and the AWSVPC detection
is done by querying the /ipinfo/tracker endpoint served by
the router.
2016-06-08 16:44:54 +01:00
Bryan Boreham a1c3cba363 Invert multicast option in plugin
Now it's off by default, and there is an option to enable the
multicast route per-network.
We turn it on for the `weave` network created when we start the plugin.
2016-06-02 12:52:30 +01:00
Adam Harrison c9525532ea Merge branch '1.5'
Closes #2300
2016-05-26 16:08:14 +01:00
Bryan Boreham fd257f43d1 Don't release fake gateway address
Watch out for Docker releasing the fake gateway address we create when
the network is set up, and don't pass it on to Weave IPAM.
2016-05-26 12:30:03 +00:00
Bryan Boreham 6dd109a5bb Only do ethtool tx off in bridged (pcap) mode.
Detect the bridge type in the same way the weave script does.
2016-05-25 17:34:13 +01:00
Bryan Boreham 2702b85ee5 Improve veth name construction; use a constant instead of "ethwe" 2016-05-25 17:34:13 +01:00
Bryan Boreham 8717fd15ed Use 'peer' and 'veth' instead of 'guest' and 'local', after review comments 2016-05-25 17:34:13 +01:00