mirror of
https://github.com/portainer/portainer.git
synced 2025-08-08 07:15:23 +02:00
feat(edge-compute): add specific edge endpoint checkin interval (#3855)
* feat(endpoint): send custom checkin interval * feat(endpoint): update edge checkin interval * feat(endpoint): save checkin interval * feat(endpoints): create endpoint with checkin interval * feat(endpoints): change tooltip * fix(edge-compute): fix typos Co-authored-by: Anthony Lapenna <anthony.lapenna@portainer.io> * fix(endpoints): show default interval * fix(endpoint): rename checkin property Co-authored-by: Anthony Lapenna <anthony.lapenna@portainer.io>
This commit is contained in:
parent
766ced7cb1
commit
9f4631bb6d
11 changed files with 183 additions and 39 deletions
|
@ -65,7 +65,21 @@ angular.module('portainer.app').factory('EndpointService', [
|
|||
return deferred.promise;
|
||||
};
|
||||
|
||||
service.createRemoteEndpoint = function (name, type, URL, PublicURL, groupID, tagIds, TLS, TLSSkipVerify, TLSSkipClientVerify, TLSCAFile, TLSCertFile, TLSKeyFile) {
|
||||
service.createRemoteEndpoint = function (
|
||||
name,
|
||||
type,
|
||||
URL,
|
||||
PublicURL,
|
||||
groupID,
|
||||
tagIds,
|
||||
TLS,
|
||||
TLSSkipVerify,
|
||||
TLSSkipClientVerify,
|
||||
TLSCAFile,
|
||||
TLSCertFile,
|
||||
TLSKeyFile,
|
||||
checkinInterval
|
||||
) {
|
||||
var deferred = $q.defer();
|
||||
|
||||
var endpointURL = URL;
|
||||
|
@ -73,7 +87,21 @@ angular.module('portainer.app').factory('EndpointService', [
|
|||
endpointURL = 'tcp://' + URL;
|
||||
}
|
||||
|
||||
FileUploadService.createEndpoint(name, type, endpointURL, PublicURL, groupID, tagIds, TLS, TLSSkipVerify, TLSSkipClientVerify, TLSCAFile, TLSCertFile, TLSKeyFile)
|
||||
FileUploadService.createEndpoint(
|
||||
name,
|
||||
type,
|
||||
endpointURL,
|
||||
PublicURL,
|
||||
groupID,
|
||||
tagIds,
|
||||
TLS,
|
||||
TLSSkipVerify,
|
||||
TLSSkipClientVerify,
|
||||
TLSCAFile,
|
||||
TLSCertFile,
|
||||
TLSKeyFile,
|
||||
checkinInterval
|
||||
)
|
||||
.then(function success(response) {
|
||||
deferred.resolve(response.data);
|
||||
})
|
||||
|
|
|
@ -91,12 +91,11 @@ angular.module('portainer.app').factory('FileUploadService', [
|
|||
data: {
|
||||
file: file,
|
||||
Name: stackName,
|
||||
EdgeGroups: Upload.json(edgeGroups)
|
||||
EdgeGroups: Upload.json(edgeGroups),
|
||||
},
|
||||
ignoreLoadingBar: true
|
||||
ignoreLoadingBar: true,
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
service.configureRegistry = function (registryId, registryManagementConfigurationModel) {
|
||||
return Upload.upload({
|
||||
|
@ -116,7 +115,7 @@ angular.module('portainer.app').factory('FileUploadService', [
|
|||
});
|
||||
};
|
||||
|
||||
service.createEndpoint = function (name, type, URL, PublicURL, groupID, tagIds, TLS, TLSSkipVerify, TLSSkipClientVerify, TLSCAFile, TLSCertFile, TLSKeyFile) {
|
||||
service.createEndpoint = function (name, type, URL, PublicURL, groupID, tagIds, TLS, TLSSkipVerify, TLSSkipClientVerify, TLSCAFile, TLSCertFile, TLSKeyFile, checkinInterval) {
|
||||
return Upload.upload({
|
||||
url: 'api/endpoints',
|
||||
data: {
|
||||
|
@ -132,6 +131,7 @@ angular.module('portainer.app').factory('FileUploadService', [
|
|||
TLSCACertFile: TLSCAFile,
|
||||
TLSCertFile: TLSCertFile,
|
||||
TLSKeyFile: TLSKeyFile,
|
||||
CheckinInterval: checkinInterval,
|
||||
},
|
||||
ignoreLoadingBar: true,
|
||||
});
|
||||
|
|
|
@ -12,6 +12,7 @@ angular
|
|||
EndpointService,
|
||||
GroupService,
|
||||
TagService,
|
||||
SettingsService,
|
||||
Notifications,
|
||||
Authentication
|
||||
) {
|
||||
|
@ -19,6 +20,24 @@ angular
|
|||
EnvironmentType: 'agent',
|
||||
actionInProgress: false,
|
||||
allowCreateTag: Authentication.isAdmin(),
|
||||
availableEdgeAgentCheckinOptions: [
|
||||
{ key: 'Use default interval', value: 0 },
|
||||
{
|
||||
key: '5 seconds',
|
||||
value: 5,
|
||||
},
|
||||
{
|
||||
key: '10 seconds',
|
||||
value: 10,
|
||||
},
|
||||
{
|
||||
key: '30 seconds',
|
||||
value: 30,
|
||||
},
|
||||
{ key: '5 minutes', value: 300 },
|
||||
{ key: '1 hour', value: 3600 },
|
||||
{ key: '1 day', value: 86400 },
|
||||
],
|
||||
};
|
||||
|
||||
$scope.formValues = {
|
||||
|
@ -28,6 +47,7 @@ angular
|
|||
GroupId: 1,
|
||||
SecurityFormData: new EndpointSecurityFormData(),
|
||||
TagIds: [],
|
||||
CheckinInterval: $scope.state.availableEdgeAgentCheckinOptions[0].value,
|
||||
};
|
||||
|
||||
$scope.copyAgentCommand = function () {
|
||||
|
@ -79,7 +99,7 @@ angular
|
|||
var tagIds = $scope.formValues.TagIds;
|
||||
var URL = $scope.formValues.URL;
|
||||
|
||||
addEndpoint(name, 4, URL, '', groupId, tagIds, false, false, false, null, null, null);
|
||||
addEndpoint(name, 4, URL, '', groupId, tagIds, false, false, false, null, null, null, $scope.formValues.CheckinInterval);
|
||||
};
|
||||
|
||||
$scope.onCreateTag = function onCreateTag(tagName) {
|
||||
|
@ -96,9 +116,23 @@ angular
|
|||
}
|
||||
}
|
||||
|
||||
function addEndpoint(name, type, URL, PublicURL, groupId, tagIds, TLS, TLSSkipVerify, TLSSkipClientVerify, TLSCAFile, TLSCertFile, TLSKeyFile) {
|
||||
function addEndpoint(name, type, URL, PublicURL, groupId, tagIds, TLS, TLSSkipVerify, TLSSkipClientVerify, TLSCAFile, TLSCertFile, TLSKeyFile, CheckinInterval) {
|
||||
$scope.state.actionInProgress = true;
|
||||
EndpointService.createRemoteEndpoint(name, type, URL, PublicURL, groupId, tagIds, TLS, TLSSkipVerify, TLSSkipClientVerify, TLSCAFile, TLSCertFile, TLSKeyFile)
|
||||
EndpointService.createRemoteEndpoint(
|
||||
name,
|
||||
type,
|
||||
URL,
|
||||
PublicURL,
|
||||
groupId,
|
||||
tagIds,
|
||||
TLS,
|
||||
TLSSkipVerify,
|
||||
TLSSkipClientVerify,
|
||||
TLSCAFile,
|
||||
TLSCertFile,
|
||||
TLSKeyFile,
|
||||
CheckinInterval
|
||||
)
|
||||
.then(function success(data) {
|
||||
Notifications.success('Endpoint created', name);
|
||||
if (type === 4) {
|
||||
|
@ -119,10 +153,14 @@ angular
|
|||
$q.all({
|
||||
groups: GroupService.groups(),
|
||||
tags: TagService.tags(),
|
||||
settings: SettingsService.settings(),
|
||||
})
|
||||
.then(function success(data) {
|
||||
$scope.groups = data.groups;
|
||||
$scope.availableTags = data.tags;
|
||||
|
||||
const settings = data.settings;
|
||||
$scope.state.availableEdgeAgentCheckinOptions[0].key += ` (${settings.EdgeAgentCheckinInterval} seconds)`;
|
||||
})
|
||||
.catch(function error(err) {
|
||||
Notifications.error('Failure', err, 'Unable to load groups');
|
||||
|
|
|
@ -145,8 +145,8 @@
|
|||
</div>
|
||||
</div>
|
||||
<!-- !endpoint-url-input -->
|
||||
<!-- portainer-instance-input -->
|
||||
<div ng-if="state.EnvironmentType === 'edge_agent'">
|
||||
<!-- portainer-instance-input -->
|
||||
<div class="form-group">
|
||||
<label for="endpoint_url" class="col-sm-3 col-lg-2 control-label text-left">
|
||||
Portainer server URL
|
||||
|
@ -163,8 +163,25 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- !portainer-instance-input -->
|
||||
<div class="form-group">
|
||||
<label for="edge_checkin" class="col-sm-2 control-label text-left">
|
||||
Poll frequency
|
||||
<portainer-tooltip
|
||||
position="bottom"
|
||||
message="Interval used by this Edge agent to check in with the Portainer instance. Affects Edge endpoint management and Edge compute features."
|
||||
></portainer-tooltip>
|
||||
</label>
|
||||
<div class="col-sm-10">
|
||||
<select
|
||||
id="edge_checkin"
|
||||
class="form-control"
|
||||
ng-model="formValues.CheckinInterval"
|
||||
ng-options="+(opt.value) as opt.key for opt in state.availableEdgeAgentCheckinOptions"
|
||||
></select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- !portainer-instance-input -->
|
||||
<!-- endpoint-public-url-input -->
|
||||
<div ng-if="state.EnvironmentType === 'docker' || state.EnvironmentType === 'agent'">
|
||||
<div class="form-group">
|
||||
|
|
|
@ -36,10 +36,10 @@
|
|||
<div style="margin-top: 10px;">
|
||||
<uib-tabset active="state.deploymentTab">
|
||||
<uib-tab index="0" heading="Standalone">
|
||||
<code style="display: block; white-space: pre-wrap; padding: 16px 90px;">{{dockerCommands.standalone}}</code>
|
||||
<code style="display: block; white-space: pre-wrap; padding: 16px 90px;">{{ dockerCommands.standalone }}</code>
|
||||
</uib-tab>
|
||||
<uib-tab index="1" heading="Swarm">
|
||||
<code style="display: block; white-space: pre-wrap; padding: 16px 90px;">{{dockerCommands.swarm}}</code>
|
||||
<code style="display: block; white-space: pre-wrap; padding: 16px 90px;">{{ dockerCommands.swarm }}</code>
|
||||
</uib-tab>
|
||||
</uib-tabset>
|
||||
<div style="margin-top: 10px;">
|
||||
|
@ -118,6 +118,23 @@
|
|||
<input type="text" class="form-control" id="endpoint_public_url" ng-model="endpoint.PublicURL" placeholder="e.g. 10.0.0.10 or mydocker.mydomain.com" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="edge_checkin" class="col-sm-2 control-label text-left">
|
||||
Poll frequency
|
||||
<portainer-tooltip
|
||||
position="bottom"
|
||||
message="Interval used by this Edge agent to check in with the Portainer instance. Affects Edge endpoint management and Edge compute features."
|
||||
></portainer-tooltip>
|
||||
</label>
|
||||
<div class="col-sm-10">
|
||||
<select
|
||||
id="edge_checkin"
|
||||
class="form-control"
|
||||
ng-model="endpoint.EdgeCheckinInterval"
|
||||
ng-options="+(opt.value) as opt.key for opt in state.availableEdgeAgentCheckinOptions"
|
||||
></select>
|
||||
</div>
|
||||
</div>
|
||||
<!-- !endpoint-public-url-input -->
|
||||
<div class="col-sm-12 form-section-title">
|
||||
Metadata
|
||||
|
|
|
@ -17,13 +17,32 @@ angular
|
|||
TagService,
|
||||
EndpointProvider,
|
||||
Notifications,
|
||||
Authentication
|
||||
Authentication,
|
||||
SettingsService
|
||||
) {
|
||||
$scope.state = {
|
||||
uploadInProgress: false,
|
||||
actionInProgress: false,
|
||||
deploymentTab: 0,
|
||||
allowCreate: Authentication.isAdmin(),
|
||||
availableEdgeAgentCheckinOptions: [
|
||||
{ key: 'Use default interval', value: 0 },
|
||||
{
|
||||
key: '5 seconds',
|
||||
value: 5,
|
||||
},
|
||||
{
|
||||
key: '10 seconds',
|
||||
value: 10,
|
||||
},
|
||||
{
|
||||
key: '30 seconds',
|
||||
value: 30,
|
||||
},
|
||||
{ key: '5 minutes', value: 300 },
|
||||
{ key: '1 hour', value: 3600 },
|
||||
{ key: '1 day', value: 86400 },
|
||||
],
|
||||
};
|
||||
|
||||
$scope.formValues = {
|
||||
|
@ -83,6 +102,7 @@ angular
|
|||
PublicURL: endpoint.PublicURL,
|
||||
GroupID: endpoint.GroupId,
|
||||
TagIds: endpoint.TagIds,
|
||||
EdgeCheckinInterval: endpoint.EdgeCheckinInterval,
|
||||
TLS: TLS,
|
||||
TLSSkipVerify: TLSSkipVerify,
|
||||
TLSSkipClientVerify: TLSSkipClientVerify,
|
||||
|
@ -133,6 +153,7 @@ angular
|
|||
endpoint: EndpointService.endpoint($transition$.params().id),
|
||||
groups: GroupService.groups(),
|
||||
tags: TagService.tags(),
|
||||
settings: SettingsService.settings(),
|
||||
})
|
||||
.then(function success(data) {
|
||||
var endpoint = data.endpoint;
|
||||
|
@ -149,6 +170,9 @@ angular
|
|||
standalone: buildStandaloneCommand($scope.randomEdgeID, endpoint.EdgeKey),
|
||||
swarm: buildSwarmCommand($scope.randomEdgeID, endpoint.EdgeKey),
|
||||
};
|
||||
|
||||
const settings = data.settings;
|
||||
$scope.state.availableEdgeAgentCheckinOptions[0].key += ` (${settings.EdgeAgentCheckinInterval} seconds)`;
|
||||
}
|
||||
$scope.endpoint = endpoint;
|
||||
$scope.groups = data.groups;
|
||||
|
|
|
@ -118,8 +118,11 @@
|
|||
</div>
|
||||
<div class="form-group">
|
||||
<label for="edge_checkin" class="col-sm-2 control-label text-left">
|
||||
Edge agent poll frequency
|
||||
<portainer-tooltip position="bottom" message="Specify the interval used by each Edge agent to checkin with the Portainer instance"></portainer-tooltip>
|
||||
Edge agent default poll frequency
|
||||
<portainer-tooltip
|
||||
position="bottom"
|
||||
message="Interval used by default by each Edge agent to check in with the Portainer instance. Affects Edge endpoint management and Edge compute features."
|
||||
></portainer-tooltip>
|
||||
</label>
|
||||
<div class="col-sm-10">
|
||||
<select
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue