Skip to content

fix(backendtrafficpolicy): isolate cluster-scoped settings from route-scoped field errors - #10234

Merged
zhaohuabing merged 3 commits into
envoyproxy:mainfrom
muwaqar:fix-btp-cluster-traffic-feature-errors
Oct 20, 2026
Merged

zhaohuabing merged 3 commits into
envoyproxy:mainfrom
muwaqar:fix-btp-cluster-traffic-feature-errors

Conversation

@muwaqar-cflt

Copy link
Copy Markdown
Contributor

Summary

Fixes #10210.

A BackendTrafficPolicy's cluster-scoped settings (circuit breaker, load balancer, timeout, TCP keepalive, backend connection, HTTP2) failed to apply to a merged backend cluster whenever any route-scoped field on the policy failed to build (e.g. a rateLimit referencing a missing ratelimit service), even though the cluster-scoped fields were themselves perfectly valid.

This affected two places:

Fix

ir.ClusterTrafficFeatures already documents the cluster (CDS)-scoped subset of TrafficFeatures ("route- and HCM-scoped features live on TrafficFeatures instead"), but buildTrafficFeatures joined every field's build error into a single combined error, and both cluster-application call sites gated on that combined error.

This PR extracts buildClusterTrafficFeatures, which builds and errors on only the cluster-scoped subset. buildTrafficFeatures composes it (unchanged signature/behavior for every other caller - route application still intentionally fails closed with a 500 on any error, which is untouched). The two cluster-application call sites now gate on the cluster-scoped error instead of the combined one.

applyGatewayPolicyToMergedCluster's parameter changes from *ir.TrafficFeatures to *ir.ClusterTrafficFeatures, since it only ever read that subset.

Test plan

  • go build ./...
  • go test ./internal/...
  • make generate manifests helm-template protos go.testdata.complete (no diff)
  • golangci-lint on internal/gatewayapi/... (clean)
  • New table case in TestProcessBackendTrafficPolicyForBackendEdgeCases and new TestTranslateBackendTrafficPolicyForListenersClusterErrorIsolation, both verified to fail against the pre-fix gating logic

🤖 Generated with Claude Code

@muwaqar-cflt
muwaqar-cflt requested a review from a team as a code owner October 9, 2026 06:58
@netlify

netlify Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for cerulean-figolla-1f9435 ready!

Name Link
🔨 Latest commit fae37e4
🔍 Latest deploy log https://app.netlify.com/projects/cerulean-figolla-1f9435/deploys/6ad6df7ee2d644b4457e078e
😎 Deploy Preview https://deploy-preview-10234--cerulean-figolla-1f9435.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-20T03:34:41.113743Z fae37e4 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@muwaqar-cflt

Copy link
Copy Markdown
Contributor Author

@zhaohuabing @zirain @guydc could one of you take a look when you have a chance?

@muwaqar-cflt

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: 4f45b3f043

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@codecov

codecov Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.52055% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.71%. Comparing base (b3c6341) to head (fae37e4).

Files with missing lines Patch % Lines
internal/gatewayapi/backendtrafficpolicy.go 94.52% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10234      +/-   ##
==========================================
- Coverage   81.73%   81.71%   -0.02%     
==========================================
  Files         267      267              
  Lines       42052    42058       +6     
==========================================
- Hits        34370    34369       -1     
- Misses       7681     7688       +7     
  Partials        1        1              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

zhaohuabing
zhaohuabing previously approved these changes Oct 17, 2026

@zhaohuabing zhaohuabing left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM. Thanks!

@zhaohuabing
zhaohuabing requested a review from a team October 17, 2026 13:14
@zhaohuabing zhaohuabing added this to the v1.10.0-rc.1 Release milestone Oct 17, 2026
…-scoped field errors

A BackendTrafficPolicy's cluster-scoped settings (circuit breaker, load
balancer, timeout, etc.) failed to apply to a merged backend cluster
whenever any route-scoped field (e.g. a broken rateLimit) failed to
translate, even though the cluster-scoped fields themselves were valid.
This affected both the whole-Gateway BTP path and the backend-targeted
BTP merge path added in envoyproxy#9816.

Extract buildClusterTrafficFeatures to build and error on only the
cluster-scoped subset, and gate cluster application on that error
instead of the combined one.

Fixes envoyproxy#10210

Signed-off-by: Muhammad Waqar <[email protected]>
@zhaohuabing
zhaohuabing requested review from a team, guydc and kkk777-7 October 20, 2026 02:20
@zhaohuabing
zhaohuabing merged commit dbf2fb7 into envoyproxy:main Oct 20, 2026
44 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BackendTrafficPolicy merge (route-level and backend-level) doesn't check whether the parent policy it merges with already failed translation

3 participants