The GitHub Actions job "Required Checks" on texera.git/main has failed.
Run started by GitHub user github-merge-queue[bot] (triggered by 
github-merge-queue[bot]).

Head commit for run:
2ba75f482b4218b4a1ce0432292355c540cbb2b8 / Kunwoo (Chris) 
<[email protected]>
feat(frontend): add admin cluster capacity panel (#9135)

### 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
<img width="2880" height="1800" alt="before-1440"
src="https://github.com/user-attachments/assets/4fadf670-2470-4ac7-a028-b4f5f37f27db";
/>

After
<img width="2880" height="1800" alt="after-1440"
src="https://github.com/user-attachments/assets/e8240430-e366-440d-8c3e-066ded7276b8";
/>

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

Generated-by: Claude Code, Claude Opus 5.5

Report URL: https://github.com/apache/texera/actions/runs/40411028530

With regards,
GitHub Actions via GitBox

Reply via email to