Skip to content

fix: show usage against ∞ when a workspace has no resource quota - #634

Open
terrywu510 wants to merge 1 commit into
mainfrom
fix/overview-quota-usage-empty-when-unlimit
Open

fix: show usage against ∞ when a workspace has no resource quota#634
terrywu510 wants to merge 1 commit into
mainfrom
fix/overview-quota-usage-empty-when-unlimit

Conversation

@terrywu510

Copy link
Copy Markdown
Contributor

Problem

On Overview → Quota usage, the CPU / RAM / GPU Memory gauges take both their
numerator and denominator from kube_resourcequota. When a workspace is set to
Unlimited, the Workspace CR carries no spec.resourceQuota.hard, so no
ResourceQuota is created for the namespace and the whole metric family is absent
— the used counter as well as hard. All three cards therefore rendered
"No data" and the tile appeared empty.

Change

  • [cluster]/[workspace]/+layout.server.ts already fetches the Workspace to
    resolve spec.namespace; it now also returns quotaUnlimited
    (spec.resourceQuota.hard === undefined) — the same definition the workspace
    create/update forms use for their "Unlimited" checkbox. The flag is threaded
    through the overview page and the dashboard shell to the quota tile only.
  • When unlimited, the tile queries pod-level usage instead of the quota:
    sum(kube_pod_container_resource_{requests,limits}{namespace,resource,unit} <LIVE_PODS>),
    reusing the existing LIVE_PODS helper (Pending|Running) so the numerator
    matches what a ResourceQuota would have counted, and stays consistent with the
    cluster analytics namespace commitment panels. GPU Memory already derived its
    numerator from pod containers, so that query is unchanged. The six
    kube_resourcequota queries are skipped entirely in this mode.
  • Rendering: the arc keeps its shape with an empty track, the percentage is
    replaced by , the sub-label reads <current usage> / ∞, and the hard total
    in each card header shows . A failed usage query still falls back to the
    usual "No data" state.
  • Workspaces with a quota keep their existing queries, conditions and layout
    unchanged. A resource that individually omits its hard entry also keeps
    today's behavior (GPU Memory still shows 0 / 0) — only a wholly unlimited
    workspace switches to the ∞ presentation.

Verification

  • pnpm check (svelte-check): 0 errors, 0 warnings
  • eslint / prettier: clean
  • Manually verified in the dashboard against both an unlimited workspace and a
    workspace with a quota, on the Requests and Limits views.

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