Skip to content

xds/googlec2p: enable DirectPath over Interconnect support for on-prem clients#9133

Open
Pranjali-2501 wants to merge 1 commit into
grpc:masterfrom
Pranjali-2501:gci-changes
Open

xds/googlec2p: enable DirectPath over Interconnect support for on-prem clients#9133
Pranjali-2501 wants to merge 1 commit into
grpc:masterfrom
Pranjali-2501:gci-changes

Conversation

@Pranjali-2501
Copy link
Copy Markdown
Contributor

This PR add support for on-premises clients using Google Cloud Interconnect to connect to GCP services via DirectPath by enabling a forced xDS/C2P resolver path.

Changes:

  • Query Parameter Handling: Updates the google-c2p resolver to parse call target URLs for the force-xds query parameter.
  • Metadata Server Bypass: When executing off-GCP, GCE Metadata Server queries for locality zone and IPv6 capability are bypassed to completely prevent 10-second connection timeouts.
  • Bootstrap Config:
    • Omits the GCE locality zone structure from the bootstrap configuration.
    • Hardcodes the TRAFFICDIRECTOR_DIRECTPATH_C2P_IPV6_CAPABLE node metadata flag to true since Interconnect is planned exclusively for IPv6 clients.
    • Formats the xDS Client Node ID using a prefix: "C2P-non-gcp-UUID".

RELEASE NOTES: N/A

@Pranjali-2501 Pranjali-2501 added this to the 1.82 Release milestone May 20, 2026
@Pranjali-2501 Pranjali-2501 added the Type: Behavior Change Behavior changes not categorized as bugs label May 20, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 20, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.23%. Comparing base (6602080) to head (e3231c5).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #9133      +/-   ##
==========================================
+ Coverage   83.20%   83.23%   +0.02%     
==========================================
  Files         414      414              
  Lines       33489    33500      +11     
==========================================
+ Hits        27865    27884      +19     
+ Misses       4214     4203      -11     
- Partials     1410     1413       +3     
Files with missing lines Coverage Δ
xds/googledirectpath/googlec2p.go 90.21% <100.00%> (+1.32%) ⬆️

... and 20 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Pranjali-2501 Pranjali-2501 requested review from easwars and mbissa May 20, 2026 04:49
@easwars easwars removed their assignment May 20, 2026
@easwars
Copy link
Copy Markdown
Contributor

easwars commented May 20, 2026

Unassigning myself for the first review from @mbissa to complete.

@mbissa
Copy link
Copy Markdown
Contributor

mbissa commented May 22, 2026

/gemini review

Copy link
Copy Markdown
Contributor

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

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 non-GCE environments in the google-c2p resolver via a force-xds query parameter and updates node configuration logic to handle off-GCP scenarios. The review feedback identifies several improvement opportunities: validating the boolean value of the force-xds parameter to prevent forcing xDS when set to 'false', using buffered channels for goroutines to avoid potential leaks, and ensuring the node ID implementation aligns with the PR description's requirement for UUIDs instead of random integers.

Comment on lines +139 to +140
isGCE := onGCE()
_, forceXds := t.URL.Query()["force-xds"]
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.

medium

The current implementation checks for the presence of the force-xds query parameter but does not validate its value. This means that a URI like google-c2p:///target?force-xds=false would still force the xDS path, which is counter-intuitive. Consider checking the value of the parameter to ensure it is not explicitly set to false.

isGCE := onGCE()
q := t.URL.Query()
forceXds := len(q["force-xds"]) > 0 && q.Get("force-xds") != "false"

// This should be fine in most of the cases. In certain error cases, this
// could block Dial() for up to 10 seconds (each blocking call has its own
// goroutine).
zoneCh, ipv6CapableCh := make(chan string), make(chan bool)
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.

medium

It is a best practice in Go to use buffered channels when a goroutine is expected to send a single value and then terminate. This prevents the goroutine from leaking if the receiver (the main thread in Build) were to stop waiting for any reason (e.g., a panic elsewhere).

Suggested change
zoneCh, ipv6CapableCh := make(chan string), make(chan bool)
zoneCh, ipv6CapableCh := make(chan string, 1), make(chan bool, 1)

node := map[string]any{
"id": fmt.Sprintf("C2P-%d", randInt()),
"locality": map[string]any{"zone": zone},
"id": fmt.Sprintf("%s-%d", prefix, randInt()),
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.

medium

The pull request description mentions that the xDS Client Node ID should use a UUID as a suffix (e.g., C2P-non-gcp-UUID), but the implementation continues to use a random integer from randInt(). If a UUID is required for uniqueness across clients in the service mesh, consider using a more robust identifier as stated in the PR description.

Comment on lines +687 to +689
desc: "query_param_value_false",
rawQuery: "force-xds=false",
},
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.

medium

This test case expects force-xds=false to successfully trigger the xDS resolver path. If the implementation is updated to respect the boolean value of the query parameter, this test case should be moved to a separate test that verifies the fallback to DNS behavior.

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

Labels

Type: Behavior Change Behavior changes not categorized as bugs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants