Skip to content
Success

Changes

Summary

  1. libnet/ipam: un-embed mutex from `addrSpace` (details)
  2. libnet/ipam: put `addrSpace` into a separate file (details)
  3. libnet/ipam: remove dead DumpDatabase() (details)
  4. libnet/ipam: split v4/v6 address spaces (details)
  5. libnet/netutils: remove dead util NetworkRange (details)
  6. libnet/ipamapi: add in/out structs for RequestPool (details)
  7. integration-cli: createNetwork: add t.Helper() (details)
  8. libnet/ipam: default-address-pools as Register arg (details)
  9. libnet: move ipam pkg to ipam/defaultipam (details)
  10. libnet/ipams/builtin: move to libnet/ipams (details)
  11. libnet/ipams/defaultipam: add a Register fn (details)
  12. libnet/ipams/windowsipam: that driver knows its name (details)
  13. libnet/ipams: Unconditionally call windowsipam.Register (details)
  14. libnet/ipams: register all drivers (details)
  15. libnet/ipamutils: no more global state (details)
  16. libnet/ipams/defaultipam: move driver name to its pkg (details)
  17. libnet/ipams/null: move driver name to its pkg (details)
Commit a047d4b1df4664d9b4cb7ff9b320756d009f690b by Albin Kerouanton
libnet/ipam: un-embed mutex from `addrSpace`

Embedding `sync.Mutex` into a struct is considered a bad practice
as it makes the mutex methods part of the embedding struct's API.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
The file was modified libnetwork/ipam/structures.go (diff)
The file was modified libnetwork/ipam/allocator.go (diff)
Commit df88857e6cd265e0b5ccd29c9e4db5f3db5c16fd by Albin Kerouanton
libnet/ipam: put `addrSpace` into a separate file

`addrSpace` methods are currently scattered in two different files.
As upcoming work will rewrite some of these methods, better put them
into a separate file.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
The file was modified libnetwork/ipam/structures.go (diff)
The file was modified libnetwork/ipam/allocator.go (diff)
The file was addedlibnetwork/ipam/address_space.go
Commit 199c72cb5d9bf87b230700e77080b3a88dc007d9 by Albin Kerouanton
libnet/ipam: remove dead DumpDatabase()

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
The file was modified libnetwork/ipam/address_space.go (diff)
The file was modified libnetwork/ipam/allocator.go (diff)
Commit 37a81cd04dcdf60f40cce2fa09498cc23172625c by Albin Kerouanton
libnet/ipam: split v4/v6 address spaces

Address spaces are a continuum of addresses that can be used for a
specific purpose (ie. 'local' for unmanaged containers, 'global for
Swarm). v4 and v6 addresses aren't of the same size -- hence
combining them into a single address space doesn't form a continuum.
Better set them apart into two different address spaces.

Also, the upcoming rewrite of `addrSpace` will benefit from that
split.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
The file was modified libnetwork/ipam/allocator.go (diff)
The file was modified libnetwork/ipam/allocator_test.go (diff)
The file was modified libnetwork/ipam/address_space.go (diff)
The file was modified libnetwork/ipam/structures.go (diff)
Commit 82aae0fe50e55d4f217c0c3b5934a0a9210a6775 by Albin Kerouanton
libnet/netutils: remove dead util NetworkRange

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
The file was modified libnetwork/netutils/utils.go (diff)
The file was modified libnetwork/netutils/utils_linux_test.go (diff)
Commit 115de5ff3d16dbec510923e166950556071693ee by Albin Kerouanton
libnet/ipamapi: add in/out structs for RequestPool

The `RequestPool` method has many args and named returns. This
makes the code hard to follow at times. This commit adds one struct,
`PoolRequest`, to replace these args, and one struct, `AllocatedPool`,
to replace these named returns.

