Commit Graph
114 Commits
Author SHA1 Message Date
Bryan Boreham a3c76e141b Move name constants to separate 'chains' package, to reduce dependencies
We don't want everyone that uses the `net` package to get a transitive
dependency on the Kubernetes APIs required by `npc`.
2020-07-29 12:55:46 +00:00
Murali Reddy 48015aa7be Weave-npc: while logging differentiate between fatal and non-fatal errors 2020-04-02 15:08:15 +05:30
Bryan Boreham ee47f0c3ee Use buffered chan to avoid losing docker events
Docker imposes a limit that events have to be retrieved within 100ms
or they are dropped on the sending side. Adding buffer space within
the Weave Net process allows those events to be collected from Docker
more quickly.

1024 is an arbitrary number, much higher than we expect to need.
2019-09-30 15:16:24 +00:00
Bryan Boreham 847046a225 Update to match upstream changes 2018-04-27 14:34:48 +01:00
Bryan Boreham 4da998ab45 Move to lower-case logrus import 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
Bryan Boreham 7611cd963c Don't return OK from status until all parts are ready 2017-05-11 14:02:45 +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
Daniel Middlecote fd28740108 Only check running containers for existing addresses 2017-03-06 22:10:45 +00:00
Marc CARRE ee659d4033 Replace weave/common/mflagext with common/mflagext.
Removes duplication between weave and common and reduces the amount of sources to compile.
2017-01-31 10:49:29 +00:00
Marc CARRE 8f9b2a36c0 Remove dep. on docker and use mflag from common.
This reduces the number of dependencies, and avoids having docker as a vendored dependency, which should speed the build up.
2017-01-31 10:30:12 +00:00
Tom Wilkie 590a151bde Move signal handling loop to common. 2017-01-26 17:55:19 +00:00
Martynas Pumputis fa05dcf6ee Do not segfault if the datapath exists
If the datapath exists when creating it, dpif.CreateDatapath
will return an empty handle which access will cause the segfault.
2016-12-20 18:16:16 +02:00
Martynas Pumputis e611f04f41 Move NetDev utils from common/ to net/ 2016-10-19 17:03:30 +01:00
Martynas Pumputis 947ae11fee Refactor NetDev utilities
- Make them safe by using the safe version of WithNetNS.
- Improve naming.
2016-10-19 16:07:53 +01:00
Martynas Pumputis cdd6ed548c Add netdev subcommands to weaveutil
The subcommands are going to be used with WithNetNS wrapper.
2016-10-19 16:07:53 +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 7249350757 Merge pull request #2531 from weaveworks/process-addrs
Add weaveutil process-addrs
2016-09-30 10:28:59 +01:00
Bryan Boreham 71491138aa Extract function to return all current process ids
This implementation should be more efficient because it only uses the
names under /proc, whereas the previous implementation fetched the
full directory entry for each one, and sorted them too.
2016-09-29 14:12:02 +01:00
Bryan Boreham ca87f8ada3 Improve comments 2016-09-29 14:06:43 +01:00
Adam Harrison a556deec78 Merge branch '1.6' 2016-09-20 16:26:48 +01:00
Martynas Pumputis 9b32bc2ab3 Close opened netns 2016-09-14 16:47:40 +01:00
Martynas Pumputis fd5e1970e1 Return nil netdev if netns of container cannot be found
The change applies to GetNetDevsWithPredicate. The function calls
FindNetDevs which already does the same filtering.

The change prevents from "container-addrs" (weaveutil) returning
"unable to open X process namespace" error which happens when
a container dies while the cmd is being executed.
2016-09-14 16:47:16 +01:00
Alfonso Acosta bdf4debdfd Use mflag package from weaveworks fork until we find a better solution 2016-08-26 11:07:21 +00:00
Martynas Pumputis 0861d05522 Address PR comments
- Do not re-enter the root netns when querying weave bridge.
- Enter the root netns when constructing the predicate.
2016-07-05 15:12:39 +01: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 7f5c37ef1e Fix "weave ps"
Make sure that any network namespace changes happens at the end of
the cmd invocation. Otherwise, we are risking to end up in a situation
in which OS scheduling threads are in a "wrong" namespace.

See WithNetNS 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 b00e7d088e Merge pull request #2372 from weaveworks/issues/2310-more-checkpoint
Add kernel version, Docker version and awsvpc setting to checkpoint info

Fixes #2310
2016-06-20 03:15:25 +01:00
Bryan Boreham 8bb8f70bb6 Perform arp configuration for plugin-connected containers 2016-06-14 17:53:34 +01:00
Bryan Boreham 1fe5c65fd4 Add kernel version, Docker version and awsvpc setting to checkpoint info 2016-06-14 12:24:37 +01:00
Bryan Boreham 85023e0a76 Extract AttachContainer() function
Also move netlink and netns code from common to net

Creates interface if not already there
Adds addresses
Move the set link 'up' to after addresses are added
2016-05-25 17:29:45 +01:00
Matthias Radestock ac0f284c5f Merge branch '1.5' 2016-05-07 14:43:04 +01:00
Adam Harrison 260b416cd7 Include interface name in container-addrs output 2016-05-06 14:12:50 +01:00
Martynas Pumputis 9dd1fbba39 Add LoggingHTTPHandler for logging REST requests at the server-side 2016-05-03 15:40:37 +01:00
Matthias Radestock 50af75972a Merge pull request #2122 from weaveworks/issues/2081-gossip-to-restarted-peer
Update weaveworks/mesh to send gossip to restarted peer

Fixes #2085.
2016-04-06 12:01:38 +01:00
Matthias Radestock 45b36b378d Merge branch '1.4' 2016-04-05 16:57:47 +01:00
Bryan Boreham ebc5dcb4bb Delay notifying observers about 'start' events
...until the container has a pid, or we see the same container die.
This is to work around https://github.com/docker/docker/issues/18574

Fixes #2090. Partially addresses #1775.
2016-04-05 16:20:07 +01:00
Bryan Boreham c38dcb1d73 Adapt to logging changes in weaveworks/mesh 2016-04-04 16:01:58 +01:00
Adam Harrison 3123418022 Merge pull request #2030 from weaveworks/issues/1992-cni-plugin
Implement CNI plugin
2016-03-21 10:51:19 +00:00
Matthias Radestock 5e0231ec5e refactor(ish): unify logging in docker client wrapper
and get rid of some debug logging.

and eliminate a dot import in the process.
2016-03-20 10:40:26 +00:00
Bryan Boreham b00f0aee65 Check errors on test for root namespace 2016-03-18 19:39:52 +00:00
Matthias Radestock 7b6364696c Merge branch '1.4' 2016-03-18 19:29:59 +00:00
Matthias Radestock 5dfd104728 reduce docker event subscription retry max interval 2016-03-18 19:29:21 +00:00
Adam Harrison f9f6e8ed26 Protect container-addrs against stopped containers 2016-03-18 10:46:30 +00:00
Bryan Boreham a66543f98e Use link ParentIndex where available 2016-03-17 18:20:18 +00:00
Bryan Boreham b153e6a0d2 Simplify, after review feedback 2016-03-17 14:29:34 +00:00
Adam Harrison b09b556796 Utility function to configure ARP cache timers 2016-03-17 14:29:25 +00:00
Bryan Boreham 2d6a916b2d Find weave veths by looking at what is connected to the bridge, not by name
and don't even look at containers running in the root namespace
2016-03-17 12:41:37 +00:00
Bryan Boreham 011fb55e5f Refactor FindNetDevs so we can get the link, and re-use parts of the function 2016-03-17 12:41:37 +00:00