Fix minor xDS bugs in filter chain TLS matching, locality routing, and state replay - #6887
Conversation
📝 WalkthroughWalkthroughAdds cached xDS type-registry access, adjusts subscriber replay and locality percentage handling, and validates TLS consistency during server filter-chain acceptance with integration tests for TLS and plaintext default chains. The unmanaged-port test now targets its explicitly configured port. ChangesxDS behavior updates
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant Client
participant XdsServerPlugin
participant ExistingAcceptor
Client->>XdsServerPlugin: Accept connection
XdsServerPlugin->>XdsServerPlugin: Resolve filter-chain TLS spec
XdsServerPlugin->>XdsServerPlugin: Compare TLS spec with session protocol
XdsServerPlugin->>ExistingAcceptor: Delegate matching connection
XdsServerPlugin-->>Client: Reject protocol mismatch
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6887 +/- ##
============================================
- Coverage 74.46% 0 -74.47%
============================================
Files 1963 0 -1963
Lines 82437 0 -82437
Branches 10764 0 -10764
============================================
- Hits 61385 0 -61385
+ Misses 15918 0 -15918
+ Partials 5134 0 -5134 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Tick the box to add this pull request to the merge queue (same as
|
Motivation:
While implementing the xds example, several minor bugs were discovered in the xDS module:
100.0instead of1.0, producing inconsistent routing percentages.StateCoordinatorand a cached resource already existed, the cached value was replayed directly to the individual watcher rather than through theCompositeSnapshotWatcher. SinceCompositeSnapshotWatchertracks whether an update has been received, bypassing it caused it to still consider the resource missing and emit a spuriousMissingXdsResourceException.Misc) Added a
XdsResourceReader.typeRegistry()public API soJsonFormat.Printercan also use loaded protosModifications:
XdsServerPluginthat rejects connections when the matched filter chain's TLS configuration doesn't match the session protocol (e.g., plaintext request on a TLS-required chain, or HTTPS request on a plaintext-only chain).100.0to1.0inLocalityRoutingStateFactory.StateCoordinator.replayToWatcher()to replay cached resources throughCompositeSnapshotWatcherfor new subscribers, so that the composite correctly records the update and avoids emitting a falseMissingXdsResourceException.XdsResourceReader.typeRegistry()as a public API so that external code can create aJsonFormat.Printerthat correctly serializesAny-wrapped xDS messages.tlsFilterChainRejectsPlaintextConnection,plaintextFilterChainRejectsHttpsConnection) to verify that mismatched TLS/plaintext connections are properly rejected.Result:
MissingXdsResourceExceptionwhen a cached resource exists at the time of registration for path-type config sources