8000 fix(components): separate Synced condition from Ready on CMS errors by VLukiantsev · Pull Request #1227 · google/xmc · GitHub
[go: up one dir, main page]

Skip to content

fix(components): separate Synced condition from Ready on CMS errors - #1227

Merged
VLukiantsev merged 6 commits into
fix/components-finalizer-first-b548436300from
fix/components-synced-condition-b548436300
Oct 16, 2026
Merged

VLukiantsev merged 6 commits into
fix/components-finalizer-first-b548436300from
fix/components-synced-condition-b548436300

Conversation

@VLukiantsev
@VLukiantsev VLukiantsev commented Oct 13, 2026 •
Copy link
Copy Markdown
Collaborator

Summary

Adds a Synced condition that reports control-plane sync with CMS separately from data-plane readiness. A transient CMS error now sets Synced=False/CMSSyncFailed and keeps status.access. Workloads that are already running keep being health-probed, so Ready follows the latest local probe instead of flipping to False.

Motivation & Context

A CMS outage used to flip healthy Components to Ready=False and drop status.access, which blocks experiment placement even though the workloads are fine.

Key Changes

  • New Synced condition (CMSSynced / CMSSyncFailed) and a Synced printer column in the CRD.
  • recordCMSSyncFailure keeps status.access when a CMS RPC fails. It reads the old value back via ParseAccessFromUnstructured into the new ExistingAccess input.
  • If SetComponentIntent fails transiently, an already-actuated enabled Component keeps local health evaluation (refreshLocalHealth) at the last evaluated generation. That pass makes no CMS call and runs no Helm upgrade, so Ready shows real local failures.
  • Ready=True is kept only while spec.enabled. A disabled Component whose deactivation can't reach CMS reports Ready=Unknown/CMSSyncFailed.
  • A Component whose first CMS sync fails reports Ready=Unknown/InitialSyncPending.
  • CMS deletion and deactivation RPC failures use the same path instead of the ad-hoc CMSDeletionFailed / CMSDeactivationFailed Ready reasons.

Stack Position

Assumptions

  • During a CMS outage, health is evaluated at the last evaluated generation, not at the new spec's generation. The new spec has not reached CMS and must not be marked ready or actuated. If this is wrong, a spec edit made during an outage would wait for CMS to recover before it is evaluated, which is the intended behaviour.
  • The live GKE evidence below predates the hardening commit (local health refresh, Ready=True only while enabled). Unit tests cover the new behaviour. If this is wrong, the CMS-outage checkpoint must be re-run before merge.

Verification & Testing

  • Commands Executed: bazel test //pkg/components/bridge/... (new TestReconcileComponent_CMSOutageRefreshesLocalHealth).
  • Coverage & Test Status: all pass. Also checked at the top of the stack: bazel build //pkg/components/... //cmd/xmc_bridge/... //cmd/actuator/... and the bridge tests.
  • KinD E2E: //test/e2e:components_lifecycle_test passed with the whole stack applied (before the hardening commit).
  • Diff size (tools/analyze_diff_size.py): 204 prod / 289 test / 5 doc lines.
  • Lint: golangci-lint run (v1.64.6) clean on ./pkg/components/bridge/....

Live Deployment & Manual Testing

  • Deployment Target: Live GKE development environment (enable_components: true, Spanner-backed CMS), upgraded with the dev-environment upgrade script.
  • Cluster Health: Environment verification passed (5/5, 16/16 pods Ready) before and after the checkpoint.
  • Checkpoint: CP1, run with the stack deployed up to refactor(components): track CMS sync and deactivation rechecks in memory #1229 (wave A).
  • Revision note: the live evidence was collected before the latest rebase onto main and before the hardening commit.
Scenario Result Observation
Steady-state Synced condition ✅ PASS Profile CRs report Synced=True (CMSSynced) alongside Ready=True (ComponentHealthy).
Transient CMS outage on healthy CRs ✅ PASS With the experiment state server scaled to 0, clickhouse and mt-cp1-sync went to Synced=False (CMSSyncFailed). Ready=True (same lastTransitionTime) and status.access.envVars were kept.
Initial sync failure on a new CR (mt-cp1-init) ✅ PASS Created during the outage, it reported Synced=False and Ready=Unknown (InitialSyncPending); after recovery it became Synced=True and Ready=True.

Related Issues / Bugs

Bug: 548436300

TAG=agy
CONV=d833b0e6-4821-48f6-8576-776d53f55a5c


Stack created with GitHub Stacks CLI • Give Feedback 💬

@VLukiantsev
VLukiantsev added this pull request to stack #1245 October 13, 2026 07:27
@gemini-code-assist gemini-code-assist Bot left a comment
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new Synced condition to track control-plane synchronization with the Component Management System (CMS). When transient CMS RPC errors occur, the reconciler now sets Synced=False while preserving the last known Ready condition and status.access (or setting Ready=Unknown with reason InitialSyncPending if it is the first reconcile). It also adds corresponding unit tests, updates the CRD definition, and updates the documentation. There are no review comments provided, so I have no feedback to evaluate.

@VLukiantsev
Copy link
Copy Markdown
Collaborator Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new Synced condition to track control-plane synchronization with the Component Management System (CMS). When CMS RPC failures occur, the reconciler now sets Synced=False (reason CMSSyncFailed) while preserving the component's last known Ready condition and status.access (or setting Ready=Unknown with reason InitialSyncPending if it is the first reconciliation). The changes span the CRD definition, reconciler lifecycle logic, helper functions, and documentation, backed by comprehensive unit tests. I have no feedback to provide as there are no review comments to assess.

