Repository navigation
fix(storage): use storage-direct.googleapis.com authority for DirectPath over Interconnect - #16584
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the default gRPC options for DirectPath over Interconnect. Specifically, it changes the default AuthorityOption from storage.googleapis.com to storage-direct.googleapis.com when DirectPath over Interconnect is enabled, as the service uses this authority to identify Interconnect traffic. The PR also updates the corresponding documentation and unit tests to reflect this change. I have no feedback to provide as the changes are correct and well-documented.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #16584 +/- ##
==========================================
- Coverage 92.39% 92.36% -0.04%
==========================================
Files 2266 2266
Lines 220060 220143 +83
==========================================
+ Hits 203317 203327 +10
- Misses 16743 16816 +73 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
03a3686 to
b11e2e1
Compare
…for DirectPath over Interconnect
b11e2e1 to
ffe65e7
Compare
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request updates the Google Cloud Storage gRPC plugin to set the default ":authority" header to "storage-direct.googleapis.com" when DirectPath over Interconnect is enabled, ensuring correct routing of Interconnect traffic. The changes include helper functions to detect Interconnect endpoints, updated default options logic, and comprehensive unit tests. Feedback on the changes suggests making the host extraction logic more robust by handling endpoints that explicitly specify a port.
v-pratap
left a comment
There was a problem hiding this comment.
Looks good overall. The fix keys on the effective endpoint and the main paths are well tested. Main ask: please add edge-case tests for the host parser (port, /, look-alike host). The rest are nits and one question.
| std::string_view const host_and_query = endpoint.substr(prefix.size()); | ||
| std::string_view const host = | ||
| host_and_query.substr(0, host_and_query.find_first_of("/?#:")); | ||
| return host == kDirectPathInterconnectHost; |
There was a problem hiding this comment.
nit: host names are case-insensitive, so google-c2p:///Storage-Direct.googleapis.com?force-xds still targets Interconnect but gets the storage.googleapis.com authority. absl::EqualsIgnoreCase(host, kDirectPathInterconnectHost) would close that gap. It's an edge case, so up to you.
There was a problem hiding this comment.
The host in a google-c2p:/// target is passed through verbatim by gRPC's C2P resolver as the xDS Listener resource name it requests from Traffic Director, and that lookup is case-sensitive, so Storage-Direct.googleapis.com?force-xds would not resolve to the Interconnect listener anyway. Matching it case-insensitively here would set the Interconnect authority on a target that does not actually reach Interconnect.
Happy to revisit this suggestion.
When
DirectPathXdsOverInterconnectOption(orGOOGLE_CLOUD_ENABLE_DIRECT_PATH_XDS_OVER_INTERCONNECT=true) is enabled with gRPC 1.85 or later,DefaultOptionsGrpc()setsEndpointOptiontogoogle-c2p:///storage-direct.googleapis.com?force-xds, but since #16408 it has defaultedAuthorityOptiontostorage.googleapis.com. An application that supplies that endpoint throughEndpointOptiondirectly gets the same authority from theMergeOptions()fallback. Cloud Storage identifies DirectPath over Interconnect traffic by the:authorityof each RPC; when it isstorage.googleapis.com, requests are routed as regular DirectPath. RPCs still succeed through the standard route, so the feature is silently inactive.The
storage.googleapis.comdefault was chosen for TLS hostname verification, and the TLS target name is now the Interconnect hostname, so no override is needed.This PR changes
DefaultOptionsGrpc()to defaultAuthorityOptiontostorage-direct.googleapis.comwhenever the effective endpoint is aforce-xdstarget for that host and gRPC supportsforce-xds, covering both the option and an application-supplied endpoint. The default is deliberately restricted to thestorage-direct.googleapis.comhost: the service recognizes the Interconnect authority only for that host, and gRPC also uses the authority as the TLS target name and the xDS virtual-host key, so aforce-xdstarget for any other host keeps the standard default. An application-suppliedAuthorityOptionstill takes precedence, and non-Interconnect defaults (including gRPC < 1.85) are unchanged.The option and the environment variable continue to govern only the endpoint the library selects; neither has ever overridden an application-supplied
EndpointOption. An application that targets the Interconnect endpoint itself therefore keeps the Interconnect authority even when the variable isfalse. TheDirectPathXdsOverInterconnectOptiondocumentation now states the default:authority, notes that overridingAuthorityOptionwith a different value disables the feature, and records that neither the option nor the variable changes an application-supplied endpoint. Warning about anAuthorityOptionoverride inLogChannelConfiguration()is left to a follow-up PR.