Skip to content

feat(frontend): add admin cluster capacity panel - #9135

Open
kunwp1 wants to merge 2 commits into
apache:mainfrom
kunwp1:feat/admin-cu-cluster-overview
Open

kunwp1 wants to merge 2 commits into
apache:mainfrom
kunwp1:feat/admin-cu-cluster-overview

Conversation

@kunwp1

@kunwp1 kunwp1 commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

Problem. When a computing unit stays Pending on a full cluster, Admin > Computing Units (#8888) lists the unit but not how much of the cluster is left, so an admin still runs kubectl describe nodes to find which resource ran out. The backend has reported it since #8986 (GET /computing-unit/admin/cluster-capacity), but nothing in the UI reads it.

Fix. Adds a Cluster capacity card above the units table. CPU, memory and GPU each get a row with a bar of the share allocated, then the allocated, available and total amounts: CPU in cores to the millicore, memory in binary units (GiB, as unit limits are written) and GPU as a count. The bars share one scale, so the resource that runs out first stands out. From 80% a row turns gold and is marked "Running low", and from 95% red and "Nearly full", with an icon and a screen-reader label so color is not the only signal. The share is rounded down, so 100% shows only when nothing is left, and it can pass 100% (the bar cannot) when pods request more than the nodes offer. A note under the rows says that allocated means requested, not used, and that available is summed across nodes.

The card polls every 30 seconds rather than the table's 5, since capacity only moves when units start or stop and the backend lists every pod in the cluster to answer. A refresh button fetches at once and restarts the 30 seconds, so a click is not followed by a second cluster-wide listing seconds later. On a deployment without Kubernetes units the endpoint answers 404, so the card never shows and the poll ends. Any other failure shows the cluster's own message (a missing read grant reads "nodes is forbidden: ..."), and a failed refresh keeps the last numbers under a warning, as the table does. A resource the cluster has none of, usually GPU, reads "None in the cluster", and a missing, non-numeric or negative figure reads "Not reported" without taking the other rows down. When the card is narrower than the table needs, which the sidebar decides rather than the window, the rows stack into one labelled line per figure.

Before:  admin sees a unit stuck Pending -> kubectl describe nodes -> adds up the requests by hand
After:   admin sees a unit stuck Pending -> Admin > Computing Units -> CPU 82% Running low, GPU 100% Nearly full

Not included. Telling the owner when an admin terminates their unit (#6483). The card shows what the endpoint reports, so the endpoint's limits carry over: available is an upper bound summed across nodes, so free capacity spread over several nodes can still refuse a unit that needs one node's worth, and a tainted node (say an RKE2 server reserved for control-plane pods) still counts although no unit can be scheduled there. Like the units table, the card keeps polling while the browser tab is hidden.

Any related issues, documentation, discussions?

Closes #6482. Part of #6476.

Reads the endpoint added in #8986, on the page added in #8888.

How was this PR tested?

Before
before-1440

After
after-1440

Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Code, Claude Opus 5.5

@github-actions github-actions Bot added feature frontend Changes related to the frontend GUI labels Oct 25, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Automated Reviewer Suggestions

Based on the git blame history of the changed files, we recommend the following reviewers:

  • Contributors with relevant context: @eugenegujing
    You can notify them by mentioning @eugenegujing in a comment.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.82%. Comparing base (fdd860d) to head (0d772da).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #9135      +/-   ##
============================================
+ Coverage     91.80%   91.82%   +0.01%     
  Complexity     5066     5066              
============================================
  Files          1270     1272       +2     
  Lines         55193    55301     +108     
  Branches       6987     6994       +7     
============================================
+ Hits          50672    50782     +110     
  Misses         2800     2800              
+ Partials       1721     1719       -2     
Flag Coverage Δ *Carryforward flag
access-control-service 77.44% <ø> (ø) Carriedforward from 0f04748
agent-service 99.16% <ø> (ø) Carriedforward from 0f04748
amber 85.96% <ø> (ø) Carriedforward from 0f04748
computing-unit-managing-service 61.84% <ø> (ø) Carriedforward from 0f04748
config-service 87.50% <ø> (ø) Carriedforward from 0f04748
file-service 81.92% <ø> (ø) Carriedforward from 0f04748
frontend 96.51% <100.00%> (+0.02%) ⬆️
notebook-migration-service 83.77% <ø> (ø) Carriedforward from 0f04748
pyamber 98.54% <ø> (ø) Carriedforward from 0f04748
workflow-compiling-service 72.61% <ø> (ø) Carriedforward from 0f04748

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@kunwp1

kunwp1 commented Oct 25, 2026

Copy link
Copy Markdown
Contributor Author

/request-review @aicam

@github-actions
github-actions Bot requested a review from aicam October 25, 2026 20:46
@chenlica

Copy link
Copy Markdown
Contributor

@sshiv012 Please review it as well.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature frontend Changes related to the frontend GUI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Admin CUs: cluster resource overview panel

3 participants