Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

Check manually-assigned addresses with IPAM to see if they clash #1200

Merged
merged 2 commits into from
Jul 27, 2015

Conversation

bboreham
Copy link
Contributor

Fixes #687 and #598

One quiet change in this PR:

  • avoid printing error messages from 'claim' twice in the logs

@rade
Copy link
Member

rade commented Jul 20, 2015

I could add some more lines to remove this if desired.

yes, please.

@bboreham
Copy link
Contributor Author

Done

@squaremo squaremo self-assigned this Jul 21, 2015
resultChan := make(chan error)
op := &claim{resultChan: resultChan, ident: ident, addr: addr}
op := &claim{resultChan: resultChan, ident: ident, addr: addr, launch: launch}

This comment was marked as abuse.

This comment was marked as abuse.

This comment was marked as abuse.

@squaremo
Copy link
Contributor

I think these are two different operations, rather than a variation on one operation (and perhaps that is why I was confused by "launch").

The first is to tell weave about an IP that had been claimed previously. The second is to ask for a particular IP that has not been handed out previously. It's actually the latter that deserves the name "Claim"; the former is more like, well, "Reclaim" or "Recover".

How this is reflected in the HTTP API, I'm not sure -- PUT to a URL seems a good match for both. So a query arg might be appropriate for discriminating.

@bboreham
Copy link
Contributor Author

I renamed 'launch' to 'reclaim'; rebased and squashed.
Also changed the behaviour to output a message and carry on when IPAM is waiting for quorum, rather than hang the caller. This is more in line with what #687 asks for.

@@ -12,6 +12,7 @@ type claim struct {
resultChan chan<- error
ident string
addr address.Address
reclaim bool
}

func (c *claim) sendResult(result error) {

This comment was marked as abuse.

@bboreham
Copy link
Contributor Author

I decided noErrorOnUnknown described the behaviour best.

alloc.infof("Claim %s for %s: address allocator still initializing; will try later.", c.addr, c.ident)
c.sendResult(nil) // don't make the caller wait
} else {
c.sendResult(fmt.Errorf("%s is in the range %s, but the allocator is not initialized yet", c.addr, alloc.universe.AsCIDRString()))

This comment was marked as abuse.

This comment was marked as abuse.

This comment was marked as abuse.

@rade
Copy link
Member

rade commented Sep 3, 2015

I struggle to see how this solves #598. Please explain.

@bboreham
Copy link
Contributor Author

bboreham commented Sep 3, 2015

Line 866 in the weave script informs IPAM of a manually-selected address. If this can be granted, it is, and hence IPAM will not then allocate that address to something else, which I thought was the main issue of #598.

@rade
Copy link
Member

rade commented Sep 3, 2015

ok

@bboreham
Copy link
Contributor Author

bboreham commented Sep 3, 2015

I should perhaps have updated the docs, where it says

make sure they don’t conflict with any IP ranges in use on the hosts (including those delegated to weave’s automatic IP address allocator)

@rade
Copy link
Member

rade commented Sep 3, 2015

Surely http://docs.weave.works/weave/master/head/ipam.html#manual should be updated.

rade added a commit that referenced this pull request Sep 3, 2015
Update docs for mixed manual and automatic IP allocation

Missed from #1200.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants