Skip to content

refactor: only include cluster-scoped traffic features in BackendCluster - #9642

Open
zhaohuabing wants to merge 1 commit into
envoyproxy:mainfrom
zhaohuabing:fix-cluster-traffic-features
Open

refactor: only include cluster-scoped traffic features in BackendCluster#9642
zhaohuabing wants to merge 1 commit into
envoyproxy:mainfrom
zhaohuabing:fix-cluster-traffic-features

Conversation

@zhaohuabing

@zhaohuabing zhaohuabing commented Aug 3, 2026

Copy link
Copy Markdown
Member

BackendCluster.Traffic held the full TrafficFeatures, but only the ten fields applyTraffic() consumes translate to an Envoy cluster (CDS). The other nine are route/HCM-scoped — dead data on a cluster shared across many routes, and a trap for anyone who later reads them there.

This splits those ten into ClusterTrafficFeatures, inline-embedded into TrafficFeatures so serialization and promoted field access are unchanged, and narrows BackendCluster.Traffic to *ClusterTrafficFeatures. applyTraffic and ExtraArgs.traffic take the narrow type too, so a route-scoped TrafficFeatures field can no longer reach CDS.

Timeout needed the same treatment one level down: requestTimeout and streamIdleTimeout are read only by route and filter translation, yet rode along on every merged cluster. The three CDS members move into ClusterHTTPTimeout, inline-embedded into HTTPTimeout, and xdsClusterArgs now holds a ClusterTimeout — so reading a route-scoped member during cluster translation is a compile error. Timeout.ClusterOnly() builds that value from ClusterHTTPTimeout rather than by clearing fields, so a member added to HTTPTimeout stays out of CDS unless it is added deliberately.

No behavior change: xDS output is identical and no testdata was touched.

Fixes #9579

@zhaohuabing
zhaohuabing requested a review from a team as a code owner August 3, 2026 03:45
@netlify

netlify Bot commented Aug 3, 2026

Copy link
Copy Markdown

Deploy Preview for cerulean-figolla-1f9435 ready!

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

@zhaohuabing zhaohuabing added this to the v1.9.0-rc.1 Release milestone Aug 3, 2026
@zhaohuabing
zhaohuabing marked this pull request as draft August 3, 2026 03:52
@zhaohuabing
zhaohuabing force-pushed the fix-cluster-traffic-features branch from e87562b to 30fbf39 Compare August 3, 2026 03:53
@zhaohuabing
zhaohuabing marked this pull request as ready for review August 3, 2026 03:57
@zhaohuabing
zhaohuabing force-pushed the fix-cluster-traffic-features branch from 30fbf39 to 9d6c368 Compare August 3, 2026 03:58
@zhaohuabing

Copy link
Copy Markdown
Member Author

@codex review

@zhaohuabing
zhaohuabing force-pushed the fix-cluster-traffic-features branch from 9d6c368 to 3853fd0 Compare August 3, 2026 04:05

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9d6c36836e

ℹ️ 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".

Comment thread internal/ir/xds.go
@zhaohuabing
zhaohuabing force-pushed the fix-cluster-traffic-features branch 4 times, most recently from ed25170 to 7fd7984 Compare August 3, 2026 08:04
@codecov

codecov Bot commented Aug 3, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.22034% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.08%. Comparing base (6c9bb06) to head (b2bdf57).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
internal/ir/xds.go 77.77% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9642      +/-   ##
==========================================
+ Coverage   76.06%   76.08%   +0.01%     
==========================================
  Files         260      260              
  Lines       43449    43470      +21     
==========================================
+ Hits        33048    33072      +24     
  Misses       8196     8196              
+ Partials     2205     2202       -3     

☔ 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 force-pushed the fix-cluster-traffic-features branch 2 times, most recently from 74416aa to de6c525 Compare August 4, 2026 01:09
@zhaohuabing

Copy link
Copy Markdown
Member Author

/retest

@zhaohuabing
zhaohuabing requested a review from kkk777-7 August 4, 2026 02:50
@zhaohuabing
zhaohuabing force-pushed the fix-cluster-traffic-features branch from de6c525 to a9bb9a1 Compare August 4, 2026 02:59
@muwaqar-cflt

Copy link
Copy Markdown
Contributor

seems similar to #8899

@zhaohuabing

Copy link
Copy Markdown
Member Author

seems similar to #8899

This PR doesn't touch API, just the internal IR.

BackendCluster.Traffic carried the full TrafficFeatures, but only the ten
fields applyTraffic() consumes translate to an Envoy cluster (CDS). The
remaining route/HCM-scoped features (rate limit, fault injection, retry,
response override, ...) were dead data on a cluster shared across many
routes, and nothing stopped a future reader from consuming them there,
where they would be silently wrong.

Split those ten fields into ClusterTrafficFeatures, inline-embedded into
TrafficFeatures so serialization and promoted field access are unchanged,
and narrow BackendCluster.Traffic to *ClusterTrafficFeatures. applyTraffic
and ExtraArgs.traffic take the narrow type too, so a route-scoped
TrafficFeatures field can no longer reach CDS.

Timeout needed the same treatment one level down: RequestTimeout and
StreamIdleTimeout are read only by route and filter translation, yet rode
along on every merged cluster. Split the three CDS members into
ClusterHTTPTimeout, inline-embedded into HTTPTimeout, and give
xdsClusterArgs a ClusterTimeout so reading a route-scoped member during
cluster translation is a compile error. Timeout.ClusterOnly() builds that
value from ClusterHTTPTimeout rather than by clearing fields, so a member
added to HTTPTimeout stays out of CDS unless added deliberately.

No behavior change: xDS output is identical and no testdata was touched.

Fixes envoyproxy#9579

Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>
@zhaohuabing
zhaohuabing force-pushed the fix-cluster-traffic-features branch from a9bb9a1 to b2bdf57 Compare August 5, 2026 01:51
@zhaohuabing

Copy link
Copy Markdown
Member Author

/retest

@zhaohuabing

Copy link
Copy Markdown
Member Author

/retest

@zhaohuabing
zhaohuabing removed the request for review from muwaqar-cflt August 5, 2026 07:45
@zhaohuabing
zhaohuabing requested review from a team and arkodg August 5, 2026 07:45
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.

We should only include Cluster-scoped traffic features in the BackendCluster.

3 participants