Repository navigation
fix(GPTEINFRA-18856): Admin Ops all-workshops mode fires request storm - #4009
Conversation
… 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.
aleixhub
left a comment
There was a problem hiding this comment.
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(); | |||
There was a problem hiding this comment.
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.)
| })), | ||
| [workshops], | ||
| const { data: platformRcData, mutate: mutatePlatformRc } = useSWR<ResourceClaimList>( | ||
| platformMode ? apiPaths.RESOURCE_CLAIMS({ labelSelector: `${BABYLON_DOMAIN}/workshop`, limit: 5000 }) : null, |
There was a problem hiding this comment.
Two concerns with the cluster-wide fetches (this one in particular, but provisions/assignments too):
- Results are cut off silently at 5000.
metadata.continueis 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 whenmetadata.continueis set? - Payload size. ResourceClaims have a large
statusblock, 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.
| }: { | ||
| workshopName: string; | ||
| namespace: string; | ||
| workshopName?: string; |
There was a problem hiding this comment.
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.
| const provisionsByWorkshop = useMemo(() => { | ||
| const map = new Map<string, WorkshopProvision[]>(); | ||
| if (allProvData) { | ||
| if (platformMode) { |
There was a problem hiding this comment.
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>
Problem
Clicking All Workshops (platform mode) in Admin Ops produces a wall of browser errors:
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 causingERR_CERT_VERIFIER_CHANGEDmid-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/workshopNamefrom theirbabylon.gpte.redhat.com/workshoplabel. Per-namespace mode is completely unchanged.api.ts—WORKSHOP_PROVISIONSandWORKSHOP_USER_ASSIGNMENTS: madenamespaceandworkshopNameoptional 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
ERR_CERT_VERIFIER_CHANGEDorFailed to fetcherrors in DevTools network tab