Skip to content

feat(storage): add support for DirectPath over Interconnect - #14006

Open
nidhiii-27 wants to merge 12 commits into
mainfrom
add-dp-over-gci
Open

feat(storage): add support for DirectPath over Interconnect#14006
nidhiii-27 wants to merge 12 commits into
mainfrom
add-dp-over-gci

Conversation

@nidhiii-27

Copy link
Copy Markdown
Contributor
  • DirectPath over Interconnect Support (GAX): Added the attemptDirectPathXdsOverInterconnect option to enable on-premise xDS name resolution via the google-c2p:///<service>?force-xds target scheme.
  • GCP Platform Check Bypass: Modified DirectPath validation logic to bypass standard Google Compute Engine (GCE) environment checks when Interconnect is enabled.
  • Custom URI Validation: Enhanced endpoint validation to support and validate custom target URI formats containing the :/// syntax (e.g. google-c2p:///).
  • Storage Layer Integration: Added configuration options to GrpcStorageOptions to automatically rewrite hosts to storage-direct.googleapis.com and override the request authority to storage.googleapis.com for secure TLS handshakes.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces support for DirectPath xDS over Interconnect (on-premise xDS name resolution) in GrpcStorageOptions and InstantiatingGrpcChannelProvider, allowing GCE environment checks to be bypassed when enabled. It also updates endpoint validation to support custom URI schemes like google-c2p:/// and adds corresponding tests. The reviewer suggests dynamically adjusting the log level for the DirectPath fallback warning to avoid excessive warning spam in non-GCE environments, recommending Level.WARNING on GCE and Level.FINE elsewhere.

@nidhiii-27
nidhiii-27 marked this pull request as ready for review August 6, 2026 08:45
@nidhiii-27
nidhiii-27 requested review from a team as code owners August 6, 2026 08:45
@snippet-bot

snippet-bot Bot commented Sep 4, 2026

Copy link
Copy Markdown

No region tags are edited in this PR.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment

fix spanner tests failing due to overridden authority for default builder branch

[Generated-by: AI]
"Bypassed because DirectPath over Interconnect (GCI) requires a specialized hybrid network environment (Interconnect and Traffic Director configured for storage-direct) and cannot be validated in standard CI or local workstations.")
@Test
public void clientShouldWork_directPathXdsOverInterconnect() throws Exception {
assumeTrue(

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

nit: having @ignore alongside assumeTrue is redundant because JUnit skips @ignore methods unconditionally at discovery time before assumeTrue can run.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We kept assumeTrue alongside @Ignore as an intentional defensive safeguard: storage-direct.googleapis.com is only resolvable in private Interconnect environments and fails name resolution on standard workstations and public CI runners. If @Ignore is lifted in the future (or if tests are executed by a runner that enables ignored tests), assumeTrue ensures the test skips gracefully with an AssumptionViolatedException rather than breaking CI with an UnknownHostException.

Co-authored by AI Agent

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Could we add a comment in the test noting that assumeTrue is intentionally kept as a second-line dynamic guard so future refactors don't clean it up as redundant?

…nect

- Generalize DirectPath over Interconnect host and authority handling in InstantiatingGrpcChannelProvider for any service using -direct. convention
- Rethrow RuntimeException in extractTargetFromChannelBuilder to surface reflection errors in CI
- Remove unused DEFAULT_HOST_DIRECT_PATH constant in GrpcStorageOptions
- Add generic non-GCS unit tests in InstantiatingGrpcChannelProviderTest

[Generated-by: AI]
- Define DIRECT_PATH_INTERCONNECT_INFIX constant to eliminate duplicated "-direct." string literals
- Add explanatory comment in empty catch block of extractAuthorityFromChannelBuilder

[Generated-by: AI]
…on in tests

- Remove unintended positive test filter from Surefire plugin configuration in gax-grpc/pom.xml, allowing all standard unit tests in InstantiatingGrpcChannelProviderTest to run and restore code coverage.
- Inspect authorityOverride field and unwrap builder delegates in InstantiatingGrpcChannelProviderTest#extractAuthorityFromChannelBuilder.

[Generated-by: AI]
Replace 4 duplicate invalid endpoint tests with a single parameterized test to address SonarCloud java:S5976.

[Generated-by: AI]
@sonarqubecloud

sonarqubecloud Bot commented Sep 7, 2026

Copy link
Copy Markdown

@sonarqubecloud

sonarqubecloud Bot commented Sep 7, 2026

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed for 'gapic-generator-java-root'

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

}
if (rest.startsWith(oldHost)) {
int len = oldHost.length();
if (rest.length() == len || rest.charAt(len) == ':' || rest.charAt(len) == '/') {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

A host/authority component can also be immediately followed by a query delimiter (?) or fragment delimiter (#) (e.g., https://storage.googleapis.com?query=val).

Should we include ? and # to ensure full RFC compliance?

java.lang.reflect.Field field = null;
while (clazz != null) {
try {
field = clazz.getDeclaredField("authority");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

IIUC, we can eliminate reflection entirely by using Mockito with RETURNS_SELF on ManagedChannelBuilder.

"Bypassed because DirectPath over Interconnect (GCI) requires a specialized hybrid network environment (Interconnect and Traffic Director configured for storage-direct) and cannot be validated in standard CI or local workstations.")
@Test
public void clientShouldWork_directPathXdsOverInterconnect() throws Exception {
assumeTrue(

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Could we add a comment in the test noting that assumeTrue is intentionally kept as a second-line dynamic guard so future refactors don't clean it up as redundant?

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.

3 participants