Repository navigation
Connect certificates to cached issuers - #1979
Conversation
PR Summary by QodoConnect certificates to observed cert-manager issuers
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 3b78585. Configure here.
…ationships (#1978) Radar's relationship view treated every `uses` edge in the graph that wasn't storage as autoscaling. A Certificate that uses its Issuer would be shown with the Issuer as its **Scale Target**, and the Issuer would list the Certificate as its **Autoscaler**, in the drawer, the REST resource details and the MCP resource context given to AI tools. This separates real autoscalers from other dependencies, so those surfaces say "depends on" when something isn't scaling. Nothing changes visibly on today's `main`: no edge there is misclassified yet. The edges this fixes arrive in follow-up PRs (Certificate → Issuer in #1979, KEDA → TriggerAuthentication in #1987), which build on this projection. ## What changed **Classification of `uses` edges** (`pkg/topology/relationships.go`). Each edge is put into exactly one group: | Edge source | Group | |---|---| | core `PersistentVolumeClaim` | storage (`storageRefs` / `consumers`), as before | | `HorizontalPodAutoscaler` (`autoscaling`), `VerticalPodAutoscaler` (`autoscaling.k8s.io`), `ScaledObject` / `ScaledJob` (`keda.sh`), same namespace | autoscaling (`scaleTarget` / `scalers`), as before | | anything else | **new** `dependencies` / `dependents` | - Matching uses the exact API group, so a custom resource that happens to be named `ScaledObject` or `PersistentVolumeClaim` is no longer treated as one. - A KEDA scaler's TriggerAuthentication is a dependency, not its scale target, so it can't displace the workload the scaler actually scales. **New fields, additive.** `Relationships` and `resourceContext` gain `dependencies` and `dependents`. In resource context they're filtered by the caller's permission to read each target, and dropped ones are reported in the existing omission reasons. `docs/mcp.md` describes how they differ from `scaledBy`. **UI.** The Related Resources section shows them as **Depends On** and **Required By**, with the same badges, navigation and limits as its other groups. **Radar Hub compatibility.** Hub embeds a versioned UI that doesn't know the new fields. Issuer and KEDA-authentication dependencies are therefore also reported in the existing `configRefs` / `consumers` (Configuration / Used By), so Hub keeps working links. The new UI hides those mirrored entries, so each target appears once. **De-duplication.** Reference de-duplication across these groups uses the existing group-aware key from Checks (`resource-refs.ts`), so same-named resources from different API groups stay distinct. `configRefs` lists each target once on every path. Each list is de-duplicated once after it is collected, so a PVC shared by thousands of workloads stays linear rather than rescanning the list per consumer. No new endpoint, permission, graph edge type, or SSE/neighborhood change. ## Result on a live cluster To show the fix, both builds include #1979's Certificate → Issuer edges on top of `main`. "Before" uses `main`'s version of the projection, "after" uses this PR's. Real cert-manager resources:   On `main` alone, this branch (merged with `main`) returned relationships identical to `main` for all 79 resources on the test cluster, including HPA, VPA, KEDA and PVC fixtures. ## Testing - Graph fixtures cover Certificate/Issuer direction, KEDA target plus authentication, PVC consumers, exact-group collisions, one configuration target reached by two edges, each autoscaler kind accepted only in its own group and namespace, and a claim shared by 20,000 Jobs plus a duplicate edge (each consumer listed once). - Context tests cover target authorization and omission reasons. Rendered-component tests cover dependency-only responses, the directional labels, exact-group navigation and the mirrored projections. Existing Checks identity tests confirm unchanged keys. - `go test` for `pkg/topology`, `pkg/resourcecontext`, `internal/server` and `internal/mcp`; `make tsc`; the affected shared UI suites (22 tests). - Live: the comparisons above, on a kind cluster. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…ling (#2048) Topology's `uses` edges no longer mean only "autoscales". They also draw mounted claims and declared dependencies, such as Certificate → Issuer, Kustomization → its source, and Gateway → GatewayClass. Two places in the UI still read every `uses` edge as autoscaling: the graph legend, and the timeline's lane nesting. ## What changed **Timeline nesting.** The timeline made the target of every `uses` edge its source's parent lane. That's right for an autoscaler or a mounted claim, which sit under the workload they serve. For a dependency it files every dependent under one shared lane: every Certificate under its ClusterIssuer, and Gateways from different namespaces under one GatewayClass. Only HorizontalPodAutoscalers, VerticalPodAutoscalers, KEDA ScaledObjects and ScaledJobs, and PersistentVolumeClaims, matched on exact API group, now nest under their target. **Graph legend.** - Pink edges were labelled "scales"; they now read "uses". - Gray `manages` edges were labelled "owns", though they also draw GitOps inventory; they now read "manages". - Policy and disruption-budget (`protects`) edges had no color of their own and rendered in that same gray. They're now violet, with their own legend entry. ## Testing - A timeline test with an HPA → Deployment edge and a Certificate → Issuer edge. The autoscaler nests, the dependency doesn't. It fails with the old rule. - Topology component tests, `make tsc`, and the shared UI and web suites pass. ## Notes The open dependency PRs (#1979, #1986, #1989, #1993) add `uses` edges from dependents to their dependencies. This PR makes the legend and timeline correct for them, so it should land before or with them.
Resolve declared certificate issuers from cached exact identities so ownerless issuers and seeded resources keep their dependency and ownership links.
Resolve declared certificate issuers from cached exact identities so ownerless issuers and seeded resources keep their dependency and ownership links.
5a684b7 to
3958943
Compare

Certificates can reference a working Issuer or ClusterIssuer that has no owner-connected topology node. Join built-in issuer references to exact cached objects so the existing Depends On / Required By views and REST/MCP context can navigate the issuance dependency.
The resolver applies cert-manager's omitted-kind/group defaults, lists each target kind once and materializes only observed referenced issuers. Missing targets and same-name objects in another namespace or API group do not create links. ClusterIssuer nodes carry their exact cluster authorization tuple, and already-seeded issuers retain their metadata owner without duplicate nodes or edges. No new endpoint or permission grant is introduced.
Validation: the complete Go, type-check and frontend matrix passes at the final head. A fresh embedded build and live main/PR REST/MCP comparisons with cert-manager 1.20.2 verify both issuer directions, missing-target rejection and preservation of the Issuer's Deployment owner. Browser captures of both drawers are below.
A cold target kind may initialize an informer; the resolver performs no per-certificate object Gets. External issuer groups remain out of scope.