Skip to content

feat(status): public node and tenant usage at /status - #37

Merged
zyx1121 merged 2 commits into
mainfrom
feat/public-status
Oct 13, 2026
Merged

zyx1121 merged 2 commits into
mainfrom
feat/public-status

Conversation

@zyx1121

@zyx1121 zyx1121 commented Oct 13, 2026

Copy link
Copy Markdown
Member

Why

The carrel.winlab.tw page should show the cluster's hardware state and who uses how much, without signing in.

What

  • GET /status (new, unauthenticated, GET only):
    • node: logical CPUs and utilization, memory and disk total/used (GiB), from the same cached inventory as capacity_get.
    • allocated: Carrel's admission limits and commitments (capacity_get.allocatable).
    • tenants: for each tenant with machines, name (slug), machines, vcpu, memory_gib, disk_gib, sorted by vCPU.
    • No machine names, IPs, MACs, tokens, domains or keys.
  • Cached 15 s in the handler (one inventory call per window at most), Cache-Control: public, max-age=15.
  • scripts/edge-agent.py: /status joins CONTROL_PATHS so the edge sends it to the control plane.

Verified

  • go test -race ./internal/carrel/ and go vet pass on sandbox; new tests check the tenant share, that machine details do not leak, that a second load is served from cache, and that POST is 405.
  • pytest tests/test_edge_agent.py: 7 passed.

🤖 Generated with Claude Code

carrel.winlab.tw shows how busy the cluster is and who uses how much.
GET /status returns the node's physical use, Carrel's allocations and each
tenant's machine count, vCPU, RAM and disk, by slug only. Responses are
cached for 15 seconds so the public endpoint cannot drive inventory calls.
The edge sends /status to the control plane.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…om cancelling inventory

- A tenant is named only when it is active and serves a ready domain, so its
  slug is already public; all other tenants are summed into "others".
- The inventory fetch runs on a context visitors cannot cancel, with a 10 s
  timeout, so a disconnect cannot fail members' capacity_get.
- Failures are cached for 5 s.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@zyx1121
zyx1121 merged commit 84ca97f into main Oct 13, 2026
2 checks passed
@zyx1121
zyx1121 deleted the feat/public-status branch October 13, 2026 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant