mirror of https://github.com/portainer/portainer
feat(k8s/resource-pool): prevent admins from making changes to "system" namespaces (#4167)
parent
d85708f6ea
commit
b8f8c75380
|
@ -21,9 +21,9 @@
|
|||
</div>
|
||||
</div>
|
||||
<!-- !name-input -->
|
||||
<div ng-if="ctrl.isAdmin" class="col-sm-12 form-section-title">Quota</div>
|
||||
<div ng-if="ctrl.isAdmin && ctrl.isEditable" class="col-sm-12 form-section-title">Quota</div>
|
||||
<!-- quotas-switch -->
|
||||
<div ng-if="ctrl.isAdmin" class="form-group">
|
||||
<div ng-if="ctrl.isAdmin && ctrl.isEditable" class="form-group">
|
||||
<div class="col-sm-12">
|
||||
<label class="control-label text-left">
|
||||
Resource assignment
|
||||
|
@ -37,7 +37,7 @@
|
|||
</span>
|
||||
</div>
|
||||
<!-- !quotas-switch -->
|
||||
<div ng-if="ctrl.formValues.hasQuota && ctrl.isAdmin">
|
||||
<div ng-if="ctrl.formValues.hasQuota && ctrl.isAdmin && ctrl.isEditable">
|
||||
<div class="col-sm-12 form-section-title">
|
||||
Resource limits
|
||||
</div>
|
||||
|
@ -121,10 +121,10 @@
|
|||
</kubernetes-resource-reservation>
|
||||
</div>
|
||||
<!-- actions -->
|
||||
<div ng-if="ctrl.isAdmin" class="col-sm-12 form-section-title">
|
||||
<div ng-if="ctrl.isAdmin && ctrl.isEditable" class="col-sm-12 form-section-title">
|
||||
Actions
|
||||
</div>
|
||||
<div ng-if="ctrl.isAdmin" class="form-group">
|
||||
<div ng-if="ctrl.isAdmin && ctrl.isEditable" class="form-group">
|
||||
<div class="col-sm-12">
|
||||
<button
|
||||
type="button"
|
||||
|
|
|
@ -18,7 +18,8 @@ class KubernetesResourcePoolController {
|
|||
KubernetesResourcePoolService,
|
||||
KubernetesEventService,
|
||||
KubernetesPodService,
|
||||
KubernetesApplicationService
|
||||
KubernetesApplicationService,
|
||||
KubernetesNamespaceHelper
|
||||
) {
|
||||
this.$async = $async;
|
||||
this.$state = $state;
|
||||
|
@ -32,6 +33,7 @@ class KubernetesResourcePoolController {
|
|||
this.KubernetesEventService = KubernetesEventService;
|
||||
this.KubernetesPodService = KubernetesPodService;
|
||||
this.KubernetesApplicationService = KubernetesApplicationService;
|
||||
this.KubernetesNamespaceHelper = KubernetesNamespaceHelper;
|
||||
|
||||
this.onInit = this.onInit.bind(this);
|
||||
this.createResourceQuotaAsync = this.createResourceQuotaAsync.bind(this);
|
||||
|
@ -206,6 +208,11 @@ class KubernetesResourcePoolController {
|
|||
this.state.memoryUsed = KubernetesResourceReservationHelper.megaBytesValue(quota.MemoryLimitUsed);
|
||||
}
|
||||
|
||||
this.isEditable = !this.KubernetesNamespaceHelper.isSystemNamespace(this.pool.Namespace.Name);
|
||||
if (this.pool.Namespace.Name === 'default') {
|
||||
this.isEditable = false;
|
||||
}
|
||||
|
||||
await this.getEvents();
|
||||
await this.getApplications();
|
||||
} catch (err) {
|
||||
|
|
Loading…
Reference in New Issue