mirror of https://github.com/portainer/portainer
fix(network-creation): force overlay network creation on manager node (#2622)
* fix(network-creation): force overlay network creation on manager node * fix(app): fix function override * fix(app): use portainerAgentManagerOperation in interceptorpull/2629/head
parent
3a3577754e
commit
34667bd3b3
|
@ -30,7 +30,7 @@ function ($rootScope, $state, Authentication, authManager, StateManager, Endpoin
|
||||||
};
|
};
|
||||||
|
|
||||||
$transitions.onBefore({ to: 'docker.**' }, function() {
|
$transitions.onBefore({ to: 'docker.**' }, function() {
|
||||||
HttpRequestHelper.resetAgentTargetQueue();
|
HttpRequestHelper.resetAgentHeaders();
|
||||||
});
|
});
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,9 @@ angular.module('portainer')
|
||||||
request: function(config) {
|
request: function(config) {
|
||||||
if (config.url.indexOf('/docker/') > -1) {
|
if (config.url.indexOf('/docker/') > -1) {
|
||||||
config.headers['X-PortainerAgent-Target'] = HttpRequestHelper.portainerAgentTargetHeader();
|
config.headers['X-PortainerAgent-Target'] = HttpRequestHelper.portainerAgentTargetHeader();
|
||||||
|
if (HttpRequestHelper.portainerAgentManagerOperation()) {
|
||||||
|
config.headers['X-PortainerAgent-ManagerOperation'] = '1';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,6 +126,7 @@ angular.module('portainer.docker')
|
||||||
|
|
||||||
function createNetwork(context) {
|
function createNetwork(context) {
|
||||||
HttpRequestHelper.setPortainerAgentTargetHeader(context.nodeName);
|
HttpRequestHelper.setPortainerAgentTargetHeader(context.nodeName);
|
||||||
|
HttpRequestHelper.setPortainerAgentManagerOperation(context.managerOperation);
|
||||||
|
|
||||||
$scope.state.actionInProgress = true;
|
$scope.state.actionInProgress = true;
|
||||||
NetworkService.create(context.networkConfiguration)
|
NetworkService.create(context.networkConfiguration)
|
||||||
|
@ -162,12 +163,17 @@ angular.module('portainer.docker')
|
||||||
|
|
||||||
var creationContext = {
|
var creationContext = {
|
||||||
nodeName: $scope.formValues.NodeName,
|
nodeName: $scope.formValues.NodeName,
|
||||||
|
managerOperation: false,
|
||||||
networkConfiguration: networkConfiguration,
|
networkConfiguration: networkConfiguration,
|
||||||
userDetails: userDetails,
|
userDetails: userDetails,
|
||||||
accessControlData: accessControlData,
|
accessControlData: accessControlData,
|
||||||
reload: true
|
reload: true
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if ($scope.applicationState.endpoint.mode.agentProxy && $scope.applicationState.endpoint.mode.provider === 'DOCKER_SWARM_MODE' && $scope.config.Driver === 'overlay') {
|
||||||
|
creationContext.managerOperation = true;
|
||||||
|
}
|
||||||
|
|
||||||
if ($scope.config.Driver === 'macvlan') {
|
if ($scope.config.Driver === 'macvlan') {
|
||||||
if ($scope.formValues.Macvlan.Scope === 'local') {
|
if ($scope.formValues.Macvlan.Scope === 'local') {
|
||||||
modifyNetworkConfigurationForMacvlanConfigOnly(networkConfiguration);
|
modifyNetworkConfigurationForMacvlanConfigOnly(networkConfiguration);
|
||||||
|
@ -205,4 +211,4 @@ angular.module('portainer.docker')
|
||||||
|
|
||||||
initView();
|
initView();
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -5,6 +5,7 @@ angular.module('portainer.app')
|
||||||
var service = {};
|
var service = {};
|
||||||
var headers = {};
|
var headers = {};
|
||||||
headers.agentTargetQueue = [];
|
headers.agentTargetQueue = [];
|
||||||
|
headers.agentManagerOperation = false;
|
||||||
|
|
||||||
service.registryAuthenticationHeader = function() {
|
service.registryAuthenticationHeader = function() {
|
||||||
return headers.registryAuthentication;
|
return headers.registryAuthentication;
|
||||||
|
@ -36,9 +37,18 @@ angular.module('portainer.app')
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
service.resetAgentTargetQueue = function() {
|
service.setPortainerAgentManagerOperation = function(set) {
|
||||||
|
headers.agentManagerOperation = set;
|
||||||
|
};
|
||||||
|
|
||||||
|
service.portainerAgentManagerOperation = function() {
|
||||||
|
return headers.agentManagerOperation;
|
||||||
|
};
|
||||||
|
|
||||||
|
service.resetAgentHeaders = function() {
|
||||||
headers.agentTargetQueue = [];
|
headers.agentTargetQueue = [];
|
||||||
delete headers.agentTargetLastValue;
|
delete headers.agentTargetLastValue;
|
||||||
|
headers.agentManagerOperation = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
return service;
|
return service;
|
||||||
|
|
Loading…
Reference in New Issue