Repository navigation
fix(components): propagate Component spec.dependencies to CMS dependency graph - #989
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a structured dependencies field to the ComponentSpec protobuf message and integrates it across the components subsystem. It updates the GitOps bridge to parse, canonicalize, and deduplicate dependencies from unstructured resources while dropping self-dependencies. Additionally, it implements dependency name validation in the CMS server, updates the dependency extraction logic, supports the new field in field masks, and improves error reporting for unregistered dependencies by replacing ErrDependencyNotFound with a detailed FailedPrecondition error. Comprehensive unit tests and documentation updates have been added to support these changes. There are no review comments, so I have no feedback to provide.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces support for a structured dependencies field in the ComponentSpec protobuf and Component Custom Resource (CR). It updates the GitOps bridge reconciler to parse, canonicalize, and deduplicate these dependencies while dropping self-dependencies. Additionally, it enhances validation in the CMS server to reject invalid dependency names and self-references, integrates the new field into the dependency extraction and field mask logic, and improves error reporting when dependencies are not registered by replacing the generic ErrDependencyNotFound with a descriptive FailedPrecondition error. Comprehensive unit tests have been added across the reconciler, server, and store packages to verify these changes. There are no review comments, so we have no additional feedback to provide.
63c513b to
0a7ba2c
Compare
…ncy graph The Component CRD declares spec.dependencies and 1P blueprints set it (e.g. ingestion-gateway -> redpanda), but the bridge dropped the field and ComponentSpec had no way to carry it. CMS cycle detection, deactivation safety, and deletion safety therefore never saw CR-declared dependencies. - Add `repeated string dependencies = 10` to ComponentSpec. - Bridge: parse spec.dependencies (canonicalized, deduped, ignoring empty/non-string entries) in ParseSpecFromUnstructured. - Store: ExtractDependencies merges spec.dependencies with manifest, description, and label sources; support the "dependencies" update mask path. - CMS: reject invalid dependency names with InvalidArgument instead of silently dropping them. - Spanner: name the missing dependency in the FailedPrecondition error. BUG=b/548435582 TAG=agy
…NotFound Address review feedback on spec.dependencies propagation: - Bridge: ReconcileComponent drops self-references from spec.dependencies (with a warning) so a component can never wait on itself once dependency readiness gating lands. - CMS: SetComponentIntent rejects self-dependencies with InvalidArgument (defense in depth; the store would otherwise report a FailedPrecondition self-cycle). - Store: remove the now-unused ErrDependencyNotFound sentinel; the Spanner path returns a FailedPrecondition naming the missing dependency instead. - Docs: note that MemoryStore (dev/test) does not reject unregistered dependencies whereas SpannerStore does, and document the rollout ordering interaction: on Spanner, reconciling a dependent (e.g. ingestion-gateway) before its dependency (redpanda) is registered yields FailedPrecondition "dependency not found" and an IntentApplicationFailed condition until retried. Explicit readiness gating before SetComponentIntent is left to the follow-up PR. BUG=b/548435582 TAG=agy
…red dependencies Clients need a stable way to recognize the FailedPrecondition returned when a component declares a dependency that is not registered yet. The GitOps bridge treats it as "waiting on dependencies" (gated, no error) instead of IntentApplicationFailed. The message text is unchanged. BUG=b/548435582 TAG=agy
…ize self-dependency check parseDependencies now passes strings with an empty canonical name through verbatim so CMS validateDependencyNames rejects them with InvalidArgument instead of the bridge silently dropping a dependency edge. dropSelfDependency canonicalizes entries before comparing, so direct ReconcileComponent callers passing components/<self> behave like Reconcile. Comment link: #989 (comment) Comment link: #989 (comment) BUG=b/548435582 TAG=agy CONV=baca6192-74d3-4579-9f73-0a3263d9a2a7
3b352fd to
b861a3d
Compare
The bridge canonicalizes only in parseDependencies, so dropSelfDependency now compares canonical names directly. CMS replaces validateDependencyNames with canonicalDependencies, which validates, dedupes and writes the canonical list back into the persisted spec instead of discarding it. Store NormalizeDependencies remains the merger of all dependency sources. Comment link: #989 (comment) BUG=b/548435582 TAG=agy CONV=baca6192-74d3-4579-9f73-0a3263d9a2a7
Summary
The Component CR's
spec.dependenciesnow reaches the CMS dependency graph. As a result, cycle detection, deactivation safety and deletion safety all apply to dependencies declared on the CR. Self-dependencies are rejected.Stack 1/4: this PR → 1P health (B) → dependency-gated actuation (C1) → dependency-gated deactivation (C2).
Motivation & Context
The CRD declares
spec.dependencies, and 1P blueprints set it (e.g.ingestion-gateway→redpanda), but the value was dropped along the way:ParseSpecFromUnstructuredignored it;ComponentSpechad no field for it;So CMS allowed disabling or deleting
redpandawhileingestion-gatewaydepended on it.Key Changes
ComponentSpec.dependencies = 10(repeated string). Go code is generated by Bazel, so there are no checked-in.pb.gofiles.parseDependenciescanonicalizes and dedupes entries and drops malformed ones.dropSelfDependencyremoves self-references before sending the intent.ExtractDependenciesmergesspec.dependencieswith directive- and manifest-derived dependencies.ApplySpecUpdateMasksupports adependenciespath.resolveDependencyIDsnames the missing dependency, using the exportedDependencyNotFoundMessagePrefix. The deadErrDependencyNotFoundis removed.SetComponentIntentreturnsInvalidArgumentfor dependency names that aren't DNS-1123, and for self-dependencies.MemoryStoredoes not.ComponentDependenciestable is reused.Assumptions
FailedPrecondition "dependency not found: …". — The bridge gating PR (C1) treats this as "waiting" instead of an error. — If this PR lands without C1, fresh installs briefly showIntentApplicationFaileduntil the dependency registers.Delete/Unspecifiedpolicy still cascades to dependents rather than blocking. — This is existing store semantics and is unchanged.Verification & Testing
bazel test //pkg/components/... //cmd/xmc_bridge/... //api/... //cmd/experiment_state_server/... //cmd/health_service/...(all pass),./.githooks/pre-commit(pass).Orphandeletion block and cycle rejection, usingspec.dependenciesonly;resolveDependencyIDs;...): with the gateway running,kubectl patch component redpanda … enabled=falsewas blocked:Cannot disable "redpanda": component redpanda has active dependents: [ingestion-gateway]. Full evidence is in the C2 PR.Related Issues / Bugs
Found while working on bug 548435582.
TAG=agy
CONV=baca6192-74d3-4579-9f73-0a3263d9a2a7