1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-08-02 20:35:25 +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:
Chaim Lev-Ari 2021-03-24 20:27:32 +02:00 committed by GitHub
parent d1a21ef6c1
commit f5aa6c4dc2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
29 changed files with 605 additions and 139 deletions

View file

@ -51,6 +51,7 @@
<!-- #endregion -->
<!-- #region IMAGE FIELD -->
<div class="form-group">
<label for="container_image" class="col-sm-1 control-label text-left">Image</label>
<div class="col-sm-11">
@ -72,6 +73,14 @@
</div>
</div>
</div>
<por-image-registry-rate-limits
is-docker-hub-registry="true"
endpoint="ctrl.endpoint"
is-authenticated="ctrl.state.isDockerAuthenticated"
is-admin="ctrl.isAdmin"
set-validity="ctrl.setPullImageValidity"
>
</por-image-registry-rate-limits>
<!-- #endregion -->
<div class="col-sm-12 form-section-title">
@ -1516,7 +1525,7 @@
<button
type="button"
class="btn btn-primary btn-sm"
ng-disabled="!kubernetesApplicationCreationForm.$valid || ctrl.isDeployUpdateButtonDisabled()"
ng-disabled="!kubernetesApplicationCreationForm.$valid || ctrl.isDeployUpdateButtonDisabled() || !ctrl.state.pullImageValidity"
ng-click="ctrl.deployApplication()"
button-spinner="ctrl.state.actionInProgress"
>

View file

@ -4,5 +4,6 @@ angular.module('portainer.kubernetes').component('kubernetesCreateApplicationVie
controllerAs: 'ctrl',
bindings: {
$transition$: '<',
endpoint: '<',
},
});

View file

@ -40,6 +40,7 @@ class KubernetesCreateApplicationController {
Notifications,
EndpointProvider,
Authentication,
DockerHubService,
ModalService,
KubernetesResourcePoolService,
KubernetesApplicationService,
@ -56,6 +57,7 @@ class KubernetesCreateApplicationController {
this.Notifications = Notifications;
this.EndpointProvider = EndpointProvider;
this.Authentication = Authentication;
this.DockerHubService = DockerHubService;
this.ModalService = ModalService;
this.KubernetesResourcePoolService = KubernetesResourcePoolService;
this.KubernetesApplicationService = KubernetesApplicationService;
@ -77,9 +79,14 @@ class KubernetesCreateApplicationController {
this.updateApplicationAsync = this.updateApplicationAsync.bind(this);
this.deployApplicationAsync = this.deployApplicationAsync.bind(this);
this.setPullImageValidity = this.setPullImageValidity.bind(this);
}
/* #endregion */
setPullImageValidity(validity) {
this.state.pullImageValidity = validity;
}
onChangeName() {
const existingApplication = _.find(this.applications, { Name: this.formValues.Name });
this.state.alreadyExists = (this.state.isEdit && existingApplication && this.application.Id !== existingApplication.Id) || (!this.state.isEdit && existingApplication);
@ -915,6 +922,7 @@ class KubernetesCreateApplicationController {
name: this.$transition$.params().name,
},
persistedFoldersUseExistingVolumes: false,
pullImageValidity: false,
};
this.isAdmin = this.Authentication.isAdmin();
@ -984,6 +992,9 @@ class KubernetesCreateApplicationController {
}
this.updateSliders();
const dockerHub = await this.DockerHubService.dockerhub();
this.state.isDockerAuthenticated = dockerHub.Authentication;
} catch (err) {
this.Notifications.error('Failure', err, 'Unable to load view data');
} finally {