feat: create single cluster per backend - #9459
Conversation
Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>
✅ Deploy Preview for cerulean-figolla-1f9435 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 59caf423d8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if d.RouteLevelClusterSettings { | ||
| return |
There was a problem hiding this comment.
Honor Force when route policies add cluster settings
Even when the user sets mergeBackends: Force, the translator only receives a boolean and this path always returns for RouteLevelClusterSettings; that flag is set for route-targeted BackendTrafficPolicies with cluster-scoped settings. As a result Force behaves like BestEffort in the exact scenario the new API documents as forced merging, so users cannot enable the advertised mode.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
To keep the scope of this PR limited, I plan to implement the force mode in a follow-up PR.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #9459 +/- ##
==========================================
+ Coverage 75.35% 75.38% +0.03%
==========================================
Files 252 253 +1
Lines 41492 41624 +132
==========================================
+ Hits 31266 31379 +113
- Misses 8113 8119 +6
- Partials 2113 2126 +13 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>
|
/retest |
Runs the Gateway API conformance suite with EnvoyProxy.spec.mergeBackends enabled by default, proving the cluster-deduplication optimization doesn't alter conformance behavior. Ports the CI-wiring half of what PR envoyproxy#9459 (a competing implementation of the same feature) built, adapted to our own MergeBackendsConfig{Enabled, Mode} CRD shape rather than their bare MergeBackendsMode pointer. No Go code changes: MergeBackends has no user-observable behavior difference, and no existing e2e test inspects Envoy's cluster count/names/config_dump, so no test-variant file is needed the way xds-name-scheme-v2 required one. Signed-off-by: Muhammad Waqar <waqar.hameed08@gmail.com>
Runs the Gateway API conformance suite with EnvoyProxy.spec.mergeBackends enabled by default, proving the cluster-deduplication optimization doesn't alter conformance behavior. Ports the CI-wiring half of what PR envoyproxy#9459 (a competing implementation of the same feature) built, adapted to our own MergeBackendsConfig{Enabled, Mode} CRD shape rather than their bare MergeBackendsMode pointer. No Go code changes: MergeBackends has no user-observable behavior difference, and no existing e2e test inspects Envoy's cluster count/names/config_dump, so no test-variant file is needed the way xds-name-scheme-v2 required one. Signed-off-by: Muhammad Waqar <waqar.hameed08@gmail.com>
Found while comparing test coverage against the competing PR envoyproxy#9459, which has its own TestIsMergeBackendsEnabled - we had none, only indirect coverage via translator_test.go's fixture harness (which exercises the function but doesn't specifically pin its precedence behavior). Add direct coverage for GatewayClass-level vs. default-spec precedence, including two cases the competing PR's version didn't cover: GatewayClass EnvoyProxy explicitly disabling MergeBackends still wins over a default spec that enables it, and a GatewayClass EnvoyProxy with no MergeBackends field at all correctly falls back to the default spec. Signed-off-by: Muhammad Waqar <waqar.hameed08@gmail.com>
|
Closing this in favor of #9477 |
Runs the Gateway API conformance suite with EnvoyProxy.spec.mergeBackends enabled by default, proving the cluster-deduplication optimization doesn't alter conformance behavior. Ports the CI-wiring half of what PR envoyproxy#9459 (a competing implementation of the same feature) built, adapted to our own MergeBackendsConfig{Enabled, Mode} CRD shape rather than their bare MergeBackendsMode pointer. No Go code changes: MergeBackends has no user-observable behavior difference, and no existing e2e test inspects Envoy's cluster count/names/config_dump, so no test-variant file is needed the way xds-name-scheme-v2 required one. Signed-off-by: Muhammad Waqar <waqar.hameed08@gmail.com>
Found while comparing test coverage against the competing PR envoyproxy#9459, which has its own TestIsMergeBackendsEnabled - we had none, only indirect coverage via translator_test.go's fixture harness (which exercises the function but doesn't specifically pin its precedence behavior). Add direct coverage for GatewayClass-level vs. default-spec precedence, including two cases the competing PR's version didn't cover: GatewayClass EnvoyProxy explicitly disabling MergeBackends still wins over a default spec that enables it, and a GatewayClass EnvoyProxy with no MergeBackends field at all correctly falls back to the default spec. Signed-off-by: Muhammad Waqar <waqar.hameed08@gmail.com>
What this PR does / why we need it:
By default, Envoy Gateway generates one Envoy cluster per route rule. When the same backend is referenced by many routes, this produces many identical clusters, which inflates the xDS config, multiplies active health-check traffic, fragments passive health-check status, de-optimizes upstream connection pooling, and increases stats cardinality.
This PR adds an experimental
mergeBackendsfield toEnvoyProxythat enables cluster deduplication: routes referencing the same backend — identified by kind/namespace/name/port (plus resolved protocol and routing mode) — share a single Envoy cluster.Two modes are supported:
When unset, the default one-cluster-per-route-rule behavior is preserved, so this is fully backward compatible.
Includes API + CRDs, translator/xDS changes, unit and golden-file tests, a user-facing task doc, and a release note.
Conformance verification: to guarantee that cluster deduplication does not change routing semantics, this PR adds a new merge-backends conformance test matrix entry to build_and_test.yaml. It runs the full Gateway API conformance suite (v1.36.1, experimental channel) with
mergeBackendsenabled, so the merge path is exercised end-to-end against the same spec assertions as the default configuration — proving the feature is transparent to conformance.Which issue(s) this PR fixes:
Fixes #5307
PR Checklist
git commit -s). See DCO: Sign your work./api), the API was discussed and agreed before the implementation. The API change can be in a separate PR, or in the same PR, but the API must be agreed before implementation. N/A if this PR does not contain API changes.make generate gen-check,make lint, and the unit-test/coverage build pass. (Flaky e2e failures are not considered breakages, butgen-check,lint, and coverage MUST pass.)release-notes/current/<section>/<pr-number>-<slug>.md(seerelease-notes/current/README.mdfor sections and naming). N/A if this PR does not contain non-trivial changes.make gen-checkand committed the result if API/helm charts/modules changed.release-notes/current/breaking_changes/.