mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Swarm-mode overlay networking support for windows
Signed-off-by: msabansal <sabansal@microsoft.com>
This commit is contained in:
parent
55543c45a2
commit
ed8ccc3046
2 changed files with 24 additions and 3 deletions
|
@ -20,6 +20,7 @@ import (
|
||||||
"github.com/docker/docker/runconfig"
|
"github.com/docker/docker/runconfig"
|
||||||
"github.com/docker/libnetwork"
|
"github.com/docker/libnetwork"
|
||||||
nwconfig "github.com/docker/libnetwork/config"
|
nwconfig "github.com/docker/libnetwork/config"
|
||||||
|
"github.com/docker/libnetwork/datastore"
|
||||||
winlibnetwork "github.com/docker/libnetwork/drivers/windows"
|
winlibnetwork "github.com/docker/libnetwork/drivers/windows"
|
||||||
"github.com/docker/libnetwork/netlabel"
|
"github.com/docker/libnetwork/netlabel"
|
||||||
"github.com/docker/libnetwork/options"
|
"github.com/docker/libnetwork/options"
|
||||||
|
@ -261,9 +262,12 @@ func (daemon *Daemon) initNetworkController(config *Config, activeSandboxes map[
|
||||||
}
|
}
|
||||||
|
|
||||||
if !found {
|
if !found {
|
||||||
err = v.Delete()
|
// global networks should not be deleted by local HNS
|
||||||
if err != nil {
|
if v.Info().Scope() != datastore.GlobalScope {
|
||||||
return nil, err
|
err = v.Delete()
|
||||||
|
if err != nil {
|
||||||
|
logrus.Errorf("Error occurred when removing network %v", err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -300,6 +304,10 @@ func (daemon *Daemon) initNetworkController(config *Config, activeSandboxes map[
|
||||||
|
|
||||||
controller.WalkNetworks(s)
|
controller.WalkNetworks(s)
|
||||||
if n != nil {
|
if n != nil {
|
||||||
|
// global networks should not be deleted by local HNS
|
||||||
|
if n.Info().Scope() == datastore.GlobalScope {
|
||||||
|
continue
|
||||||
|
}
|
||||||
v.Name = n.Name()
|
v.Name = n.Name()
|
||||||
// This will not cause network delete from HNS as the network
|
// This will not cause network delete from HNS as the network
|
||||||
// is not yet populated in the libnetwork windows driver
|
// is not yet populated in the libnetwork windows driver
|
||||||
|
|
|
@ -62,6 +62,7 @@ func (daemon *Daemon) getLibcontainerdCreateOptions(container *container.Contain
|
||||||
// Get endpoints for the libnetwork allocated networks to the container
|
// Get endpoints for the libnetwork allocated networks to the container
|
||||||
var epList []string
|
var epList []string
|
||||||
AllowUnqualifiedDNSQuery := false
|
AllowUnqualifiedDNSQuery := false
|
||||||
|
gwHNSID := ""
|
||||||
if container.NetworkSettings != nil {
|
if container.NetworkSettings != nil {
|
||||||
for n := range container.NetworkSettings.Networks {
|
for n := range container.NetworkSettings.Networks {
|
||||||
sn, err := daemon.FindNetwork(n)
|
sn, err := daemon.FindNetwork(n)
|
||||||
|
@ -78,6 +79,14 @@ func (daemon *Daemon) getLibcontainerdCreateOptions(container *container.Contain
|
||||||
if err != nil {
|
if err != nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if data["GW_INFO"] != nil {
|
||||||
|
gwInfo := data["GW_INFO"].(map[string]interface{})
|
||||||
|
if gwInfo["hnsid"] != nil {
|
||||||
|
gwHNSID = gwInfo["hnsid"].(string)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if data["hnsid"] != nil {
|
if data["hnsid"] != nil {
|
||||||
epList = append(epList, data["hnsid"].(string))
|
epList = append(epList, data["hnsid"].(string))
|
||||||
}
|
}
|
||||||
|
@ -88,6 +97,10 @@ func (daemon *Daemon) getLibcontainerdCreateOptions(container *container.Contain
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if gwHNSID != "" {
|
||||||
|
epList = append(epList, gwHNSID)
|
||||||
|
}
|
||||||
|
|
||||||
// Read and add credentials from the security options if a credential spec has been provided.
|
// Read and add credentials from the security options if a credential spec has been provided.
|
||||||
if container.HostConfig.SecurityOpt != nil {
|
if container.HostConfig.SecurityOpt != nil {
|
||||||
for _, sOpt := range container.HostConfig.SecurityOpt {
|
for _, sOpt := range container.HostConfig.SecurityOpt {
|
||||||
|
|
Loading…
Add table
Reference in a new issue