1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-23 07:19:41 +02:00

feat(kubernetes): Prevent deployment/edition of resources inside a system namespace (#4039)

* feat(kubernetes): Prevent deployment/edition of resources inside a system namespace

* feat(kubernetes): minor UI update

Co-authored-by: Anthony Lapenna <lapenna.anthony@gmail.com>
This commit is contained in:
Maxime Bajeux 2020-07-14 07:39:13 +02:00 committed by GitHub
parent 181a6f4553
commit 8b79f2524d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 46 additions and 5 deletions

View file

@ -5,7 +5,7 @@ import { KubernetesConfigurationTypes } from 'Kubernetes/models/configuration/mo
class KubernetesCreateConfigurationController {
/* @ngInject */
constructor($async, $state, Notifications, Authentication, KubernetesConfigurationService, KubernetesResourcePoolService) {
constructor($async, $state, Notifications, Authentication, KubernetesConfigurationService, KubernetesResourcePoolService, KubernetesNamespaceHelper) {
this.$async = $async;
this.$state = $state;
this.Notifications = Notifications;
@ -13,6 +13,7 @@ class KubernetesCreateConfigurationController {
this.KubernetesConfigurationService = KubernetesConfigurationService;
this.KubernetesResourcePoolService = KubernetesResourcePoolService;
this.KubernetesConfigurationTypes = KubernetesConfigurationTypes;
this.KubernetesNamespaceHelper = KubernetesNamespaceHelper;
this.onInit = this.onInit.bind(this);
this.createConfigurationAsync = this.createConfigurationAsync.bind(this);
@ -74,7 +75,9 @@ class KubernetesCreateConfigurationController {
this.formValues.Data.push(new KubernetesConfigurationFormValuesDataEntry());
try {
this.resourcePools = await this.KubernetesResourcePoolService.get();
const resourcePools = await this.KubernetesResourcePoolService.get();
this.resourcePools = _.filter(resourcePools, (resourcePool) => !this.KubernetesNamespaceHelper.isSystemNamespace(resourcePool.Namespace.Name));
this.formValues.ResourcePool = this.resourcePools[0];
await this.getConfigurations();
} catch (err) {