Repository navigation
Link discovered custom-resource instances to their CRD definitions - #2013
nadaverell wants to merge 3 commits into
Conversation
PR Summary by QodoLink custom-resource instances to their CRD definitions
AI Description
Diagram
High-Level Assessment
Files changed (4)
|
Code Review by Qodo
1.
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit af34411. Configure here.

A custom-resource instance should let you inspect its actual definition, including irregular plurals and colliding Kinds. Add a Definition link to the existing metadata section, using confirmed definition identity from the current cluster rather than guessing plural.group or trusting the broader isCrd category flag.
The existing discovery endpoint now supplies optional definitionName only when the definition is observed in watched CRD inventory and the caller passes the existing CRD list permission. This reuses the cached CRD GVR and performs one inventory scan, without per-resource live GETs, new watches or permission grants. Aggregated APIs and native groups stay unlinked. A context switch during assembly yields a retryable response.
Centralize discovery-driven navigation initialization in useAPIResources. Clear maps on failed/unavailable discovery, reset on a cluster switch and cancel pending old requests; the discovery fetch honors AbortSignal. The hook also owns the existing known GitOps identity catalog, replacing the competing view effect; actual discovery identities take precedence. Static seeds are navigation declarations and cannot manufacture CRD definition links. The drawer callback remains the existing exact ResourceRef contract. Reverse CRD instance listings, graph/context/diagnose expansion and new integration collection are separate surfaces.
Validation: 42 shared focused cases, 22 focused host cases, full host suite (1866 passed), shared UI suite (4152 passed, one skipped), make tsc, complete make build and full root make test. HTTP regression tests cover readable versus denied CRD inventory, aggregated metrics/native resources, and zero hot object reads. Hook tests cover failed refresh, recovery and canceled old discovery. On the final binary, a cold Widget drawer opens its actual cluster-scoped CRD with NamesAccepted; discovery confirms that CRD and excludes real native APIService/DRA definitions. One final-head capture was inspected; the attachment shows the same metadata layout. Focused self/product review complete; independent review deferred per request.
Note
Medium Risk
Touches the discovery API contract and cluster-switch cache/navigation lifecycle, but definition links are gated on existing CRD list RBAC and cached inventory only.
Overview
Adds confirmed CRD definition navigation from custom resource instances: the metadata drawer can show a Definition link that opens the cluster-scoped
CustomResourceDefinition, using server-supplied identity instead of inferring fromisCrdor English plurals.The
/api/api-resourcesresponse gains optionaldefinitionName, filled only when the caller can list CRDs and the definition appears in already-watched CRD inventory (one cache scan, no per-kind live reads). Aggregated or native “CRD-like” APIs stay unlinked. If discovery/cache identity changes while building the response, the handler returns 503 retry.On the web app,
useAPIResourcesownsinitNavigationMap: discovery fetch honorsAbortSignal, maps reset on failed refresh, andresetNavigationMapplus query cancel runs on cluster context switch. GitOps kind seeds move into the hook as navigation-only entries that cannot fabricate definition links.customResourceDefinitionRefand draweronNavigatewire the new metadata link.Reviewed by Cursor Bugbot for commit f88ca77. Bugbot is set up for automated code reviews on this repo. Configure here.