Skip to content

[2.3] fix: revert per-client xDS readiness gates in favor of a fir…#14387

Merged
davidjumani merged 2 commits into
kgateway-dev:v2.3.xfrom
chandler-solo:chandler/14184-23x-backport-sleeprever
Jul 10, 2026
Merged

[2.3] fix: revert per-client xDS readiness gates in favor of a fir…#14387
davidjumani merged 2 commits into
kgateway-dev:v2.3.xfrom
chandler-solo:chandler/14184-23x-backport-sleeprever

Conversation

@chandler-solo

Copy link
Copy Markdown
Contributor

…st-connect grace period (#14380)

Description

Backport of #14380 (commit 714190cf85dcd8c06849f819053249ab8e0efbe7 on main) to v2.3.x. Part of #14184.

This is not a clean cherry-pick. The functional changes are byte-for-byte the main commit; the only adaptations reconcile branch divergence:

  • pkg/kgateway/proxy_syncer/perclient_test.go — retargeted to v2.3.x's older ir.UniqlyConnectedClient / ir.NewUniqlyConnectedClient spelling (main renamed these to Uniquely…). The NewUniquelyConnectedClients collection constructor is spelled the same on both branches and was left untouched.
  • .github/workflows/e2e.yaml — appended XdsStarvation to cluster-seven's existing run regex (which on v2.3.x already carries an extra AttachedRoutes entry) rather than replacing the line.
  • Makefile — same grep -> grep -x fix in kind-create, re-anchored to a different line number.

No behavioral differences from the main commit.

Change Type

/kind fix

Changelog

Reverted the per-client xDS whole-snapshot readiness gates, which could withhold a gateway's configuration indefinitely when it referenced a backend that can never become ready (for example an ExternalName Service) — stranding already-connected proxies on stale endpoints and crash-looping newly started proxy pods. Readiness is now handled by a bounded per-stream first-connect grace period (configurable via KGW_XDS_FIRST_CONNECT_DELAY, defaulting to 1s).

Additional Notes

…st-connect grace period (kgateway-dev#14380)

# Description

Backport of kgateway-dev#14380 (commit `714190cf85dcd8c06849f819053249ab8e0efbe7` on `main`) to `v2.3.x`. Part of kgateway-dev#14184.

This is **not** a clean cherry-pick. The functional changes are byte-for-byte the main commit; the only adaptations reconcile branch divergence:

- `pkg/kgateway/proxy_syncer/perclient_test.go` — retargeted to `v2.3.x`'s older `ir.UniqlyConnectedClient` / `ir.NewUniqlyConnectedClient` spelling (`main` renamed these to `Uniquely…`). The `NewUniquelyConnectedClients` collection constructor is spelled the same on both branches and was left untouched.
- `.github/workflows/e2e.yaml` — appended `XdsStarvation` to `cluster-seven`'s existing run regex (which on `v2.3.x` already carries an extra `AttachedRoutes` entry) rather than replacing the line.
- `Makefile` — same `grep` -> `grep -x` fix in `kind-create`, re-anchored to a different line number.

No behavioral differences from the `main` commit.

# Change Type

/kind fix
# Changelog

```release-note
Reverted the per-client xDS whole-snapshot readiness gates, which could withhold a gateway's configuration indefinitely when it referenced a backend that can never become ready (for example an ExternalName Service) — stranding already-connected proxies on stale endpoints and crash-looping newly started proxy pods. Readiness is now handled by a bounded per-stream first-connect grace period (configurable via KGW_XDS_FIRST_CONNECT_DELAY, defaulting to 1s).
```
 # Additional Notes

Signed-off-by: David L. Chandler <[email protected]>
Copilot AI review requested due to automatic review settings July 10, 2026 19:21
@chandler-solo chandler-solo changed the title [v2.3.x] fix: revert per-client xDS readiness gates in favor of a fir… [2.3] fix: revert per-client xDS readiness gates in favor of a fir… Jul 10, 2026
@gateway-bot gateway-bot added kind/fix Categorizes issue or PR as related to a bug. release-note labels Jul 10, 2026

Copilot AI 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.

Pull request overview

Backports the main fix to v2.3.x that removes per-client whole-snapshot xDS “readiness gates” (which could indefinitely withhold config) and replaces them with a bounded per-stream first-connect grace period, plus regression coverage (unit + e2e) for the starvation scenarios.

Changes:

  • Replace per-client snapshot gating with a per-stream first-connect delay (env-tunable) to reduce reconnect-time partial-snapshot races without risking indefinite starvation.
  • Add unit tests pinning the delay contract and add a new e2e suite (XdsStarvation) covering ExternalName/never-ready backend reference scenarios.
  • Minor CI/tooling updates: extend e2e run regex, and tighten KinD cluster existence check (grep -x).

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
test/e2e/tests/kgateway_tests.go Registers the new XdsStarvation e2e suite in the kube gateway runner.
test/e2e/features/xds_starvation/testdata/setup.yaml Manifests for the starvation scenario (ExternalName backend + valid backend + ReferenceGrant).
test/e2e/features/xds_starvation/testdata/postrestart-route.yaml Route applied post-controller-restart to validate warm-client update flow.
test/e2e/features/xds_starvation/suite.go New e2e suite asserting anti-starvation properties across serving, proxy rollout, and controller restart.
pkg/krtcollections/uniqueclients.go Implements the per-stream first-connect delay (lazy env read + atomic storage) and sleeps only on new streams.
pkg/krtcollections/uniqueclients_test.go Disables the first-connect delay for existing unique-clients tests to avoid test slowdown.
pkg/krtcollections/uniqueclients_delay_test.go Adds a focused contract test for the first-connect delay behavior.
pkg/krtcollections/export_test.go Exposes a test-only helper to override/restore the delay atomically.
pkg/kgateway/setup/main_test.go Sets KGW_XDS_FIRST_CONNECT_DELAY=0 for in-process ADS setup tests (unless overridden).
pkg/kgateway/proxy_syncer/proxy_syncer.go Removes referenced-cluster tracking and updates Delete/no-op commentary.
pkg/kgateway/proxy_syncer/perclient.go Removes readiness gates and relies on per-stream delay + minimal “inputs not ready” deferral.
pkg/kgateway/proxy_syncer/perclient_test.go Removes readiness-gate tests and keeps/adjusts anti-starvation tests (errored clusters, blackhole backend refs).
Makefile Fixes KinD cluster-existence guard to avoid substring matches (grep -x).
.github/workflows/e2e.yaml Adds XdsStarvation to cluster-seven’s e2e run regex.

Comment thread pkg/kgateway/proxy_syncer/perclient.go
@chandler-solo chandler-solo added the work in progress Indicates that a PR should not merge because it is a work in progress label Jul 10, 2026
Signed-off-by: David L. Chandler <[email protected]>
@chandler-solo chandler-solo removed the work in progress Indicates that a PR should not merge because it is a work in progress label Jul 10, 2026
@davidjumani
davidjumani added this pull request to the merge queue Jul 10, 2026
Merged via the queue into kgateway-dev:v2.3.x with commit 1b63106 Jul 10, 2026
31 of 32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/fix Categorizes issue or PR as related to a bug. release-note

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants