drivers_ipam.go 970 B

123456789101112131415161718192021222324252627282930
  1. package libnetwork
  2. import (
  3. "github.com/docker/docker/libnetwork/ipamapi"
  4. builtinIpam "github.com/docker/docker/libnetwork/ipams/builtin"
  5. nullIpam "github.com/docker/docker/libnetwork/ipams/null"
  6. remoteIpam "github.com/docker/docker/libnetwork/ipams/remote"
  7. "github.com/docker/docker/libnetwork/ipamutils"
  8. "github.com/docker/docker/pkg/plugingetter"
  9. )
  10. func initIPAMDrivers(r ipamapi.Registerer, pg plugingetter.PluginGetter, addressPool []*ipamutils.NetworkToSplit) error {
  11. // TODO: pass address pools as arguments to builtinIpam.Init instead of
  12. // indirectly through global mutable state. Swarmkit references that
  13. // function so changing its signature breaks the build.
  14. if err := builtinIpam.SetDefaultIPAddressPool(addressPool); err != nil {
  15. return err
  16. }
  17. for _, fn := range [](func(ipamapi.Registerer) error){
  18. builtinIpam.Register,
  19. nullIpam.Register,
  20. } {
  21. if err := fn(r); err != nil {
  22. return err
  23. }
  24. }
  25. return remoteIpam.Register(r, pg)
  26. }