Skip to content

Fix LC migration informer relist flake - #4264

Merged
kcp-ci-bot merged 5 commits into
mainfrom
fix/lc-migration-informer-relist-4250
Jul 14, 2026
Merged

Fix LC migration informer relist flake#4264
kcp-ci-bot merged 5 commits into
mainfrom
fix/lc-migration-informer-relist-4250

Conversation

@mjudeikis

Copy link
Copy Markdown
Contributor

Summary

Fixes the TestFullMigration/PreMigrateInformer flake tracked in #4250.

A LogicalClusterMigration moves a logical cluster to a shard with an independent resource version space. An informer/watcher established before the migration has its watch severed (cancelLogicalClusterConnections) and then relists, sending its last-observed origin-shard resource version to the destination shard.

The migrating filter (WithBlockMigratingLogicalClusters) previously answered every blocked request with 503 + Retry-After: 1. The client-go REST layer silently retries 429/5xx responses that carry a Retry-After header (with_retry.go checkWait), so the error never surfaced to the reflector and it never dropped its foreign resource version. The destination shard's watch cache then blocked on resourceVersionMatch=NotOlderThan until its own, unrelated resource version counter organically caught up — which races the 30s test timeout and is inherently non-deterministic (passes when the destination RV is already ahead, hangs when it is behind).

Fix

For list/watch requests that carry a resourceVersion, the filter now returns 410 Gone (Expired) without a Retry-After header. The REST client surfaces this instead of swallowing it, so the reflector resets its resource version and relists from scratch (RV="", a consistent read), which resolves cleanly against the destination shard once migration completes.

All other requests keep the 503 Retry-After behaviour so they transparently retry once migration finishes. The system:kcp:external-logical-cluster-admin bypass (used by the destination shard to pull the dump) is unchanged.

Test

  • New unit test TestWithBlockMigratingLogicalClusters covering the pass-through, external-admin, 503 Retry-After, and 410 Expired paths.
  • Exercised end-to-end by the existing test/e2e/logicalclustermigration PreMigrateInformer subtests.

/kind flake

Fixes #4250

Release Notes

Informers and watches established before a LogicalClusterMigration now relist promptly after the migration instead of stalling until the destination shard's resource version catches up.

@kcp-ci-bot kcp-ci-bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/flake Categorizes issue or PR as related to a flaky test. dco-signoff: yes Indicates the PR's author has signed the DCO. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jul 13, 2026
…sions

A LogicalClusterMigration moves a logical cluster to a shard with an
independent resource version space. Informers/watchers that were established
before the migration relist after their watch is severed and send their
last-observed (origin-shard) resource version to the destination shard.

The migrating filter answered every blocked request with 503 + Retry-After,
which the REST client silently retries. The reflector therefore never dropped
its foreign resource version, and the destination shard's watch cache blocked
on resourceVersionMatch=NotOlderThan until its own unrelated resource version
counter happened to catch up. This raced the 30s test timeout, making
TestFullMigration/PreMigrateInformer flake (#4250).

For list/watch requests carrying a resourceVersion, return 410 Gone (Expired)
without a Retry-After header instead. The REST client surfaces the error, the
reflector resets its resource version and relists from scratch, which resolves
cleanly against the destination shard. Other requests keep the 503 Retry-After
behaviour so they transparently retry once the migration completes.
@mjudeikis
mjudeikis force-pushed the fix/lc-migration-informer-relist-4250 branch from 23714dc to f76fdfe Compare July 14, 2026 07:48
@mjudeikis

Copy link
Copy Markdown
Contributor Author

/retest

@kcp-ci-bot kcp-ci-bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jul 14, 2026
@mjudeikis mjudeikis changed the title Fix LC migration informer relist flake (#4250) Fix LC migration informer relist flake Jul 14, 2026
@mjudeikis

Copy link
Copy Markdown
Contributor Author

/retest

@mjudeikis mjudeikis added the tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. label Jul 14, 2026

@xrstf xrstf left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

/approve

@kcp-ci-bot kcp-ci-bot added the lgtm Indicates that a PR is ready to be merged. label Jul 14, 2026
@kcp-ci-bot

Copy link
Copy Markdown
Contributor

LGTM label has been added.

DetailsGit tree hash: 1e31e9ce91d9b3d4d1f9973c5c61b6849a737dd0

@kcp-ci-bot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: xrstf

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kcp-ci-bot kcp-ci-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 14, 2026
@kcp-ci-bot
kcp-ci-bot merged commit 0aadcab into main Jul 14, 2026
16 checks passed
@kcp-ci-bot
kcp-ci-bot deleted the fix/lc-migration-informer-relist-4250 branch July 14, 2026 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Indicates the PR's author has signed the DCO. kind/flake Categorizes issue or PR as related to a flaky test. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

flake: LC Migration flakes

4 participants