1
0
mirror of https://github.com/docker/cli.git synced 2026-01-15 07:40:57 +03:00

Swarm-mode overlay networking support for windows

Signed-off-by: msabansal <sabansal@microsoft.com>
Upstream-commit: ed8ccc304621289298fdb7aac4239cfe767b7bae
Component: engine
This commit is contained in:
msabansal
2016-11-09 17:54:15 -08:00
parent 0f8fed3268
commit 7cfb8aa321
2 changed files with 24 additions and 3 deletions

View File

@@ -20,6 +20,7 @@ import (
"github.com/docker/docker/runconfig"
"github.com/docker/libnetwork"
nwconfig "github.com/docker/libnetwork/config"
"github.com/docker/libnetwork/datastore"
winlibnetwork "github.com/docker/libnetwork/drivers/windows"
"github.com/docker/libnetwork/netlabel"
"github.com/docker/libnetwork/options"
@@ -261,9 +262,12 @@ func (daemon *Daemon) initNetworkController(config *Config, activeSandboxes map[
}
if !found {
err = v.Delete()
if err != nil {
return nil, err
// global networks should not be deleted by local HNS
if v.Info().Scope() != datastore.GlobalScope {
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)
if n != nil {
// global networks should not be deleted by local HNS
if n.Info().Scope() == datastore.GlobalScope {
continue
}
v.Name = n.Name()
// This will not cause network delete from HNS as the network
// is not yet populated in the libnetwork windows driver

View File

@@ -62,6 +62,7 @@ func (daemon *Daemon) getLibcontainerdCreateOptions(container *container.Contain
// Get endpoints for the libnetwork allocated networks to the container
var epList []string
AllowUnqualifiedDNSQuery := false
gwHNSID := ""
if container.NetworkSettings != nil {
for n := range container.NetworkSettings.Networks {
sn, err := daemon.FindNetwork(n)
@@ -78,6 +79,14 @@ func (daemon *Daemon) getLibcontainerdCreateOptions(container *container.Contain
if err != nil {
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 {
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.
if container.HostConfig.SecurityOpt != nil {
for _, sOpt := range container.HostConfig.SecurityOpt {