Repository navigation
Report dependencies as dependencies, not autoscaling, in resource relationships - #1978
Conversation
PR Summary by QodoSeparate dependency references from autoscaling relationships
AI Description
Diagram
High-Level Assessment
Files changed (11)
|
Code Review by Qodo
1.
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
âĶdependency-projection
A PVC shared by many workloads made the per-append duplicate scan quadratic.
Radar's relationship view treated every
usesedge 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
usesedges (pkg/topology/relationships.go). Each edge is put into exactly one group:PersistentVolumeClaimstorageRefs/consumers), as beforeHorizontalPodAutoscaler(autoscaling),VerticalPodAutoscaler(autoscaling.k8s.io),ScaledObject/ScaledJob(keda.sh), same namespacescaleTarget/scalers), as beforedependencies/dependentsScaledObjectorPersistentVolumeClaimis no longer treated as one.New fields, additive.
RelationshipsandresourceContextgaindependenciesanddependents. 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.mddescribes how they differ fromscaledBy.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.configRefslists 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" usesmain's version of the projection, "after" uses this PR's. Real cert-manager resources:On
mainalone, this branch (merged withmain) returned relationships identical tomainfor all 79 resources on the test cluster, including HPA, VPA, KEDA and PVC fixtures.Testing
go testforpkg/topology,pkg/resourcecontext,internal/serverandinternal/mcp;make tsc; the affected shared UI suites (22 tests).ðĪ Generated with Claude Code