|
@@ -241,7 +241,7 @@ func (c *Controller) clusterAgentInit() {
|
|
c.mu.Unlock()
|
|
c.mu.Unlock()
|
|
fallthrough
|
|
fallthrough
|
|
case cluster.EventSocketChange, cluster.EventNodeReady:
|
|
case cluster.EventSocketChange, cluster.EventNodeReady:
|
|
- if keysAvailable && !c.isDistributedControl() {
|
|
|
|
|
|
+ if keysAvailable && c.isSwarmNode() {
|
|
c.agentOperationStart()
|
|
c.agentOperationStart()
|
|
if err := c.agentSetup(clusterProvider); err != nil {
|
|
if err := c.agentSetup(clusterProvider); err != nil {
|
|
c.agentStopComplete()
|
|
c.agentStopComplete()
|
|
@@ -451,8 +451,8 @@ func (c *Controller) isAgent() bool {
|
|
return c.cfg.ClusterProvider.IsAgent()
|
|
return c.cfg.ClusterProvider.IsAgent()
|
|
}
|
|
}
|
|
|
|
|
|
-func (c *Controller) isDistributedControl() bool {
|
|
|
|
- return !c.isManager() && !c.isAgent()
|
|
|
|
|
|
+func (c *Controller) isSwarmNode() bool {
|
|
|
|
+ return c.isManager() || c.isAgent()
|
|
}
|
|
}
|
|
|
|
|
|
func (c *Controller) GetPluginGetter() plugingetter.PluginGetter {
|
|
func (c *Controller) GetPluginGetter() plugingetter.PluginGetter {
|
|
@@ -553,7 +553,7 @@ func (c *Controller) NewNetwork(networkType, name string, id string, options ...
|
|
|
|
|
|
// At this point the network scope is still unknown if not set by user
|
|
// At this point the network scope is still unknown if not set by user
|
|
if (caps.DataScope == scope.Global || nw.scope == scope.Swarm) &&
|
|
if (caps.DataScope == scope.Global || nw.scope == scope.Swarm) &&
|
|
- !c.isDistributedControl() && !nw.dynamic {
|
|
|
|
|
|
+ c.isSwarmNode() && !nw.dynamic {
|
|
if c.isManager() {
|
|
if c.isManager() {
|
|
// For non-distributed controlled environment, globalscoped non-dynamic networks are redirected to Manager
|
|
// For non-distributed controlled environment, globalscoped non-dynamic networks are redirected to Manager
|
|
return nil, ManagerRedirectError(name)
|
|
return nil, ManagerRedirectError(name)
|
|
@@ -561,7 +561,7 @@ func (c *Controller) NewNetwork(networkType, name string, id string, options ...
|
|
return nil, types.ForbiddenErrorf("Cannot create a multi-host network from a worker node. Please create the network from a manager node.")
|
|
return nil, types.ForbiddenErrorf("Cannot create a multi-host network from a worker node. Please create the network from a manager node.")
|
|
}
|
|
}
|
|
|
|
|
|
- if nw.scope == scope.Swarm && c.isDistributedControl() {
|
|
|
|
|
|
+ if nw.scope == scope.Swarm && !c.isSwarmNode() {
|
|
return nil, types.ForbiddenErrorf("cannot create a swarm scoped network when swarm is not active")
|
|
return nil, types.ForbiddenErrorf("cannot create a swarm scoped network when swarm is not active")
|
|
}
|
|
}
|
|
|
|
|
|
@@ -704,7 +704,7 @@ addToStore:
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- if !c.isDistributedControl() {
|
|
|
|
|
|
+ if c.isSwarmNode() {
|
|
c.mu.Lock()
|
|
c.mu.Lock()
|
|
arrangeIngressFilterRule()
|
|
arrangeIngressFilterRule()
|
|
c.mu.Unlock()
|
|
c.mu.Unlock()
|