Skip to content

Vendoring libnetwork for the pluggable IPAM driver support#16910

Merged
abronan merged 3 commits intomoby:masterfrom
mavenugo:ipam
Oct 13, 2015
Merged

Vendoring libnetwork for the pluggable IPAM driver support#16910
abronan merged 3 commits intomoby:masterfrom
mavenugo:ipam

Conversation

@mavenugo
Copy link
Contributor

This commit brings the backend support for

All UT and IT for these backend features are in libnetwork project.
integration-cli updated with UX and API changes in docker.
(moved docker_cli_network_test.go to be !windows due to the usage of plugins).

@mavenugo
Copy link
Contributor Author

ping @icecrime.

I will push a follow up PR today with the UX options for ipam in docker network create command.

@mavenugo
Copy link
Contributor Author

(first) rebased on top of user-namespace support 🏃

@mavenugo mavenugo force-pushed the ipam branch 3 times, most recently from 2a29cb4 to 5c172d0 Compare October 11, 2015 02:34
@icecrime icecrime added this to the 1.9.0 milestone Oct 11, 2015
@mavenugo mavenugo mentioned this pull request Oct 11, 2015
@mavenugo
Copy link
Contributor Author

Added UX and API for the ipam configurations. with corresponding integration-cli tests.

@mavenugo mavenugo mentioned this pull request Oct 11, 2015
5 tasks
@mavenugo
Copy link
Contributor Author

The ipam options in the UX demands some design explanation.
These options are exactly the same that we already have in docker daemon.

--ip-range is --fixed-cidr
--gateway is --bip
--subnet is subnet of --bip' (container subnet)

Prior to the new network UX, docker had just 1 network and that is the bridge network and the only way to configure it is via the daemon flags as mentioned above.

Now that we have multiple networks that are created by the user and backed by different plugins, we generalized it in the IPAM configuration via the above options. For backward compatibility reasons we mapped the older daemon options to the new IPAM configurations for docker0 bridge and hence the existing configurations are not impacted.

For the new networks created by docker network create, they all get the same functionality and more, based on the backend IPAM driver and Network Driver.

@mavenugo mavenugo force-pushed the ipam branch 7 times, most recently from eb6f865 to 0f6155d Compare October 11, 2015 23:21
@nerdalert
Copy link

Tested network creates/subnet/connects along with loading external driver default IPAM Join() calls and they all worked as advertised 👍

@tomdee
Copy link
Contributor

tomdee commented Oct 12, 2015

What's the plan for documentation?

@mavenugo
Copy link
Contributor Author

@tomdee the networking docs are being completely overhauled as part of https://github.com/moxiegirl/docker/tree/new-networking-docs. No point adding it now and changing it shortly after.

But, we are adding developer docs to the remote driver APIs in libnetwork project just like we have for remote network driver. thanks for opening moby/libnetwork#635

@tomdee
Copy link
Contributor

tomdee commented Oct 12, 2015

Cool, so IPAM will be covered in https://github.com/moxiegirl/docker/tree/new-networking-docs too? That sounds like a good plan.

I'm having some issues with this branch when running with a remote driver.

I'm starting the daemon with

sudo ip link set docker0 down && sudo brctl delbr docker0 && sudo ip link set docker_gwbridge down && sudo brctl delbr docker_gwbridge ;sudo docker-dev daemon -D

Then I try to create a network and it fails

$ docker-dev network create -d calico test
Error response from daemon: Invalid Address Pool

The daemon outputs

DEBU[0024] Calling POST /v1.21/networks/create          
INFO[0024] POST /v1.21/networks/create                  
DEBU[0024] calico's manifest: &{[NetworkDriver]}        
DEBU[0024] calico implements: NetworkDriver             
DEBU[0024] Allocating IPv4 pools for network test (fa4e29153232e1c9b4d9b95a2bfed93c909c1885b3b1d02f575b9aa807f17a1f) 
DEBU[0024] RequestPool(GlobalDefault, , , map[], false) 
ERRO[0024] Handler for POST /v1.21/networks/create returned error: Invalid Address Pool 
ERRO[0024] HTTP Error                                    err=Invalid Address Pool statusCode=500

Let me know if you'd like me to raise this as a separate issue.

@mavenugo
Copy link
Contributor Author

@tomdee yes. the docs will be part of that effort.

The error message is originated from the calico driver. it is not a libnetwork issue.
We can chat in IRC and I can explain the network-driver role on how to make use of the IPAM data.

@tomdee
Copy link
Contributor

tomdee commented Oct 12, 2015

I've worked with @Madhu on IRC and identified a few issues here.

The problem I was hitting had nothing to do with the Calico driver. I could repro them all with the overlay driver.

  1. Using a global driver (such as Calico or the Overlay driver) can't be used with Docker unless the daemon is started with the --cluster-store flag. The current error message (that I raised above Error response from daemon: Invalid Address Pool) is no good. It needs to tell the user that they need to start the Docker daemon with the --cluster-store flag since they are using a global driver.
  2. Passing in subnet and ip-range to work around the problem docker-dev network create --subnet=10.10.0.0/16 --ip-range=10.10.10.0/24 -d overlay my_overlay causes docker to crash. Output is here https://www.irccloud.com/pastebin/JnugtTo3/
  3. Using --cluster-store with etcd fails. ERRO[0012] Handler for POST /v1.21/networks/create returned error: failed to update store for object type *libnetwork.network: 104: Not a directory (/docker/network/v1.0/network) [10]

I'm going to continue testing using --cluster-store with consul.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auxiliary IPv4 or IPv6 also: network driver lowercase

@mavenugo mavenugo force-pushed the ipam branch 2 times, most recently from 01d1bf8 to cc6aece Compare October 13, 2015 18:17
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mavenugo shouldn't it break here? If so, you could do:

if ok {
  if Data[s].IPRange != "" {
    ...
  }
  ...
  match = true
  break
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we support multiple subnet, ipranges, there cannot be multiple matches. Hence we should not break on the first match. All we are looking for is 1 exact match.

@jessfraz
Copy link
Contributor

can you make sure that any tests you added will not be run on lxc, so testRequires(c, NativeExecDriver)

@icecrime
Copy link
Contributor

It's green, LGTM (not dismissing Jess' previous comment, but just to say: I'm ok merging this).

@jessfraz
Copy link
Contributor

ok ill fix the tests after if they need it :P (not being sarcastic im in the middle of doing this now for other things )

@tiborvass
Copy link
Contributor

LGTM

abronan added a commit that referenced this pull request Oct 13, 2015
Vendoring libnetwork for the pluggable IPAM driver support
@abronan abronan merged commit 4ea3ff7 into moby:master Oct 13, 2015
@tiborvass
Copy link
Contributor

Would be great to have bash completion for this before final release /cc @albers @mavenugo

@thaJeztah
Copy link
Member

@tiborvass think those are the changes in cc6aece,

thus --subnet, --ip-range and --gateway options in docker network command, and the --aux-address option?

Also,

/cc @sdurrheimer for zsh completions 👍

@sdurrheimer
Copy link
Contributor

@thaJeztah Will do as soon as possible

@albers
Copy link
Member

albers commented Oct 14, 2015

I'll take care of bash completion, thanks for pinging me.

@thaJeztah
Copy link
Member

Thanks both!

@mavenugo
Copy link
Contributor Author

@tomdee PTAL : #17046
Also, the etcd issue should have been resolved by now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.