Skip to content

feat(storage): support DirectPath over Interconnect in GCS gRPC - #18431

Open
nidhiii-27 wants to merge 5 commits into
googleapis:mainfrom
nidhiii-27:feat/storage-directpath-interconnect
Open

nidhiii-27 wants to merge 5 commits into
googleapis:mainfrom
nidhiii-27:feat/storage-directpath-interconnect

Conversation

@nidhiii-27

@nidhiii-27 nidhiii-27 commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds support for DirectPath over Cloud Interconnect (attempt_direct_path_xds_over_interconnect / GOOGLE_CLOUD_ENABLE_DIRECT_PATH_XDS_OVER_INTERCONNECT) across google-api-core and google-cloud-storage (GrpcClient and AsyncGrpcClient), aligned with Go (googleapis/google-cloud-go#20559), Java (googleapis/google-cloud-java#14006), and C++ (googleapis/google-cloud-cpp#16408).

Key Changes

  • google-api-core (grpc_helpers.py & grpc_helpers_async.py):
    • Adds attempt_direct_path_xds_over_interconnect parameter and GOOGLE_CLOUD_ENABLE_DIRECT_PATH_XDS_OVER_INTERCONNECT environment variable resolution (_resolve_direct_path_interconnect) with case-insensitive/whitespace-normalized boolean parsing ("true" / "false") and fast-fail ValueError on invalid values.
    • Configures standard TLS credentials (grpc.ssl_channel_credentials()) by default when attempt_direct_path_xds_over_interconnect is enabled while allowing custom ssl_credentials.
    • Appends ?force-xds (or &force-xds) to google-c2p:/// targets in _modify_target_for_direct_path, and strips dns:///, https://, and http:// scheme prefixes as well as path segments before port splitting.
    • Injects ("grpc.ssl_target_name_override", authority) (e.g. storage.googleapis.com) into channel options when connecting to -direct.googleapis.com endpoints over DirectPath over Cloud Interconnect.
    • Rewrites -direct.googleapis.com endpoints back to .googleapis.com when falling back to CloudPath (attempt_direct_path=False and attempt_direct_path_xds_over_interconnect=False).
  • google-cloud-storage (GrpcClient & AsyncGrpcClient):
    • Exposes attempt_direct_path_xds_over_interconnect and GOOGLE_CLOUD_ENABLE_DIRECT_PATH_XDS_OVER_INTERCONNECT, rewrites storage.googleapis.com to storage-direct.googleapis.com, and forwards credentials and quota_project_id to transport_cls.create_channel.
  • Unit Tests:
    • Comprehensive unit tests in test_grpc_helpers.py, test_grpc_helpers_async.py, test_grpc_client.py, and test_async_grpc_client.py.

Generated by AI Agent

Add support for DirectPath over Cloud Interconnect (DP over GCI) across
google.api_core.grpc_helpers, google.api_core.grpc_helpers_async,
google.cloud.storage.grpc_client.GrpcClient, and
google.cloud.storage.asyncio.async_grpc_client.AsyncGrpcClient.

- Add attempt_direct_path_xds_over_interconnect option and
  GOOGLE_CLOUD_ENABLE_DIRECT_PATH_XDS_OVER_INTERCONNECT env override.
- Synthesize standard TLS composite credentials instead of GCE ALTS when
  DirectPath over Interconnect is enabled.
- Rewrite storage.googleapis.com to storage-direct.googleapis.com and
  append ?force-xds to google-c2p:/// target URIs.

[Generated-by: AI]

@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 adds support for DirectPath over Cloud Interconnect using xDS and standard TLS credentials across both synchronous and asynchronous gRPC helpers in google-api-core and the gRPC client in google-cloud-storage. Key feedback includes fixing a target rewriting bug where dns:/// prefixes cause conversion to be skipped, restricting the unsafe replacement of -direct. to only target -direct.googleapis.com to avoid corrupting custom user endpoints, and improving environment variable parsing to handle case-insensitivity and raise errors on invalid configuration values.

Comment thread packages/google-api-core/google/api_core/grpc_helpers.py
Comment thread packages/google-api-core/google/api_core/grpc_helpers.py Outdated
Comment thread packages/google-api-core/google/api_core/grpc_helpers_async.py Outdated
Comment thread packages/google-api-core/google/api_core/grpc_helpers.py Outdated
Comment thread packages/google-cloud-storage/google/cloud/storage/grpc_client.py Outdated
Ensure 100% test coverage for _resolve_direct_path_interconnect and
_create_composite_credentials in google.api_core.grpc_helpers.

[Generated-by: AI]
@nidhiii-27

Copy link
Copy Markdown
Contributor Author

/gcbrun

…authority override

- Normalize casing and whitespace in _resolve_direct_path_interconnect and raise ValueError on invalid values
- Inject grpc.ssl_target_name_override authority override for -direct.googleapis.com endpoints when DirectPath over Interconnect is enabled
- Restrict CloudPath fallback host replacement to -direct.googleapis.com -> .googleapis.com
- Strip dns:///, https://, and http:// scheme prefixes and path components in _modify_target_for_direct_path
- Forward credentials and quota_project_id in GrpcClient._create_gapic_client when attempt_direct_path_xds_over_interconnect is enabled

[Generated-by: AI]
…erride branches

Add unit tests for _extract_direct_path_authority and authority override
branches in grpc_helpers and grpc_helpers_async to restore 100% coverage.

[Generated-by: AI]
@nidhiii-27
nidhiii-27 marked this pull request as ready for review September 23, 2026 06:09
@nidhiii-27
nidhiii-27 requested review from a team as code owners September 23, 2026 06:09
@nidhiii-27

Copy link
Copy Markdown
Contributor Author

/gcbrun(d8a2d4e)

@nidhiii-27

Copy link
Copy Markdown
Contributor Author

/gcbrun(0596f2e)

@nidhiii-27

Copy link
Copy Markdown
Contributor Author

/gcbrun

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant