Repository navigation
Conversation
Add a --gcs_endpoint flag. gcsx clients now pass the endpoint and the universe domain, taken from GOOGLE_CLOUD_UNIVERSE_DOMAIN or the default credentials, to storage.NewClient. This allows GCS access in Trusted Partner Cloud (TPC).
Replace the deprecated df.New with df.NewService, passing --dataflow_endpoint via option.WithEndpoint and the universe domain from GOOGLE_CLOUD_UNIVERSE_DOMAIN or the default credentials. Share the universe domain resolution with the GCS client via gcpopts.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #40686 +/- ##
=============================================
- Coverage 56.16% 28.89% -27.28%
=============================================
Files 1124 381 -743
Lines 178336 71176 -107160
Branches 1489 0 -1489
=============================================
- Hits 100170 20564 -79606
+ Misses 75645 48756 -26889
+ Partials 2521 1856 -665
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
📋 Review Summary
This PR adds support for non-default Google Cloud universes (such as Trusted Partner Cloud) in the Go SDK's GCS and Dataflow clients by propagating the universe domain from GOOGLE_CLOUD_UNIVERSE_DOMAIN or default credentials via option.WithUniverseDomain, and introduces a --gcs_endpoint flag/pipeline option override. The implementation is clean, well-structured, and includes appropriate caching and unit tests.
🔍 General Feedback
- The caching strategy in
gcpopts.GetUniverseDomainproperly avoids caching credential lookup failures while preventing repeated metadata server calls. - Migrating
dataflowlib.NewClientfrom deprecateddf.Newtodf.NewServicewithoption.ClientOptions and switching the Dataflow runner's soft-delete check togcsx.NewClientensures consistent endpoint and universe handling across the SDK.
💡 Tip: Comment /gemini review on this pull request to trigger a new Gemini code review.
|
Assigning reviewers: R: @lostluck for label go. Note: If you would like to opt out of this review, comment Available commands:
The PR bot will only process comments in the main thread (not review comments). |
Part of #40569
Summary
The Go SDK's GCS and Dataflow clients default to *.googleapis.com endpoints, causing failures in non-default universes like Trusted Partner Cloud (TPC) due to universe-mismatch errors or hardcoded URLs.
Following the Python fix (#40674), this PR adds non-default universe support and introduces a
--gcs_endpointoverride (aligning with Java's--gcsEndpointand the existing--dataflow_endpoint).Changes
Behavior changes
df.NewService) instead ofoauth2/google. A mismatch between the client's and the credentials' universe now fails with a clear error instead of a confusing server-side failure.--dataflow_endpointvalue containing://is used as-is, as before. A barehost[:port]is now combined with the default endpoint. Previously it was set asBasePathdirectly and produced an invalid URL.googleapis.com) when no flags or env vars are set.Usage in TPC
Either rely on the universe domain from the credentials or the env var:
or set the endpoints explicitly: