mirror of
https://github.com/portainer/portainer.git
synced 2025-07-22 06:49:40 +02:00
feat(resourcequotas): reduce resource quota requests [EE-4757] (#8420)
This commit is contained in:
parent
44d69f3a3f
commit
9f6702d0b8
6 changed files with 61 additions and 48 deletions
|
@ -1,5 +1,3 @@
|
|||
import _ from 'lodash-es';
|
||||
|
||||
import angular from 'angular';
|
||||
import PortainerError from 'Portainer/error';
|
||||
import { KubernetesCommonParams } from 'Kubernetes/models/common/params';
|
||||
|
@ -65,10 +63,13 @@ class KubernetesNamespaceService {
|
|||
|
||||
async getAllAsync() {
|
||||
try {
|
||||
// get the list of all namespaces (RBAC allows users to see the list of namespaces)
|
||||
const data = await this.KubernetesNamespaces().get().$promise;
|
||||
const promises = _.map(data.items, (item) => this.KubernetesNamespaces().status({ id: item.metadata.name }).$promise);
|
||||
// get the status of each namespace (RBAC will give permission denied for status of unauthorised namespaces)
|
||||
const promises = data.items.map((item) => this.KubernetesNamespaces().status({ id: item.metadata.name }).$promise);
|
||||
const namespaces = await $allSettled(promises);
|
||||
const allNamespaces = _.map(namespaces.fulfilled, (item) => {
|
||||
// only return namespaces if the user has access to namespaces
|
||||
const allNamespaces = namespaces.fulfilled.map((item) => {
|
||||
return KubernetesNamespaceConverter.apiToNamespace(item);
|
||||
});
|
||||
updateNamespaces(allNamespaces);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue