Issue #18: IP Allocator rework - #26
Conversation
|
Nice! But golint failed. |
|
Yeah, I just resubmitted after taking care of golint comments. I really love golint... |
|
To rectify my last comment, regarding the multiple IPAM plugins, that was just an example about the flexibility of the register. Not that there is actually an idea of supporting them at the moment. |
|
@aboch I think that register is not flexible at all :( I think that having one allocator struct per network driver is much more flexible. Also probably have two allocators in system not bad too. |
|
During the design discussions happened so far, we converged toward the decision of having the IPAM and network services be provided by two separate entities. Though they will be tied to a common API contract specified by libnetwork. If we take this separate IPAM plugin requirement, I see the registering logic a natural implementation. |
|
Having IPAM and network driver as separate structures is easy too I think. We already have global driver and allocator in docker and this is not very exciting. |
|
Cool! Will review. |
|
@LK4D4 Were your concerns addressed? |
|
@icecrime Nope :) But I don't think that my concerns mean something in your kingdom. |
|
@LK4D4 In the latest push I moved the allocatedIPs map and lock as members of allocator struct. That was a mistake they were global, missed that. |
|
@LK4D4 Of course your concerns matter :) |
There was a problem hiding this comment.
I'd rather have the bridge hold the IPAM instance rather than a global variable. Any particular reason to do it this way?
There was a problem hiding this comment.
For the same reason why network driver registers with libnetwork: IPAM is on his way to become a separate pluggable service, same for network bridge, they will be on the same level.
There will be a network daemon (which will integrate libnetwork) in charge of orchestrating the network related configurations/functioning for the registered services.
The communication between the driver and ipam plugins will probably not be achieved via the daemon/libnetwork, but directly. Still, the network driver needs to get from the network daemon
the information on how to reach the ipam plugin and the IPAM interface API so that it knows how to talk to IPAM service.
Also, when somebody pushes the ipam database configuration, the net daemon has to have an handle of IPAM service, the same way it holds an handle to the network driver.
As such, when the daemon code will come in, I am expecting that both libnetwork global variables (drivers in libnetwork/driver.go and ipam in libnetwork/ipam_proxy.go) will move out of libnetwork into the daemon code.
There was a problem hiding this comment.
Can we change it when we get there? Today there is no reason to make it a global variable.
There was a problem hiding this comment.
Good idea. I will stick to the changes needed to address the reported Issue. Without overloading the diffs with unrelated changes.
- Move ipallocator package into libnetwork - Also ported network utility functions and their tests in libnetwork: docker/daemon/networkdriver/utilg.go => libnetwork/utils.go docker/daemon/networkdriver/network_test.go => libnetwork/utils_test.go - Changed drivers/setup_device.go and setup_ipv4.go to reuse functions in utils.go, instead of redefining internally. - Modified utils to use vishvananda/netlink instead of libcontainer/netlink Signed-off-by: Alessandro Boch <aboch@socketplane.io>
|
LGTM, nice work @aboch |
|
LGTM. |
Issue #18: IP Allocator rework
docker/daemon/networkdriver/utilg.go => libnetwork/utils.go
docker/daemon/networkdriver/network_test.go => libnetwork/utils_test.go
libnetwork/network.go
Added IPAM contract in libnetwork, libnetwork/ipam_contract.go.
It defines the API the IPAM plugin needs to implement. And expose
them to libnetwork clients, proxying the API calls to the respective
implementation in the IPAM plugin.
registering with libnetwork, as a first step to create a separate
plugin without breaking existing libnetwork functionality
Closes #18.
Signed-off-by: Alessandro Boch aboch@socketplane.io