dashboard icon indicating copy to clipboard operation
dashboard copied to clipboard

When there are a large number of resources, prompt user to select a namespace or project

Open catherineluse opened this issue 2 years ago • 1 comments

When there are a large number of resources in a cluster, some pages can take a long time to load. One way to mitigate this would be to pick an arbitrary number of resources, then prompt the user to select a project or namespace to filter their view if the number of results is over that limit.

We might not need to force the user to select a project or namespace, but we could say something like "Are you sure you want to load all XXX resources in the cluster? To load the page faster, select a project" or something like that.

catherineluse avatar Jul 26 '22 05:07 catherineluse

I've started investigating this

richard-cox avatar Jul 26 '22 10:07 richard-cox

Note to QA - More detail in PR description.

This feature restricts selection to a single namespace. The BE team are working on increases the range of API filtering we can do (projects and multiple namespaces). Once that's done we can open up the selection to more than just a namespace (tracked via https://github.com/rancher/dashboard/issues/7618)

richard-cox avatar Dec 05 '22 13:12 richard-cox

Test Results

Background

Set up a HA cluster running KS3. Install Rancher 2.7.2-rc1 or the latest from 2.7-head

Testing Setup and Notes

To demonstrate the functionality, enable in Global Settings under Performance, Enable Required Namespace Filtering, and press Apply.

You can set the number of resources to trigger this filtering by changing the number in Resource Threshold.

After making these settings, you can test the functionality by setting an extremely low threshold, like 2. and you will see the message about too many Workloads and asking you to select a Namespace.

Note Once you filter by namespace, you can not unselect the filter. To delete a filter, unselect Enable Required Namespace Filtering in Global Settings and return to the workloads screen.

Enabled

Screenshot 2023-02-27 at 2 32 16 PM

Disabled

Screenshot 2023-02-27 at 2 32 46 PM

Environment setup

I tested various scenarios by creating different workloads.

for i in {1..40}
do
  kubectl create namespace nginx-namespace-$i
done
for i in {1..40}
do
  for j in {1..10}
  do
    kubectl create deployment nginx-$j --image=nginx --namespace=nginx-namespace-$i
  done
done

And to delete what I created

for i in {1..40}
do
  for j in {1..10}
  do
    kubectl delete deployment nginx-$j --namespace=nginx-namespace-$i
  done
done

# Destroy namespaces
for i in {1..40}
do
  kubectl delete namespace nginx-namespace-$i
done

I also tested with an odd number of workloads.

for i in {1..21}
do
  kubectl create namespace nginx-namespace-$i
done
for i in {1..21}
do
  for j in {1..4}
  do
    kubectl create deployment nginx-$j --image=nginx --namespace=nginx-namespace-$i
  done
done

And to delete what I created

for i in {1..21}
do
  for j in {1..4}
  do
    kubectl delete deployment nginx-$j --namespace=nginx-namespace-$i
  done
done

# Destroy namespaces
for i in {1..21}
do
  kubectl delete namespace nginx-namespace-$i
done

Observations

I observed no performance issues, and the UI seemed more responsive. There was no impact on the underlying system CPU, Memory, or Network usage.

Filtering Disabled

Screenshot 2023-02-27 at 2 59 09 PM

Filtering Enabled

Screenshot 2023-02-27 at 3 26 04 PM

floatingman avatar Feb 27 '23 21:02 floatingman