Both structs' fields are properly documented to better define their
semantics, and their relationship with address allocation.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
The file was modified libnetwork/ipams/windowsipam/windowsipam_test.go (diff)
The file was modified libnetwork/cnmallocator/networkallocator_test.go (diff)
The file was modified libnetwork/ipam/allocator.go (diff)
The file was modified libnetwork/ipamapi/contract.go (diff)
The file was modified libnetwork/cnmallocator/networkallocator.go (diff)
The file was modified libnetwork/ipams/null/null_test.go (diff)
The file was modified libnetwork/ipams/remote/remote_test.go (diff)
The file was modified libnetwork/ipams/windowsipam/windowsipam.go (diff)
The file was modified libnetwork/network.go (diff)
The file was modified libnetwork/ipams/remote/remote.go (diff)
The file was modified libnetwork/ipams/null/null.go (diff)
The file was modified libnetwork/ipam/allocator_test.go (diff)
The file was modified libnetwork/ipam/parallel_test.go (diff)
Commit 1d5a12dfb1ecb28cbe8070de056595e37826319b by Albin Kerouanton
integration-cli: createNetwork: add t.Helper()

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
The file was modified integration-cli/docker_api_network_test.go (diff)
Commit e8644c3e0e8aed98f11ef27f15b124c0ee5c6dea by Albin Kerouanton
libnet/ipam: default-address-pools as Register arg

Prior to this change, daemon's `default-address-pools` param would
be passed to `SetDefaultIPAddressPool()` to set a global var named
`defaultAddressPool`. This var would then be retrieved during the
`default` IPAM driver registration. Both steps were executed in
close succession during libnet's controller initialization.

This change removes the global var and just pass the user-defined
`default-address-pools` to the `default` driver's `Register` fn.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
The file was modified libnetwork/ipams/builtin/builtin_windows.go (diff)
The file was modified libnetwork/ipams/builtin/builtin.go (diff)
The file was modified libnetwork/cnmallocator/drivers_ipam.go (diff)
The file was modified libnetwork/drvregistry/ipams_test.go (diff)
The file was modified libnetwork/ipams/builtin/builtin_unix.go (diff)
The file was modified libnetwork/drivers_ipam.go (diff)
Commit 29f2ca04e0695feb7d232bf3eb03c6dedac378f6 by Albin Kerouanton
libnet: move ipam pkg to ipam/defaultipam

All drivers except the default ipam driver are stored in ipams/.
Since `default` isn't a valid Go pkg name, this package is
renamed to `defaultipam`, following `windowsipam` example.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
The file was removedlibnetwork/ipam/allocator_test.go
The file was addedlibnetwork/ipams/defaultipam/structures.go
The file was removedlibnetwork/ipam/parallel_test.go
The file was addedlibnetwork/ipams/defaultipam/allocator.go
The file was modified libnetwork/ipams/builtin/builtin.go (diff)
The file was removedlibnetwork/ipam/address_space.go
The file was removedlibnetwork/ipam/allocator.go
The file was addedlibnetwork/ipams/defaultipam/allocator_test.go
The file was addedlibnetwork/ipams/defaultipam/address_space.go
The file was addedlibnetwork/ipams/defaultipam/parallel_test.go
The file was removedlibnetwork/ipam/structures.go
Commit 218394cada882b7e73cb19dabb4df68cfbea3c9c by Albin Kerouanton
libnet/ipams/builtin: move to libnet/ipams

Packages in libnet/ipams are drivers, except builtin -- it's used
to register drivers. Move files one level up and delete this pkg.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
The file was removedlibnetwork/ipams/builtin/builtin_unix.go
The file was removedlibnetwork/ipams/builtin/builtin_windows.go
The file was addedlibnetwork/ipams/drivers.go
The file was modified libnetwork/drivers_ipam.go (diff)
The file was addedlibnetwork/ipams/drivers_unix.go
The file was modified libnetwork/drvregistry/ipams_test.go (diff)
The file was modified libnetwork/cnmallocator/drivers_ipam.go (diff)
The file was addedlibnetwork/ipams/drivers_windows.go
The file was removedlibnetwork/ipams/builtin/builtin.go
Commit 8cec9f0dcaa3e56972a61aa4634621c65cd1f7d1 by Albin Kerouanton
libnet/ipams/defaultipam: add a Register fn

