mirror of
https://github.com/rancher/os.git
synced 2025-09-03 07:44:21 +00:00
Update vendor.conf and vendor package to support dind
This commit is contained in:
@@ -14,7 +14,7 @@ github.com/docker/docker b40c87254f587af7cad8e8128f061a2a7f367343 https://github
|
|||||||
github.com/docker/engine-api v0.3.3
|
github.com/docker/engine-api v0.3.3
|
||||||
github.com/docker/go-connections v0.2.0
|
github.com/docker/go-connections v0.2.0
|
||||||
github.com/docker/go-units 651fc226e7441360384da338d0fd37f2440ffbe3
|
github.com/docker/go-units 651fc226e7441360384da338d0fd37f2440ffbe3
|
||||||
github.com/docker/libcompose c598536dc130c03c419d74f4c66c9dd0f728338d https://github.com/rancher/libcompose.git
|
github.com/docker/libcompose 2987bb539b670b71a33575bdee00bd351be60f20 https://github.com/rancher/libcompose.git
|
||||||
github.com/docker/libnetwork v0.5.6
|
github.com/docker/libnetwork v0.5.6
|
||||||
github.com/docker/libtrust 9cbd2a1374f46905c68a4eb3694a130610adc62a
|
github.com/docker/libtrust 9cbd2a1374f46905c68a4eb3694a130610adc62a
|
||||||
github.com/docker/machine 4a8e93ac9bc2ced1c3bc4a43c03fdaa1c2749205
|
github.com/docker/machine 4a8e93ac9bc2ced1c3bc4a43c03fdaa1c2749205
|
||||||
|
36
vendor/github.com/docker/libcompose/docker/container.go
generated
vendored
36
vendor/github.com/docker/libcompose/docker/container.go
generated
vendored
@@ -22,6 +22,7 @@ import (
|
|||||||
"github.com/docker/libcompose/logger"
|
"github.com/docker/libcompose/logger"
|
||||||
"github.com/docker/libcompose/project"
|
"github.com/docker/libcompose/project"
|
||||||
"github.com/docker/libcompose/project/events"
|
"github.com/docker/libcompose/project/events"
|
||||||
|
"github.com/docker/engine-api/types/network"
|
||||||
util "github.com/docker/libcompose/utils"
|
util "github.com/docker/libcompose/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -506,9 +507,42 @@ func (c *Container) createContainer(ctx context.Context, imageName, oldContainer
|
|||||||
configWrapper.HostConfig.Binds = util.Merge(configWrapper.HostConfig.Binds, volumeBinds(configWrapper.Config.Volumes, &info))
|
configWrapper.HostConfig.Binds = util.Merge(configWrapper.HostConfig.Binds, volumeBinds(configWrapper.Config.Volumes, &info))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
networkConfig := configWrapper.NetworkingConfig
|
||||||
|
if configWrapper.HostConfig.NetworkMode != "" && configWrapper.HostConfig.NetworkMode.IsUserDefined() {
|
||||||
|
if networkConfig == nil {
|
||||||
|
// check user docker label, assign the user define ipv4 address
|
||||||
|
if _, ok := configWrapper.Config.Labels["io.rancher.user_docker.fix_ip"]; ok {
|
||||||
|
networkConfig = &network.NetworkingConfig{
|
||||||
|
EndpointsConfig: map[string]*network.EndpointSettings{
|
||||||
|
string(configWrapper.HostConfig.NetworkMode): {
|
||||||
|
IPAddress: configWrapper.Config.Labels["io.rancher.user_docker.fix_ip"],
|
||||||
|
IPAMConfig: &network.EndpointIPAMConfig{
|
||||||
|
IPv4Address: configWrapper.Config.Labels["io.rancher.user_docker.fix_ip"],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
networkConfig = &network.NetworkingConfig{
|
||||||
|
EndpointsConfig: map[string]*network.EndpointSettings{
|
||||||
|
string(configWrapper.HostConfig.NetworkMode): {},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for key, value := range networkConfig.EndpointsConfig {
|
||||||
|
conf := value
|
||||||
|
if value.Aliases == nil {
|
||||||
|
value.Aliases = []string{}
|
||||||
|
}
|
||||||
|
value.Aliases = append(value.Aliases, c.serviceName)
|
||||||
|
networkConfig.EndpointsConfig[key] = conf
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
logrus.Debugf("Creating container %s %#v", c.name, configWrapper)
|
logrus.Debugf("Creating container %s %#v", c.name, configWrapper)
|
||||||
|
|
||||||
container, err := c.client.ContainerCreate(ctx, configWrapper.Config, configWrapper.HostConfig, configWrapper.NetworkingConfig, c.name)
|
container, err := c.client.ContainerCreate(ctx, configWrapper.Config, configWrapper.HostConfig, networkConfig, c.name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Debugf("Failed to create container %s: %v", c.name, err)
|
logrus.Debugf("Failed to create container %s: %v", c.name, err)
|
||||||
return nil, err
|
return nil, err
|
||||||
|
71
vendor/github.com/docker/libcompose/docker/service.go
generated
vendored
71
vendor/github.com/docker/libcompose/docker/service.go
generated
vendored
@@ -5,6 +5,7 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/docker/engine-api/types/network"
|
||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
|
|
||||||
"github.com/Sirupsen/logrus"
|
"github.com/Sirupsen/logrus"
|
||||||
@@ -257,6 +258,10 @@ func (s *Service) Run(ctx context.Context, commandParts []string) (int, error) {
|
|||||||
|
|
||||||
c := NewOneOffContainer(client, containerName, containerNumber, s)
|
c := NewOneOffContainer(client, containerName, containerNumber, s)
|
||||||
|
|
||||||
|
if err := s.connectContainerToNetworks(ctx, c, true); err != nil {
|
||||||
|
return -1, err
|
||||||
|
}
|
||||||
|
|
||||||
return c.Run(ctx, imageName, &config.ServiceConfig{Command: commandParts, Tty: true, StdinOpen: true})
|
return c.Run(ctx, imageName, &config.ServiceConfig{Command: commandParts, Tty: true, StdinOpen: true})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -308,6 +313,10 @@ func (s *Service) up(ctx context.Context, imageName string, create bool, options
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err := s.connectContainerToNetworks(ctx, c, false); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
if options.Log {
|
if options.Log {
|
||||||
go c.Log(ctx, true)
|
go c.Log(ctx, true)
|
||||||
}
|
}
|
||||||
@@ -510,3 +519,65 @@ func (s *Service) specificiesHostPort() bool {
|
|||||||
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *Service) connectContainerToNetworks(ctx context.Context, c *Container, oneOff bool) error {
|
||||||
|
existingContainer, err := c.findExisting(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
connectedNetworks := existingContainer.NetworkSettings.Networks
|
||||||
|
|
||||||
|
if _, ok := s.serviceConfig.Labels["io.rancher.user_docker.net"]; ok {
|
||||||
|
for networkName, connectedNetwork := range connectedNetworks {
|
||||||
|
aliasPresent := false
|
||||||
|
for _, alias := range connectedNetwork.Aliases {
|
||||||
|
ID, _ := c.ID()
|
||||||
|
ID = ID[:12]
|
||||||
|
if alias == ID {
|
||||||
|
aliasPresent = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if aliasPresent {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if err := s.NetworkDisconnect(ctx, c, networkName, oneOff); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if _, fipExist := s.serviceConfig.Labels["io.rancher.user_docker.fix_ip"]; fipExist {
|
||||||
|
if err := s.NetworkConnect(ctx, c, s.serviceConfig.Labels["io.rancher.user_docker.net"], s.serviceConfig.Labels["io.rancher.user_docker.fix_ip"], oneOff); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NetworkConnect connects the container to the specified network
|
||||||
|
// FIXME(vdemeester) will be refactor with Container refactoring
|
||||||
|
func (s *Service) NetworkConnect(ctx context.Context, c *Container, net, ipv4 string, oneOff bool) error {
|
||||||
|
containerID, err := c.ID()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
client := s.context.ClientFactory.Create(s)
|
||||||
|
return client.NetworkConnect(ctx, net, containerID, &network.EndpointSettings{
|
||||||
|
IPAddress: ipv4,
|
||||||
|
IPAMConfig: &network.EndpointIPAMConfig{
|
||||||
|
IPv4Address: ipv4,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// NetworkDisconnect disconnects the container from the specified network
|
||||||
|
func (s *Service) NetworkDisconnect(ctx context.Context, c *Container, net string, oneOff bool) error {
|
||||||
|
containerID, err := c.ID()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
client := s.context.ClientFactory.Create(s)
|
||||||
|
return client.NetworkDisconnect(ctx, net, containerID, true)
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user