Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use all clusterqueues #3540

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

KPostOffice
Copy link

@KPostOffice KPostOffice commented Dec 3, 2024

https://issues.redhat.com/browse/RHOAIENG-8102

Description

With support for multiple clusterQueues, the first element can't be relied on for total shared quota

How Has This Been Tested?

I've used the existing Cyprus UI tests to verify that empty states still work as expected and I've added a unit test to ensure that when multiple CQs are used the total quota is correctly tallied up.

To manually test create two CQs and a LQ for each CQ and make sure that the total quota in the effected UI component is the sum of the quota for both CQs

Test Impact

Request review criteria:

Self checklist (all need to be checked):

  • The developer has manually tested the changes and verified that the changes work
  • Testing instructions have been added in the PR body (for PRs involving changes that are not immediately obvious).
  • The developer has added tests or explained why testing cannot be added (unit or cypress tests for related changes)

If you have UI changes:

  • Included any necessary screenshots or gifs if it was a UI change.
  • Included tags to the UX team if it was a UI/UX change.

After the PR is posted & before it merges:

  • The developer has tested their solution on a cluster by using the image produced by the PR to main

@KPostOffice KPostOffice changed the title use all clusterqueues and filter by availability in ns use all clusterqueues Dec 4, 2024
Copy link
Contributor

@mturley mturley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly LGTM, a few small things

Comment on lines 247 to 248
(clusterQueues || [])
.map((clusterQueue) =>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could instead get a combined array of all the resourceGroups in all the ClusterQueues by doing:

(clusterQueues || []).flatMap((clusterQueue) => clusterQueue?.spec.resourceGroups || [])

And that would just replace the original (clusterQueue?.spec.resourceGroups || []), you'd chain the existing .reduce on it and you wouldn't need your additional reduce at the end

const localQueues = useMakeFetchObject<LocalQueueKind[]>(
useLocalQueues(namespace, refreshRate),
);

const clusterQueues = useMakeFetchObject<ClusterQueueKind[]>(useClusterQueues(refreshRate));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This all looks good to me, but you'd want to add the logic you mentioned for filtering these by the namespace right? You could rename this to allClusterQueues and then have something like:

const clusterQueues = {
  ...allClusterQueues,
  data: allClusterQueues.data.filter((clusterQueue) =>
    localQueues.data.some(({ spec }) => spec.clusterQueue === clusterQueue.metadata.name),
  ),
};

You'll want to preserve the rest of the object you get back from useMakeFetchObject so you're still passing down loading/error state, but you can override the data being included this way.

Signed-off-by: Kevin <[email protected]>
Copy link

codecov bot commented Dec 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.18%. Comparing base (1896f34) to head (635df77).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3540      +/-   ##
==========================================
- Coverage   85.19%   85.18%   -0.01%     
==========================================
  Files        1382     1382              
  Lines       31572    31576       +4     
  Branches     8824     8827       +3     
==========================================
+ Hits        26897    26899       +2     
- Misses       4675     4677       +2     
Files with missing lines Coverage Δ
...stributedWorkloads/DistributedWorkloadsContext.tsx 82.85% <100.00%> (+1.60%) ⬆️
...ontend/src/concepts/distributedWorkloads/utils.tsx 100.00% <100.00%> (ø)
...orkloads/global/GlobalDistributedWorkloadsTabs.tsx 97.43% <100.00%> (ø)
...bal/projectMetrics/sections/RequestedResources.tsx 84.61% <100.00%> (ø)

... and 1 file with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1896f34...635df77. Read the comment docs.

Copy link
Contributor

@mturley mturley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@openshift-ci openshift-ci bot added the lgtm label Dec 18, 2024
Copy link
Contributor

openshift-ci bot commented Dec 18, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mturley

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@mturley
Copy link
Contributor

mturley commented Dec 18, 2024

/hold

@openshift-ci openshift-ci bot added the do-not-merge/hold This PR is hold for some reason label Dec 18, 2024
@openshift-ci openshift-ci bot removed the lgtm label Dec 19, 2024
Copy link
Contributor

openshift-ci bot commented Dec 19, 2024

New changes are detected. LGTM label has been removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved do-not-merge/hold This PR is hold for some reason
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants