Skip to content

feat(backendtrafficpolicy): wire circuitBreaker.maxConnections for UDPRoute - #10452

Merged
zhaohuabing merged 3 commits into
envoyproxy:mainfrom
Wali05:fix/udproute-circuit-breaker
Dec 2, 2026
Merged

zhaohuabing merged 3 commits into
envoyproxy:mainfrom
Wali05:fix/udproute-circuit-breaker

Conversation

@Wali05

@Wali05 Wali05 commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:

BackendTrafficPolicy.circuitBreaker was accepted for UDPRoutes, but ir.UDPRoute had no field for it, so the cluster behind udp_proxy always got the default thresholds.

How:

  • Only maxConnections is carried to UDP. udp_proxy counts each session against the cluster's connection limit and doesn't check any other circuit breaker threshold, so maxPendingRequests, maxParallelRequests, maxParallelRetries, maxRequestsPerConnection, perEndpoint and retryBudget are still dropped for UDP, as they are today. A new ir.CircuitBreaker.UDPOnly() builds that subset, the same way Timeout.ClusterOnly() does for TCP.
  • ir.UDPRoute gets a CircuitBreaker field. It is set by both the route-targeted and the Gateway/listener-targeted apply loops, and UDPRouteTranslator.asClusterArgs passes it to the cluster.
  • With mergeBackends, applyGatewayPolicyToMergedCluster adds the same subset to merged UDP clusters, so merged and unmerged clusters stay the same, as the comment on that function asks.

Effect on existing UDP traffic: maxConnections defaults to 1024 in the API, which is also Envoy's default, so only policies that set maxConnections to some other value change UDP behaviour.

Tests:

  • New xds-ir case udp-route-circuit-breaker: the UDP cluster now has maxConnections: 100 in its thresholds.
  • Five existing gatewayapi golden files that already set circuitBreaker on a policy covering a UDPRoute now show circuitBreaker: {maxConnections: N} on the UDP route or merged UDP cluster. Health check and the other thresholds are still left off.
  • Unit test for UDPOnly() (nil, no maxConnections, only maxConnections kept, no aliasing).

Possible follow-up, not changed here: when the policy targets a Gateway, the TCP loop in translateBackendTrafficPolicyForListeners doesn't set BackendConnection on TCP routes, but the route-targeted loop does (and TCPRouteTranslator reads it). The merged TCP cluster subset in applyGatewayPolicyToMergedCluster leaves it out too. That may be on purpose, but it looks like the same kind of gap.

Which issue(s) this PR fixes:
Fixes #10417


PR Checklist

  • Authorship & ownership: Coding agents / AI assistants are welcome, but I have reviewed every change, understand how and why it works, can explain and maintain it, and take full responsibility for this PR. I have not submitted generated output I do not understand.
  • DCO: All commits are signed off (git commit -s). See DCO: Sign your work.
  • API agreed first: N/A: no changes under /api.
  • Required checks pass: Local make gen-check and make lint pass on this branch. CI unit-test/coverage still to run on the PR. (Flaky e2e failures are not considered breakages, but gen-check, lint, and coverage MUST pass.)
  • Tests added/updated: New/changed code is covered by appropriate tests. N/A if this PR does not contain code changes.
  • Docs: N/A: the API docs don't limit circuitBreaker by route type, so nothing there is wrong after this change.
  • Release notes: release-notes/current/new_features/10417-udproute-circuit-breaker-max-connections.md.
  • Generated files committed: zz_generated.deepcopy.go regenerated with controller-gen and committed; no API, helm or module changes.
  • Scope & compatibility: The PR is reasonably scoped (no unrelated changes) and preserves backward compatibility, or any breaking change is called out above and documented in release-notes/current/breaking_changes/.
  • Codex review: Requested a Codex review and addressed all of its comments.
  • Copilot review: Requested a Copilot review and addressed all of its comments. Can't request it from a fork (no reviewer permission on this repo); happy to address its comments if a maintainer requests one.

…PRoute

BackendTrafficPolicy.circuitBreaker was accepted on UDPRoutes and on
Gateways with UDP listeners, but ir.UDPRoute had no field for it, so the
cluster behind udp_proxy always got the default thresholds.

Envoy's udp_proxy counts each session against the cluster's connection
limit and checks no other circuit breaker threshold, so carry only
maxConnections onto UDP routes and onto merged UDP clusters.

Fixes envoyproxy#10417

Signed-off-by: Wali Ahed Hussain <121812531+Wali05@users.noreply.github.com>
@Wali05
Wali05 requested a review from a team as a code owner October 29, 2026 07:14
@netlify

netlify Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

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

Built without sensitive environment variables

Name Link
🔨 Latest commit e797d72
🔍 Latest deploy log https://app.netlify.com/projects/cerulean-figolla-1f9435/deploys/6b0f1b27033e85de35a51ef3
😎 Deploy Preview https://deploy-preview-10452--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

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 🔄 Running since 2026-10-29T07:14:28.690572Z 6bde0b0 PR opened
ℹ️ 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.

@codecov

codecov Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.87%. Comparing base (a3621b9) to head (e797d72).
⚠️ Report is 52 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10452      +/-   ##
==========================================
+ Coverage   82.79%   82.87%   +0.08%     
==========================================
  Files         278      279       +1     
  Lines       44521    44672     +151     
==========================================
+ Hits        36859    37020     +161     
+ Misses       7661     7651      -10     
  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.

Signed-off-by: Wali Ahed Hussain <121812531+Wali05@users.noreply.github.com>
@zhaohuabing zhaohuabing added this to the v1.11.0-rc.1 Release milestone Dec 1, 2026
@zhaohuabing

zhaohuabing commented Dec 1, 2026 •

Copy link
Copy Markdown
Member

Nit, non-blocking: could the maxConnections API doc mention UDPRoute? For UDP it caps concurrent sessions, and the other thresholds are ignored.

zhaohuabing
zhaohuabing previously approved these changes Dec 1, 2026
@zhaohuabing
zhaohuabing requested a review from a team December 1, 2026 02:50
@zhaohuabing

zhaohuabing commented Dec 1, 2026 •

Copy link
Copy Markdown
Member

Related: #10111 adds a per-listener UDP idle timeout. Each session holds a slot on the backend cluster's maxConnections until its listener's idle timeout fires (60s today), so the API doc here could point to that setting. cc @arkodg

For a UDPRoute, maxConnections limits concurrent sessions and the other
circuit breaker thresholds are ignored.

Signed-off-by: Wali Ahed Hussain <121812531+Wali05@users.noreply.github.com>
@Wali05

Wali05 commented Dec 1, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the review.

I've updated the maxConnections API doc to say that for a UDPRoute it limits concurrent UDP sessions, and that the other circuit breaker thresholds are ignored.

Happy to point at the idle timeout setting once #10111 lands.

@github-actions github-actions Bot added the area/api API-related issues label Dec 1, 2026
@zhaohuabing
zhaohuabing merged commit 5c9bf8b into envoyproxy:main Dec 2, 2026
51 of 53 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/api API-related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wire BackendTrafficPolicy.circuitBreaker.maxConnections for UDPRoute

3 participants