mirror of
https://github.com/portainer/portainer.git
synced 2025-08-08 07:15:23 +02:00
feat(docker): show docker pull rate limits (#4666)
* feat(dockerhub): introduce local status endpoint * feat(proxy): rewrite request with dockerhub credentials * feat(endpoint): check env type * feat(endpoint): check for local endpoint * feat(docker): introduce client side service to get limits * feat(container): add info about rate limits in container * feat(dockerhub): load rate limits just for specific endpoints * feat(images): show specific dockerhub messages for admin * feat(service-create): show docker rate limits * feat(service-edit): show rate limit messages * fix(images): fix loading of page * refactor(images): move rate limits check to container * feat(kubernetes): proxy agent requests * feat(kubernetes/apps): show pull limits in application creation * refactor(image-registry): move warning to end of field * fix(image-registry): show right message for admin * fix(images): silently fail when loading rate limits * fix(kube/apps): use new rate limits comp * fix(images): move rate warning to end * fix(registry): move search to right place * fix(service): remove service warning * fix(endpoints): check if kube endpoint is local
This commit is contained in:
parent
d1a21ef6c1
commit
f5aa6c4dc2
29 changed files with 605 additions and 139 deletions
|
@ -11,6 +11,16 @@ angular.module('portainer.app').factory('EndpointHelper', [
|
|||
});
|
||||
}
|
||||
|
||||
helper.isLocalEndpoint = isLocalEndpoint;
|
||||
function isLocalEndpoint(endpoint) {
|
||||
return endpoint.URL.includes('unix://') || endpoint.URL.includes('npipe://') || endpoint.Type === 5;
|
||||
}
|
||||
|
||||
helper.isAgentEndpoint = isAgentEndpoint;
|
||||
function isAgentEndpoint(endpoint) {
|
||||
return [2, 4, 6, 7].includes(endpoint.Type);
|
||||
}
|
||||
|
||||
helper.mapGroupNameToEndpoint = function (endpoints, groups) {
|
||||
for (var i = 0; i < endpoints.length; i++) {
|
||||
var endpoint = endpoints[i];
|
||||
|
|
|
@ -22,6 +22,7 @@ angular.module('portainer.app').factory('Endpoints', [
|
|||
snapshot: { method: 'POST', params: { id: '@id', action: 'snapshot' } },
|
||||
status: { method: 'GET', params: { id: '@id', action: 'status' } },
|
||||
updateSecuritySettings: { method: 'PUT', params: { id: '@id', action: 'settings' } },
|
||||
dockerhubLimits: { method: 'GET', params: { id: '@id', action: 'dockerhub' } },
|
||||
}
|
||||
);
|
||||
},
|
||||
|
|
|
@ -3,7 +3,10 @@ import { DockerHubViewModel } from '../../models/dockerhub';
|
|||
angular.module('portainer.app').factory('DockerHubService', [
|
||||
'$q',
|
||||
'DockerHub',
|
||||
function DockerHubServiceFactory($q, DockerHub) {
|
||||
'Endpoints',
|
||||
'AgentDockerhub',
|
||||
'EndpointHelper',
|
||||
function DockerHubServiceFactory($q, DockerHub, Endpoints, AgentDockerhub, EndpointHelper) {
|
||||
'use strict';
|
||||
var service = {};
|
||||
|
||||
|
@ -26,6 +29,23 @@ angular.module('portainer.app').factory('DockerHubService', [
|
|||
return DockerHub.update({}, dockerhub).$promise;
|
||||
};
|
||||
|
||||
service.checkRateLimits = checkRateLimits;
|
||||
function checkRateLimits(endpoint) {
|
||||
if (EndpointHelper.isLocalEndpoint(endpoint)) {
|
||||
return Endpoints.dockerhubLimits({ id: endpoint.Id }).$promise;
|
||||
}
|
||||
|
||||
switch (endpoint.Type) {
|
||||
case 2: //AgentOnDockerEnvironment
|
||||
case 4: //EdgeAgentOnDockerEnvironment
|
||||
return AgentDockerhub.limits({ endpointId: endpoint.Id, endpointType: 'docker' }).$promise;
|
||||
|
||||
case 6: //AgentOnKubernetesEnvironment
|
||||
case 7: //EdgeAgentOnKubernetesEnvironment
|
||||
return AgentDockerhub.limits({ endpointId: endpoint.Id, endpointType: 'kubernetes' }).$promise;
|
||||
}
|
||||
}
|
||||
|
||||
return service;
|
||||
},
|
||||
]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue