Repository navigation
Connect KEDA scalers to observed authentication dependencies - #1987
Conversation
PR Summary by QodoShow observed KEDA authentication resources as scaler dependencies
AI Description
Diagram
High-Level Assessment
Files changed (5)
|
Code Review by Qodo
1.
|
âĶ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>
f2fec1a to
8e21e7f
Compare
5b8ad1e to
f1e10bd
Compare
479d7ec to
ea71bbe
Compare
A refactor with no behavior change: certificate â issuer links are identical before and after. It moves cached observed-dependency materialization into one shared helper, so the identity, scope and deduplication rules have one implementation. The KEDA (#1987) and Flux (#1989) dependency PRs are built on it; it exists so those two don't carry separate copies of the same logic. Controller-specific parsers supply exact source/target references and retain their own defaults and valid-kind rules. The common helper groups target reads by group/kind, lists each kind once, reuses existing node identities and adds only observed referenced targets. Missing sources or targets and repeated passes cannot fabricate or duplicate relationships. Exact cluster authorization metadata stays attached to materialized nodes. Validation: the complete Go, type-check and frontend matrix passes at the final head. Fresh live REST/MCP checks preserve both issuer dependency directions and the Issuer's metadata owner. Unit cases cover lookup fanout, missing/reused targets, scope/group collisions, absent sources and repeated-pass deduplication. Visual testing is skipped because this backend refactor changes no rendered surface. No new endpoint, renderer or mandatory provider interface is added. Cached reads are distinct from startup discovery and informer traffic.
Expose observed trigger authentication separately from scaled workloads while preserving exact scope and configuration flow.
Expose observed trigger authentication separately from scaled workloads while preserving exact scope and configuration flow.
ScaledJob application rows can contain authentication dependencies that the caller cannot read. Filter those references with exact KEDA read permissions on a copied response, and derive counts and the capped list from the visible references without modifying the shared cache. Cover mixed permissions, truncation, cache reuse and local mode, and document the Applications behavior.
ea71bbe to
f72ee63
Compare
Connect KEDA ScaledObject and ScaledJob authentication references to observed TriggerAuthentication and ClusterTriggerAuthentication resources. Operators can navigate from a scaler to its authentication configuration and find the scalers that consume it without manually joining YAML names.
Omitted authentication kind resolves to a same-namespace TriggerAuthentication. Explicit cluster authentication receives its exact cluster read tuple. Authentication configuration points into the scaler with EdgeConfigures; scaler-to-workload usage remains a separate EdgeUses relationship. Missing or invalid targets are not fabricated, and credential references are not traversed.
Applications ScaledJob configuration references and counts exclude authentication objects the caller cannot read. The request projection uses exact KEDA read permissions and copies affected rows before deriving counts and the capped list, preserving the shared cache for other callers. Broader authorization of pre-existing Applications relationship categories remains a separate change.
Validation: Go build, complete shared/internal Go suites, type-check, shared UI and web tests, and the embedded application build pass. Regression coverage includes mixed authentication permissions, counts above the 20-reference display cap, cache reuse and local mode. Real KEDA 2.21.0 runs cover 12 ScaledObject/ScaledJob à namespaced/cluster authentication à Secret/env/podIdentity combinations on REST, MCP and topology. All scalers reconcile Ready; the Secret/env fixture endpoint enforces its dummy bearer token. Restricted-user checks verify direct cluster authentication denial and omission from relationship projections and Applications. Test objects and the complete KEDA installation are removed and absence verified.
Pod identity proof covers accepted AWS provider declarations and relationship navigation against a local fixture endpoint, not a cloud credential exchange. Declared authentication dependencies do not establish credential validity or trigger readiness.