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

feat(k8s/resource-pool): add the ability to mark/unmark resource pool as system (#5360)

* feat(k8s/resource-pool): add the ability to mark/unmark resource pool as system

fix(kube/ns): check label to see if namespace is system

refactor(k8s/namespaces): rename variables

feat(kubernetes): toggle system state in the server (#5361)

fix(app/resource-pool): UI fixes

feat(app/resource-pool): add confirmation modal when unamrking system namespace

* refactor(app): review changes

* feat(app/namespaces): introduce store to retrieve namespace system status without changing all the kubernetes models

refactor(app/namespaces): remove unused code first introduced for system tagging

fix(app/namespaces): cache namespaces to retrieve system status regardless of namespace reference format

refactor(app): migrate namespace store from helper to a separate singleton

refactor(app): remove KubernetesNamespaceHelper from DI cycle

* refactor(app): normalize usage of KubernetesNamespaceHelper functions

* refactor(app/k8s): change namespace store to functions instead of class

Co-authored-by: LP B <xAt0mZ@users.noreply.github.com>
This commit is contained in:
Chaim Lev-Ari 2021-08-26 17:00:59 +03:00 committed by GitHub
parent 5ab98f41f1
commit 1830a80a61
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
45 changed files with 675 additions and 154 deletions

View file

@ -4,6 +4,7 @@ import angular from 'angular';
import PortainerError from 'Portainer/error';
import { KubernetesCommonParams } from 'Kubernetes/models/common/params';
import KubernetesNamespaceConverter from 'Kubernetes/converters/namespace';
import { updateNamespaces } from 'Kubernetes/store/namespace';
import $allSettled from 'Portainer/services/allSettled';
class KubernetesNamespaceService {
@ -27,7 +28,9 @@ class KubernetesNamespaceService {
params.id = name;
await this.KubernetesNamespaces().status(params).$promise;
const [raw, yaml] = await Promise.all([this.KubernetesNamespaces().get(params).$promise, this.KubernetesNamespaces().getYaml(params).$promise]);
return KubernetesNamespaceConverter.apiToNamespace(raw, yaml);
const ns = KubernetesNamespaceConverter.apiToNamespace(raw, yaml);
updateNamespaces([ns]);
return ns;
} catch (err) {
throw new PortainerError('Unable to retrieve namespace', err);
}
@ -43,7 +46,9 @@ class KubernetesNamespaceService {
return KubernetesNamespaceConverter.apiToNamespace(item);
}
});
return _.without(visibleNamespaces, undefined);
const res = _.without(visibleNamespaces, undefined);
updateNamespaces(res);
return res;
} catch (err) {
throw new PortainerError('Unable to retrieve namespaces', err);
}