@VLukiantsev
VLukiantsev force-pushed the fix/components-synced-condition-b548436300 branch from fdc3a52 to 2538ac0 Compare October 13, 2026 15:09
@VLukiantsev
VLukiantsev force-pushed the fix/components-synced-condition-b548436300 branch 2 times, most recently from 05ded1d to 8422036 Compare October 14, 2026 10:54
@VLukiantsev
VLukiantsev force-pushed the fix/components-synced-condition-b548436300 branch from 8422036 to deead7c Compare October 14, 2026 11:58
@VLukiantsev
VLukiantsev removed this pull request from stack #1245 October 14, 2026 13:31
@VLukiantsev
VLukiantsev added this pull request to stack #1277 October 14, 2026 13:32
@VLukiantsev
VLukiantsev force-pushed the fix/components-synced-condition-b548436300 branch 2 times, most recently from b826ced to a498780 Compare October 14, 2026 14:22
@VLukiantsev
VLukiantsev force-pushed the fix/components-synced-condition-b548436300 branch 2 times, most recently from 0129ab8 to 6744ac3 Compare October 15, 2026 08:07
Comment thread pkg/components/bridge/cms_client.go Resolved
Comment thread pkg/components/bridge/reconciler.go Resolved
@VLukiantsev
VLukiantsev marked this pull request as ready for review October 15, 2026 08:44
@github-actions
github-actions Bot requested a review from janzak-dev October 15, 2026 08:44
@VLukiantsev
VLukiantsev force-pushed the fix/components-synced-condition-b548436300 branch from 3e58bd8 to aa3e808 Compare October 15, 2026 09:49
@VLukiantsev
VLukiantsev force-pushed the fix/components-synced-condition-b548436300 branch from aa3e808 to 0b62fa4 Compare October 15, 2026 10:02
Comment thread pkg/components/bridge/reconciler.go Resolved
Comment thread pkg/components/bridge/spec_parser.go Resolved
Comment thread pkg/components/bridge/reconciler.go Resolved
@VLukiantsev
VLukiantsev force-pushed the fix/components-synced-condition-b548436300 branch from 0b62fa4 to 6fe7c00 Compare October 15, 2026 12:50
janzak-dev
janzak-dev previously approved these changes Oct 15, 2026
@VLukiantsev VLukiantsev added the priority::2-high top of mind. should not wait. label Oct 15, 2026
Decouple control-plane synchronization status (Synced=True/False with
CMSSynced/CMSSyncFailed) from data-plane readiness (Ready) so transient
CMS outages do not flip healthy components to Ready=False or drop
status.access. Components that fail their initial CMS sync before
readiness is evaluated report Ready=Unknown with reason
InitialSyncPending.

Bug: 548436300
TAG=agy
CONV=d833b0e6-4821-48f6-8576-776d53f55a5c
Move the SetComponentIntent error classification out of applyIntent into
handleIntentError so the nested Synced/cycle/sync-failure branches stay
within the golangci-lint nestif limit. No behavior change.

Bug: 548436300
TAG=agy
CONV=d833b0e6-4821-48f6-8576-776d53f55a5c
On a transient SetComponentIntent failure, an already-actuated enabled
component keeps its local health evaluation (no CMS call, no Helm
upgrade) at the last evaluated generation, so Ready reflects the latest
probe while Synced=False. Ready=True is preserved only while
spec.enabled; a disabled component whose deactivation cannot reach CMS
reports Ready=Unknown/CMSSyncFailed.

Bug: 548436300
TAG=agy
CONV=d833b0e6-4821-48f6-8576-776d53f55a5c
A dependency cycle, an unregistered dependency or a deactivation
blocked by enabled dependents is a CMS policy decision, not a CMS
outage: the bridge's write path to CMS is healthy, so Synced stays
True and the block is reported by Ready instead. Document this in the
Synced row so operators do not read Synced=True as "converged".

Bug: 548436300
TAG=agy
CONV=b2ebecbe-c04a-4fb7-a16c-d23de82ed3e5
…and outage probing

Ensure shouldSyncToCMS returns true when recovering from Synced!=True so multi-pass CMS recovery always executes UpdateObservedGeneration, and use wasComponentPreviouslyActive in isActuated so 3P wrappers without spec.dependencies continue probing local health across Ready transitions during a CMS outage.

Comment links: #1227 (comment) #1227 (comment)

Bug: 548436300

TAG=agy

CONV=d833b0e6-4821-48f6-8576-776d53f55a5c
…StringMap

- Handle the dependency cycle case first in handleIntentError so the CMS sync failure path runs last without nesting; a nil reportGated error still returns the plain wrapped intent error.
- Return nil for an empty map[string]any in extractStringMap before allocating.

Bug: 548436300
TAG=agy
CONV=d833b0e6-4821-48f6-8576-776d53f55a5c
@VLukiantsev
VLukiantsev force-pushed the fix/components-synced-condition-b548436300 branch from c4372c0 to f53b0ba Compare October 16, 2026 09:37
@github-actions github-actions Bot left a comment
Copy link
8BD0 Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Incremental PR Approval

Clean rebase detected with zero semantic patch lines changed.

Preserving prior approval by @janzak-dev on commit c4372c0.

@github-actions github-actions Bot left a comment
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Incremental PR Approval

Clean rebase detected with zero semantic patch lines changed.

Preserving prior approval by @janzak-dev on commit c4372c0.

@VLukiantsev
VLukiantsev added this pull request to the merge queue Oct 16, 2026
Merged via the queue into main with commit 67e028e Oct 16, 2026
24 of 26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority::2-high top of mind. should not wait.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0