d1b012d97a
1. Base work was done by msabansal and nwoodmsft from : https://github.com/msabansal/docker/tree/overlay 2. reorganized under drivers/windows/overlay and rebased to libnetwork master 3. Porting overlay common fixes to windows driver *46f525c
*ba8714e
*6368406
4. Windows Service Discovery changes for swarm-mode 5. renaming default windows ipam drivers as "windows" Signed-off-by: Madhu Venugopal <madhu@docker.com> Signed-off-by: msabansal <sabansal@microsoft.com> Signed-off-by: nwoodmsft <Nicholas.Wood@microsoft.com>
57 lines
1.3 KiB
Go
57 lines
1.3 KiB
Go
// +build windows
|
|
|
|
package builtin
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/docker/libnetwork/datastore"
|
|
"github.com/docker/libnetwork/ipam"
|
|
"github.com/docker/libnetwork/ipamapi"
|
|
"github.com/docker/libnetwork/ipamutils"
|
|
|
|
windowsipam "github.com/docker/libnetwork/ipams/windowsipam"
|
|
)
|
|
|
|
// InitDockerDefault registers the built-in ipam service with libnetwork
|
|
func InitDockerDefault(ic ipamapi.Callback, l, g interface{}) error {
|
|
var (
|
|
ok bool
|
|
localDs, globalDs datastore.DataStore
|
|
)
|
|
|
|
if l != nil {
|
|
if localDs, ok = l.(datastore.DataStore); !ok {
|
|
return fmt.Errorf("incorrect local datastore passed to built-in ipam init")
|
|
}
|
|
}
|
|
|
|
if g != nil {
|
|
if globalDs, ok = g.(datastore.DataStore); !ok {
|
|
return fmt.Errorf("incorrect global datastore passed to built-in ipam init")
|
|
}
|
|
}
|
|
|
|
ipamutils.InitNetworks()
|
|
|
|
a, err := ipam.NewAllocator(localDs, globalDs)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
cps := &ipamapi.Capability{RequiresRequestReplay: true}
|
|
|
|
return ic.RegisterIpamDriverWithCapabilities(ipamapi.DefaultIPAM, a, cps)
|
|
}
|
|
|
|
// Init registers the built-in ipam service with libnetwork
|
|
func Init(ic ipamapi.Callback, l, g interface{}) error {
|
|
initFunc := windowsipam.GetInit(windowsipam.DefaultIPAM)
|
|
|
|
err := InitDockerDefault(ic, l, g)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
return initFunc(ic, l, g)
|
|
}
|