All drivers except the default have a Register function. Before this
change, default's registration was handled by another package. Move
this logic into the driver pkg.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
The file was removedlibnetwork/ipams/drivers.go
The file was modified libnetwork/ipams/drivers_unix.go (diff)
The file was modified libnetwork/ipams/defaultipam/allocator.go (diff)
The file was modified libnetwork/ipams/drivers_windows.go (diff)
Commit ae9e4319b07c35a18db58255962307ddec4502ec by Albin Kerouanton
libnet/ipams/windowsipam: that driver knows its name

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
The file was modified libnetwork/ipams/windowsipam/windowsipam.go (diff)
The file was modified libnetwork/ipams/drivers_windows.go (diff)
Commit eda47500fc8a2a8de6b2f93dad4f4cea0726e8aa by Albin Kerouanton
libnet/ipams: Unconditionally call windowsipam.Register

This function is made a no-op on non-windows platform.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
The file was removedlibnetwork/ipams/drivers_unix.go
The file was modified libnetwork/ipams/windowsipam/windowsipam.go (diff)
The file was addedlibnetwork/ipams/windowsipam/windowsipam_other.go
The file was removedlibnetwork/ipams/drivers_windows.go
The file was addedlibnetwork/ipams/drivers.go
The file was modified libnetwork/ipams/windowsipam/windowsipam_test.go (diff)
Commit 3c9718144f22557e7448c70d22129e4602d0984d by Albin Kerouanton
libnet/ipams: register all drivers

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
The file was modified libnetwork/controller.go (diff)
The file was modified libnetwork/ipams/drivers.go (diff)
The file was removedlibnetwork/drivers_ipam.go
The file was modified libnetwork/cnmallocator/drivers_ipam.go (diff)
The file was modified libnetwork/drvregistry/ipams_test.go (diff)
Commit 0db56de78e2f7d156fe18ea85f0daa9e9e686f83 by Albin Kerouanton
libnet/ipamutils: no more global state

Prior to this change, cnmallocator would call
`ConfigGlobalScopeDefaultNetworks` right before initializing its
IPAM drivers. This function was mutating some global state used
during drivers init.

This change just remove the global state, and adds an arg to
ipams.Register and defaultipam.Register to pass the global pools
by arguments instead.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
The file was modified libnetwork/drvregistry/ipams_test.go (diff)
The file was modified libnetwork/ipams/defaultipam/allocator.go (diff)
The file was modified libnetwork/ipams/drivers.go (diff)
The file was modified libnetwork/cnmallocator/drivers_ipam.go (diff)
The file was modified libnetwork/ipamutils/utils_test.go (diff)
The file was modified libnetwork/controller.go (diff)
The file was modified libnetwork/ipamutils/utils.go (diff)
Commit f2387f3632437af8fcdc0fc41f4b92e34eaae138 by Albin Kerouanton
libnet/ipams/defaultipam: move driver name to its pkg

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
The file was modified libnetwork/libnetwork_linux_test.go (diff)
The file was modified libnetwork/network_windows.go (diff)
The file was modified libnetwork/cnmallocator/networkallocator.go (diff)
The file was modified libnetwork/ipams/defaultipam/allocator.go (diff)
The file was modified libnetwork/libnetwork_internal_test.go (diff)
The file was modified libnetwork/ipamapi/contract.go (diff)
The file was modified libnetwork/endpoint_unix_test.go (diff)
The file was modified libnetwork/cnmallocator/provider.go (diff)
The file was modified libnetwork/network.go (diff)
The file was modified libnetwork/network_unix.go (diff)
The file was modified libnetwork/sandbox_unix_test.go (diff)
Commit c5376e534c5f2c7e16f6480609232fff1f8f85b7 by Albin Kerouanton
libnet/ipams/null: move driver name to its pkg

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
The file was modified libnetwork/ipamapi/contract.go (diff)
The file was modified libnetwork/ipams/null/null.go (diff)
The file was modified libnetwork/libnetwork_linux_test.go (diff)