Skip to content

fix(GPTEINFRA-18856): Admin Ops all-workshops mode fires request storm - #4009

Merged
aleixhub merged 3 commits into
mainfrom
fix/ops-platform-mode-request-storm
Nov 20, 2026
Merged

aleixhub merged 3 commits into
mainfrom
fix/ops-platform-mode-request-storm

Conversation

@bbethell-1

Copy link
Copy Markdown
Contributor

Problem

Clicking All Workshops (platform mode) in Admin Ops produces a wall of browser errors:

ERR_CERT_VERIFIER_CHANGED  — workshopprovisions API calls
TypeError: Failed to fetch  — SWR monitor layer
502                         — /api/whats-new (secondary, unrelated)

Root cause: Platform mode fetches all workshops in one cluster-scoped call (100–500 results), then built one URL per workshop for provisions, assignments, and resource claims, firing them all via Promise.all() with no throttling. This creates 300–1500 simultaneous HTTP requests to the OCP API server, exhausting the browser's connection pool and causing ERR_CERT_VERIFIER_CHANGED mid-flight.

Fix

In platform mode, replace the three per-workshop fetch fans with single cluster-scoped requests — the same pattern already used for workshops and multiworkshops. Results are grouped client-side by namespace/workshopName from their babylon.gpte.redhat.com/workshop label. Per-namespace mode is completely unchanged.

api.ts — WORKSHOP_PROVISIONS and WORKSHOP_USER_ASSIGNMENTS: made namespace and workshopName optional to support cluster-scoped queries. All existing callers still pass both args; no behaviour change for them.

Admin/Ops.tsx — in platform mode: use three cluster-wide SWR fetches (provisions, assignments, resource claims) instead of N×3 per-workshop fetches.

Result: 300–1500 concurrent requests → 3 requests when All Workshops is active.

Test plan

  • Open Admin Ops in a namespace — per-namespace mode works normally (provisions/assignments load per workshop)
  • Click All Workshops — no ERR_CERT_VERIFIER_CHANGED or Failed to fetch errors in DevTools network tab
  • Provision counts, seat assignments, and status badges render correctly across all workshops
  • Refresh button re-fetches correctly in both modes

… all-workshops view

When platform mode is enabled, workshops are fetched in a single cluster-scoped call
(potentially 100-500 results). The previous code then built per-workshop keys for
provisions, assignments, and resource claims, firing them all with Promise.all() —
300-1500 concurrent requests with no throttling. This exhausted the browser connection
pool and triggered ERR_CERT_VERIFIER_CHANGED on the workshopprovisions calls.

Replace the per-workshop fetch fans with single cluster-scoped requests in platform
mode (the same pattern already used for workshops/multiworkshops). Results are grouped
client-side from the babylon.gpte.redhat.com/workshop label. Per-namespace mode is
unchanged.
@bbethell-1
bbethell-1 requested a review from aleixhub November 20, 2026 11:18

@aleixhub aleixhub left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for this. Switching platform mode to 3 cluster-scoped requests is the right fix for the request storm, and per-namespace mode looks unchanged. I left a few inline comments. The redeploy await regression is the main one I'd like fixed before merge, and the 5000 limit should at least be acknowledged.

@@ -1833,7 +1902,7 @@ const Ops: React.FC = () => {

// Refresh provisions and resource claims
await mutateProvisions();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Regression: mutateProvisions / mutateResourceClaims are now useCallback wrappers that don't return anything, so await mutateProvisions() returns immediately. Before, this awaited the SWR mutate promise. As a result, setRedeployLoading(false) runs before the refresh completes.

Suggest returning the promise from each wrapper:

const mutateProvisions = useCallback(
  () => (platformMode ? mutatePlatformProv() : mutatePerWsProv()),
  [platformMode, mutatePlatformProv, mutatePerWsProv],
);

(The same applies to mutateAssignments and mutateResourceClaims.)

Comment thread catalog/ui/src/app/Admin/Ops.tsx Outdated
})),
[workshops],
const { data: platformRcData, mutate: mutatePlatformRc } = useSWR<ResourceClaimList>(
platformMode ? apiPaths.RESOURCE_CLAIMS({ labelSelector: `${BABYLON_DOMAIN}/workshop`, limit: 5000 }) : null,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Two concerns with the cluster-wide fetches (this one in particular, but provisions/assignments too):

  1. Results are cut off silently at 5000. metadata.continue is never followed, so with ~500 workshops and ~10+ claims each, some workshops would show missing or incorrect status with no error. Could we paginate, or at least warn when metadata.continue is set?
  2. Payload size. ResourceClaims have a large status block, so up to 5000 of them refetched every 30s could be tens of MB per response. Worth checking the real size against a production-sized cluster.

Comment thread catalog/ui/src/app/api.ts Outdated
}: {
workshopName: string;
namespace: string;
workshopName?: string;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is needed for the cluster-scoped query, and it matches the WORKSHOPS / MULTIWORKSHOPS pattern. The downside is that it removes a compile-time check: if a caller passes namespace but forgets workshopName, it quietly gets every provision in the namespace instead of a type error.

Would you consider either a separate cluster-wide helper (e.g. ALL_WORKSHOP_PROVISIONS({ limit, continueId })) that leaves this signature strict, or a generic labelSelector? param like RESOURCE_CLAIMS? The same goes for WORKSHOP_USER_ASSIGNMENTS.

Nit: with no workshopName, the URL becomes ...workshopprovisions?&limit=5000. Harmless, since WORKSHOPS does the same.

Comment thread catalog/ui/src/app/Admin/Ops.tsx Outdated
const provisionsByWorkshop = useMemo(() => {
const map = new Map<string, WorkshopProvision[]>();
if (allProvData) {
if (platformMode) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nit: this group-by-namespace/workshop-label loop is repeated three times (provisions, assignments, resource claims). A small generic helper like groupByWorkshopLabel<T extends K8sObject>(items: T[]): Map<string, T[]> would remove the duplication.

…tches

- Return the SWR mutate promise from mutateProvisions/mutateAssignments/
  mutateResourceClaims so awaiting callers (redeploy) wait for the refresh
- Paginate cluster-wide provisions, assignments and resource claims with
  fetcherItemsInAllPages instead of a single limit=5000 request, so large
  clusters are not silently truncated
- Keep WORKSHOP_PROVISIONS / WORKSHOP_USER_ASSIGNMENTS strictly typed and
  add dedicated WORKSHOP_PROVISIONS_ALL / WORKSHOP_USER_ASSIGNMENTS_ALL
  cluster-scoped helpers
- Extract groupByWorkshopLabel / groupPerWorkshopResults helpers to remove
  the duplicated grouping loops

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@aleixhub
aleixhub merged commit 4733948 into main Nov 20, 2026
20 checks passed
@aleixhub
aleixhub deleted the fix/ops-platform-mode-request-storm branch November 20, 2026 12:46
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.

2 participants