Commit Graph
139 Commits
Author SHA1 Message Date
Murali Reddy 27f9aa16d6 3206: Protect against CNI plugin being called with the host namespace
adding a check to verify if network namespace is not host network namespace

Fixes #3206
2018-07-16 12:43:09 +05:30
Bryan Boreham 5ff22a1a77 Review feedback: tidied up function names 2018-06-04 13:28:28 +00:00
Bryan Boreham c2c14410d2 Remove subprocess for changing netns
Now that Go 1.10 has removed the issue which made us do this.
2018-04-30 23:40:59 +01:00
Bryan Boreham 847046a225 Update to match upstream changes 2018-04-27 14:34:48 +01:00
Martynas Pumputis 2a12053122 Do not skip bridge initialization if such exists
EnsureBridge used to skip creation and initialization of the weave
bridge and friends if such existed. This caused problems when
EnsureBridge failed before completing all init steps and so, subsequent
weaver could not work without "weave reset".

This change makes EnsureBridge idempotent.
2017-12-17 18:51:05 +01:00
Matthias Radestock 7aad364116 Merge pull request #3158 from weaveworks/2.0
merge branch 2.0
2017-10-31 08:11:17 +00:00
Bryan Boreham 62dbe03193 Don't log nil errors in CNI DEL 2017-10-17 16:13:48 +00:00
Martynas Pumputis ade6738789 Handle "weave expose" in weaver
The change makes "weave expose" to call the "/expose" HTTP
endpoint implemented in router which exposes the bridge.

Such architectural change required as we need to know whether NPC is
enabled when exposing the bridge and weaver knows this fact the best.

Unfortunately, this change makes impossible to "weave expose"
when weaver is not running.
2017-10-17 12:08:43 +01:00
Bryan Boreham 2ede1066e9 Remove unused WeaveDomain
(left over from a22b88ed89)
2017-08-14 13:56:53 +00:00
Bryan Boreham a0d0b00938 Pass check-alive flag on claim for container 2017-06-12 14:03:53 +00:00
Bryan Boreham 37526728e0 Merge branch '1.9' 2017-05-30 13:55:49 +00:00
Avi Deitcher d13c7ea7ee Make hairpin mode default true in CNI 2017-05-30 10:30:54 +00:00
Avi Deitcher c05955d598 First cut of adding hairpin functionality to weave 2017-05-30 10:30:49 +00:00
Bryan Boreham 933b395de4 Report plugin version status via the Config object 2017-05-17 09:28:34 +00:00
Bryan Boreham 4f485f856b Factor out Plugin variables into Plugin and plugin.Config structs 2017-05-17 09:27:40 +00:00
Bryan Boreham 280651da9c Create constant for 'weave' network name and move inside if-statement for weavemesh 2017-05-17 09:27:40 +00:00
Bryan Boreham b0da4f6b91 Move proxy and plugin status from shell to Go
In the process we stop printing out the `PLUGIN_FULL_NAME`, but that
is assumed to be something the user can figure out from `docker plugin ls`
2017-05-17 09:27:22 +00:00
Bryan Boreham 3025738377 Extract pluginNameFromAddress() function 2017-05-15 13:33:17 +00:00
Bryan Boreham 0273491e6e Pass check-alive flag to IPAM API 2017-05-12 06:56:52 +00:00
Bryan Boreham 7611cd963c Don't return OK from status until all parts are ready 2017-05-11 14:02:45 +00:00
Bryan Boreham 3e0eb4ac1e Move creation of default network from weaver to plugin
This way it is more likely that we create it after the plugin is up
and running.
2017-05-11 13:59:29 +00:00
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