Vendoring libnetwork v0.7.0-rc.4
Signed-off-by: Alessandro Boch <aboch@docker.com>
(cherry picked from commit 8a957bafa5
)
This commit is contained in:
parent
60be8487c1
commit
40ff845220
5 changed files with 37 additions and 20 deletions
|
@ -29,7 +29,7 @@ clone git github.com/RackSec/srslog 259aed10dfa74ea2961eddd1d9847619f6e98837
|
||||||
clone git github.com/imdario/mergo 0.2.1
|
clone git github.com/imdario/mergo 0.2.1
|
||||||
|
|
||||||
#get libnetwork packages
|
#get libnetwork packages
|
||||||
clone git github.com/docker/libnetwork v0.7.0-rc.3
|
clone git github.com/docker/libnetwork v0.7.0-rc.4
|
||||||
clone git github.com/armon/go-metrics eb0af217e5e9747e41dd5303755356b62d28e3ec
|
clone git github.com/armon/go-metrics eb0af217e5e9747e41dd5303755356b62d28e3ec
|
||||||
clone git github.com/hashicorp/go-msgpack 71c2886f5a673a35f909803f38ece5810165097b
|
clone git github.com/hashicorp/go-msgpack 71c2886f5a673a35f909803f38ece5810165097b
|
||||||
clone git github.com/hashicorp/memberlist 9a1e242e454d2443df330bdd51a436d5a9058fc4
|
clone git github.com/hashicorp/memberlist 9a1e242e454d2443df330bdd51a436d5a9058fc4
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 0.7.0-rc.4 (2016-04-06)
|
||||||
|
- Fix the handling for default gateway Endpoint join/leave.
|
||||||
|
|
||||||
## 0.7.0-rc.3 (2016-04-05)
|
## 0.7.0-rc.3 (2016-04-05)
|
||||||
- Revert fix for default gateway endoint join/leave. Needs to be reworked.
|
- Revert fix for default gateway endoint join/leave. Needs to be reworked.
|
||||||
- Persist the network internal mode for bridge networks
|
- Persist the network internal mode for bridge networks
|
||||||
|
|
|
@ -65,20 +65,13 @@ func (sb *sandbox) setupDefaultGW() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// If present, removes the endpoint connecting the sandbox to the default gw network.
|
// If present, detach and remove the endpoint connecting the sandbox to the default gw network.
|
||||||
// Unless it is the endpoint designated to provide the external connectivity.
|
|
||||||
// If the sandbox is being deleted, removes the endpoint unconditionally.
|
|
||||||
func (sb *sandbox) clearDefaultGW() error {
|
func (sb *sandbox) clearDefaultGW() error {
|
||||||
var ep *endpoint
|
var ep *endpoint
|
||||||
|
|
||||||
if ep = sb.getEndpointInGWNetwork(); ep == nil {
|
if ep = sb.getEndpointInGWNetwork(); ep == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if ep == sb.getGatewayEndpoint() && !sb.inDelete {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := ep.sbLeave(sb, false); err != nil {
|
if err := ep.sbLeave(sb, false); err != nil {
|
||||||
return fmt.Errorf("container %s: endpoint leaving GW Network failed: %v", sb.containerID, err)
|
return fmt.Errorf("container %s: endpoint leaving GW Network failed: %v", sb.containerID, err)
|
||||||
}
|
}
|
||||||
|
@ -88,21 +81,26 @@ func (sb *sandbox) clearDefaultGW() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Evaluate whether the sandbox requires a default gateway based
|
||||||
|
// on the endpoints to which it is connected. It does not account
|
||||||
|
// for the default gateway network endpoint.
|
||||||
|
|
||||||
func (sb *sandbox) needDefaultGW() bool {
|
func (sb *sandbox) needDefaultGW() bool {
|
||||||
var needGW bool
|
var needGW bool
|
||||||
|
|
||||||
for _, ep := range sb.getConnectedEndpoints() {
|
for _, ep := range sb.getConnectedEndpoints() {
|
||||||
if ep.endpointInGWNetwork() {
|
if ep.endpointInGWNetwork() {
|
||||||
return false
|
continue
|
||||||
}
|
}
|
||||||
if ep.getNetwork().Type() == "null" || ep.getNetwork().Type() == "host" {
|
if ep.getNetwork().Type() == "null" || ep.getNetwork().Type() == "host" {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if ep.getNetwork().Internal() {
|
if ep.getNetwork().Internal() {
|
||||||
return false
|
continue
|
||||||
}
|
}
|
||||||
if ep.joinInfo.disableGatewayService {
|
// During stale sandbox cleanup, joinInfo may be nil
|
||||||
return false
|
if ep.joinInfo != nil && ep.joinInfo.disableGatewayService {
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
// TODO v6 needs to be handled.
|
// TODO v6 needs to be handled.
|
||||||
if len(ep.Gateway()) > 0 {
|
if len(ep.Gateway()) > 0 {
|
||||||
|
@ -115,6 +113,7 @@ func (sb *sandbox) needDefaultGW() bool {
|
||||||
}
|
}
|
||||||
needGW = true
|
needGW = true
|
||||||
}
|
}
|
||||||
|
|
||||||
return needGW
|
return needGW
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -446,7 +446,7 @@ func (ep *endpoint) sbJoin(sb *sandbox, options ...EndpointOption) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if sb.needDefaultGW() {
|
if sb.needDefaultGW() && sb.getEndpointInGWNetwork() == nil {
|
||||||
return sb.setupDefaultGW()
|
return sb.setupDefaultGW()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -479,7 +479,14 @@ func (ep *endpoint) sbJoin(sb *sandbox, options ...EndpointOption) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return sb.clearDefaultGW()
|
if !sb.needDefaultGW() {
|
||||||
|
if err := sb.clearDefaultGW(); err != nil {
|
||||||
|
log.Warnf("Failure while disconnecting sandbox %s (%s) from gateway network: %v",
|
||||||
|
sb.ID(), sb.ContainerID(), err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ep *endpoint) rename(name string) error {
|
func (ep *endpoint) rename(name string) error {
|
||||||
|
@ -622,10 +629,7 @@ func (ep *endpoint) sbLeave(sb *sandbox, force bool, options ...EndpointOption)
|
||||||
}
|
}
|
||||||
|
|
||||||
sb.deleteHostsEntries(n.getSvcRecords(ep))
|
sb.deleteHostsEntries(n.getSvcRecords(ep))
|
||||||
if !sb.inDelete && sb.needDefaultGW() {
|
if !sb.inDelete && sb.needDefaultGW() && sb.getEndpointInGWNetwork() == nil {
|
||||||
if sb.getEPwithoutGateway() == nil {
|
|
||||||
return fmt.Errorf("endpoint without GW expected, but not found")
|
|
||||||
}
|
|
||||||
return sb.setupDefaultGW()
|
return sb.setupDefaultGW()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -639,7 +643,14 @@ func (ep *endpoint) sbLeave(sb *sandbox, force bool, options ...EndpointOption)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return sb.clearDefaultGW()
|
if !sb.needDefaultGW() {
|
||||||
|
if err := sb.clearDefaultGW(); err != nil {
|
||||||
|
log.Warnf("Failure while disconnecting sandbox %s (%s) from gateway network: %v",
|
||||||
|
sb.ID(), sb.ContainerID(), err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *network) validateForceDelete(locator string) error {
|
func (n *network) validateForceDelete(locator string) error {
|
||||||
|
|
|
@ -197,6 +197,10 @@ func (sb *sandbox) delete(force bool) error {
|
||||||
// Detach from all endpoints
|
// Detach from all endpoints
|
||||||
retain := false
|
retain := false
|
||||||
for _, ep := range sb.getConnectedEndpoints() {
|
for _, ep := range sb.getConnectedEndpoints() {
|
||||||
|
// gw network endpoint detach and removal are automatic
|
||||||
|
if ep.endpointInGWNetwork() {
|
||||||
|
continue
|
||||||
|
}
|
||||||
// Retain the sanbdox if we can't obtain the network from store.
|
// Retain the sanbdox if we can't obtain the network from store.
|
||||||
if _, err := c.getNetworkFromStore(ep.getNetwork().ID()); err != nil {
|
if _, err := c.getNetworkFromStore(ep.getNetwork().ID()); err != nil {
|
||||||
retain = true
|
retain = true
|
||||||
|
|
Loading…
Reference in a new issue