mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Vendoring libnetwork @f3c4ca8
Signed-off-by: Alessandro Boch <aboch@docker.com>
This commit is contained in:
parent
3d31198cda
commit
bf5bebdfa0
14 changed files with 123 additions and 85 deletions
59
vendor/github.com/docker/libnetwork/controller.go
generated
vendored
59
vendor/github.com/docker/libnetwork/controller.go
generated
vendored
|
@ -127,6 +127,9 @@ type NetworkController interface {
|
|||
// Wait for agent initialization complete in libnetwork controller
|
||||
AgentInitWait()
|
||||
|
||||
// Wait for agent to stop if running
|
||||
AgentStopWait()
|
||||
|
||||
// SetKeys configures the encryption key for gossip and overlay data path
|
||||
SetKeys(keys []*types.EncryptionKey) error
|
||||
}
|
||||
|
@ -160,6 +163,7 @@ type controller struct {
|
|||
agent *agent
|
||||
networkLocker *locker.Locker
|
||||
agentInitDone chan struct{}
|
||||
agentStopDone chan struct{}
|
||||
keys []*types.EncryptionKey
|
||||
clusterConfigAvailable bool
|
||||
sync.Mutex
|
||||
|
@ -338,7 +342,12 @@ func (c *controller) clusterAgentInit() {
|
|||
c.agentClose()
|
||||
c.cleanupServiceBindings("")
|
||||
|
||||
c.clearIngress(true)
|
||||
c.Lock()
|
||||
if c.agentStopDone != nil {
|
||||
close(c.agentStopDone)
|
||||
c.agentStopDone = nil
|
||||
}
|
||||
c.Unlock()
|
||||
|
||||
return
|
||||
}
|
||||
|
@ -357,6 +366,15 @@ func (c *controller) AgentInitWait() {
|
|||
}
|
||||
}
|
||||
|
||||
func (c *controller) AgentStopWait() {
|
||||
c.Lock()
|
||||
agentStopDone := c.agentStopDone
|
||||
c.Unlock()
|
||||
if agentStopDone != nil {
|
||||
<-agentStopDone
|
||||
}
|
||||
}
|
||||
|
||||
func (c *controller) makeDriverConfig(ntype string) map[string]interface{} {
|
||||
if c.cfg == nil {
|
||||
return nil
|
||||
|
@ -1153,46 +1171,7 @@ func (c *controller) getIPAMDriver(name string) (ipamapi.Ipam, *ipamapi.Capabili
|
|||
}
|
||||
|
||||
func (c *controller) Stop() {
|
||||
c.clearIngress(false)
|
||||
c.closeStores()
|
||||
c.stopExternalKeyListener()
|
||||
osl.GC()
|
||||
}
|
||||
|
||||
func (c *controller) clearIngress(clusterLeave bool) {
|
||||
c.Lock()
|
||||
ingressSandbox := c.ingressSandbox
|
||||
c.ingressSandbox = nil
|
||||
c.Unlock()
|
||||
|
||||
var n *network
|
||||
if ingressSandbox != nil {
|
||||
for _, ep := range ingressSandbox.getConnectedEndpoints() {
|
||||
if nw := ep.getNetwork(); nw.ingress {
|
||||
n = nw
|
||||
break
|
||||
}
|
||||
}
|
||||
if err := ingressSandbox.Delete(); err != nil {
|
||||
logrus.Warnf("Could not delete ingress sandbox while leaving: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
if n == nil {
|
||||
for _, nw := range c.Networks() {
|
||||
if nw.Info().Ingress() {
|
||||
n = nw.(*network)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
if n == nil && clusterLeave {
|
||||
logrus.Warnf("Could not find ingress network while leaving")
|
||||
}
|
||||
|
||||
if n != nil {
|
||||
if err := n.Delete(); err != nil {
|
||||
logrus.Warnf("Could not delete ingress network while leaving: %v", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue