2016-07-05 20:49:31 +00:00
|
|
|
package libnetwork
|
|
|
|
|
|
|
|
import (
|
2021-04-06 00:24:47 +00:00
|
|
|
"github.com/docker/docker/libnetwork/ipamapi"
|
|
|
|
builtinIpam "github.com/docker/docker/libnetwork/ipams/builtin"
|
|
|
|
nullIpam "github.com/docker/docker/libnetwork/ipams/null"
|
|
|
|
remoteIpam "github.com/docker/docker/libnetwork/ipams/remote"
|
|
|
|
"github.com/docker/docker/libnetwork/ipamutils"
|
2023-01-24 19:26:03 +00:00
|
|
|
"github.com/docker/docker/pkg/plugingetter"
|
2016-07-05 20:49:31 +00:00
|
|
|
)
|
|
|
|
|
2023-01-24 19:26:03 +00:00
|
|
|
func initIPAMDrivers(r ipamapi.Registerer, pg plugingetter.PluginGetter, addressPool []*ipamutils.NetworkToSplit) error {
|
2023-01-17 00:41:08 +00:00
|
|
|
// TODO: pass address pools as arguments to builtinIpam.Init instead of
|
|
|
|
// indirectly through global mutable state. Swarmkit references that
|
|
|
|
// function so changing its signature breaks the build.
|
|
|
|
if err := builtinIpam.SetDefaultIPAddressPool(addressPool); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2023-01-24 19:26:03 +00:00
|
|
|
|
|
|
|
for _, fn := range [](func(ipamapi.Registerer) error){
|
|
|
|
builtinIpam.Register,
|
|
|
|
nullIpam.Register,
|
2016-07-05 20:49:31 +00:00
|
|
|
} {
|
2023-01-24 19:26:03 +00:00
|
|
|
if err := fn(r); err != nil {
|
2016-07-05 20:49:31 +00:00
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-01-24 19:26:03 +00:00
|
|
|
return remoteIpam.Register(r, pg)
|
2016-07-05 20:49:31 +00:00
|
|
|
}
|