11 Commits

Author SHA1 Message Date
Paweł Gronowski
cdce8f4f92 modernize: Use maps.Copy instead of for loops
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-12-15 18:56:33 +01:00
David Negstad
ea0d934ff2 Allow requesting networks with a custom prefix size from the default pools
Signed-off-by: David Negstad <David.Negstad@microsoft.com>
2025-10-22 12:45:55 -07:00
Cory Snider
c2c2b80e90 daemon: report IPAM status for Swarm networks
As the Engine API requests may be directed at a non-leader Swarm
manager, the information needs to be tunneled through the Swarm API.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-09-11 15:25:14 -04:00
Albin Kerouanton
4d2a293ff3 libnet/drvapi: make NetworkAllocate optional
This method is only used by the cnmallocator to allocate Swarm-scoped
network resources. Its only concrete implementation is in the ovmanager.
Other network drivers are implementing it too to adhere to the
driverapi.Driver interface, but they all return a 'not implemented'
error.

Extract this method into a separate interface, and add a dedicated
RegisterNetworkAllocator to the driver registry. Update the cnmallocator
to load 'network allocators' instead of 'drivers'.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-09-02 21:55:03 +02:00
Albin Kerouanton
cbd04b6f08 libnet/cnmallocator: use a list of local netdrivers
The cnmallocator package has a map of supported network drivers which
are registered using a pkg-local driver registry. This registry is then
used to load drivers, and if they have a 'local' DataScope, they aren't
used for anything. Drivers with a 'global' DataScope are called to
allocate cluster-wide network resources.

Instantiating builtin network drivers may have unintended side-effects
(e.g. the bridge driver registers a callback that should run when
firewalld is reloaded), so libnetwork has dummy '*manager' drivers that
do nothing but carry the same Capability than the original driver they
masquerade.

Put 'local drivers' (e.g. those with DataScope 'local') into a separate
list that just contains drivers' name, and don't register them into the
cnmallocator's driver registry.

Remove all the dummy '*manager' drivers as they're not needed anymore.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-09-02 21:53:50 +02:00
Albin Kerouanton
ea73c88d12 libnet/cnmallocator: rm drivers_darwin.go
Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-09-01 15:41:21 +02:00
Albin Kerouanton
18b21a32a1 libnet/cnmallocator: rm drivers_unsupported.go
Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-09-01 15:39:17 +02:00
Matthieu MOREL
96f8c6395e chore: enable use-any rule from revive
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-08-08 17:07:07 +02:00
Derek McGowan
f74e5d48b3 Create github.com/moby/moby/v2 module
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-31 10:13:29 -07:00
Cory Snider
844023f794 libnetwork/driverapi: make EventNotify optional
Overlay is the only driver which makes use of the EventNotify facility,
yet all other driver implementations are forced to provide a stub
implementation. Move the EventNotify and DecodeTableEntry methods into a
new optional TableWatcher interface and remove the stubs from all the
other drivers.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-07-22 11:51:14 -04:00
Derek McGowan
7a720df61f Move libnetwork to daemon/libnetwork
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-14 09:25:23 -07:00