-
Notifications
You must be signed in to change notification settings - Fork 672
Conversation
f64df6a
to
aeffb70
Compare
func (defaultTime) Now() time.Time { return time.Now() } | ||
|
||
func (alloc *Allocator) setTimeProvider(tp timeProvider) { | ||
// fixme |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
383cc2e
to
06f73ee
Compare
Commits re-organised and test-passing. Also extracted |
I can't see what I said about |
I've seen the following bug several times. I guess I can reproduce it about one time in three, though I have better and worse runs of luck. Just reproduced it with a build from this branch checked out sometime this morning. I'm running weave on my laptop host OS (dwragg-laptop) and in a VM (ubuntu1404): Host:
VM:
Host:
VM:
Host:
Yes, by resetting weave on one machine, I killed the weave router on another. See https://gist.github.com/dpw/3766c53f9ae700f8b26e for full panic. |
The panic after tombstone should be addressed by bboreham@5e10c23 |
Kicking off round 2 on the implementation: Although GetFor is gone, there is still a file called getfor.go. |
The code under ipam/ring and ipam/space pass addresses around as So simply do |
It seems that space.Space and its associated functions are not actually public - allocator.go works purely with space.Set. It would be nice to make that explicit by lower casing, so that the true API to the Space code is clearer. Actually, I'd go a bit further. |
I think a rebase is in order so I can do another pass on some of the parts already commented on without it all becoming terribly confusing. |
a450c37
to
62f145f
Compare
The separation of ( I can't see a strong need for the use of bitsets to represent allocated addresses. A peer will manage addresses for thousands rather than millions of containers, so we can afford to use a few bytes to track each one. On the other hand, we do need to represent the ranges of addresses owned by a peer compactly, because a peer could own a whole /8 or bigger. Given that there are no stringent performance requirements, we can use a common representation for both sets. The "owned" set suggests a representation based on ranges. I've sketched this idea out in https://gist.github.com/dpw/dd984ed746e80350e485 . I've tried to implement the main operations from SpaceSet; the few omissions should be easy to add. It's 212 lines, including some tests (although no doubt it could use a few more). |
I have nothing against asserts. I like asserts. Some of my best friends are asserts. But... Asserts are a bit like executable comments. And similarly to comments, the best assert is one that is not there because it would be obvious from the code. So an assertion should only be added when it cannot reasonably be made superfluous by improvements to the code around it. That leaves plenty of cases where asserts are appropriate. And obviousness is subjective. But I feel that some parts of the IPAM code lean a bit too heavily on asserts. And because I assume we'll see |
The asserts in ring were added to prevent future, potentially innocuous I am concerned that a bug in ipam will take down the router; I'm thinking I don't mind re:including a message in the assert. I don't see the harm in On Wednesday, 29 April 2015, David Wragg notifications@github.com wrote:
|
Discussed this with David and he'd prefer to not special case assertions inside the IPAM code. I've written it anyway, but I'm not suggesting we include this code in this PR: tomwilkie@46570f1 |
} else { | ||
return false | ||
} | ||
} |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
2547271
to
17072ac
Compare
The basic data structure used to share information about IP allocations between peers
Using the Ring CRDT and Weave gossip, provides an interface for the weave script to allocate IP addresses in `weave run`, `weave start` and `weave expose`. See docs/ipam.md for implementation details, and site/features.md for user-visible changes.
} | ||
} | ||
if httpAddr == "" || iprangeCIDR == "" { | ||
router.NewGossip("IPallocation", &ipam.DummyAllocator{}) |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
Implements the scheme described at https://github.com/weaveworks/weave/wiki/IP-allocation-design, with address ranges controlled by a CRDT gossiped between peers.
The design doc on the Wiki will be deleted when this is merged.
weave launch takes a new -iprange argument specifying the subnet to work within.
Commands updated to take advantage of IPAM: weave run, weave start, weave attach, weave expose, weave hide
Future work
Currently there is no fall-back range if you don't specify one on the command-line; it would be better to pick from a set of possibilities (checking the range is currently unused before we start using it).
How to use IPAM for WeaveDNS? It needs its own special subnet.
How should we add support for subnets in general?
We get a bit of noise in the weave logs from containers going down, now that the weave script is calling ethtool and curl via containers. It looks like "Container 1c5a03204b5eea3aeb6f43ece41c3f260a87329bfd89ded34ea3056826b59814 died"
If we hear that a container has died we should knock it out of pending?Interrogate Docker to check container exists and is alive at the point we assign an IP
To lessen the chance of simultaneous election of two leaders at start-up, peers could wait for a bit to see if more peers arrive before running an election. Also, we could look at the command-line parameters supplied to Weave, and wait longer in the case that we have been asked to connect to someone specific.[It would be good to move PeerName out of package router into a more
central package so both ipam and router can depend on it.]
There is no specific logic to time-out requests such as "give me some space": the logic will be re-run and the request re-sent next time something else happens (e.g. it receives another request, or some
periodic gossip). This means we may send out requests more frequently than required, but this is innocuous and it keeps things simple. It is possible for nothing to happen, e.g. if everyone else has
disconnected. We could have a timer to re-consider things.
The operation to Split() one space into two, to give space to another Peer, is conceptually simple but the implementation is fiddly to maintain the various lists and limits within MutableSpace. Perhaps a different free-list implementation would make this easier.