Skip to content

Spanner: Extend SpannerIO to support Spanner Omni mTLS setup#38928

Open
sagnghos wants to merge 4 commits into
apache:masterfrom
sagnghos:spannerOmni/mTLS
Open

Spanner: Extend SpannerIO to support Spanner Omni mTLS setup#38928
sagnghos wants to merge 4 commits into
apache:masterfrom
sagnghos:spannerOmni/mTLS

Conversation

@sagnghos

Copy link
Copy Markdown
Contributor

This PR introduces capabilities to connect to Spanner Omni endpoints using mTLS and enables the integration test suite to validate against Spanner Omni.

To run IT against Spanner Omni:

  • plain-text setup
SPANNER_OMNI_USE_PLAIN_TEXT=true SPANNER_OMNI_ENDPOINT=http://localhost:15000 ./gradlew :sdks:java:io:google-cloud-platform:integrationTest --tests "org.apache.beam.sdk.io.gcp.spanner.*IT" --info
  • TLS setup
SPANNER_OMNI_ENDPOINT=http://localhost:15000 ./gradlew :sdks:java:io:google-cloud-platform:integrationTest --tests "org.apache.beam.sdk.io.gcp.spanner.*IT" --info
  • mTLS setup
SPANNER_OMNI_CLIENT_CERT=/tmp/omni/certs/client.crt SPANNER_OMNI_CLIENT_KEY=/tmp/omni/certs/client.key.pkcs8 SPANNER_OMNI_ENDPOINT=http://localhost:15000 ./gradlew :sdks:java:io:google-cloud-platform:integrationTest --tests "org.apache.beam.sdk.io.gcp.spanner.*IT" --info

GitHub Actions Tests Status (on master branch)

Build python source distribution and wheels
Python tests
Java tests
Go tests

See CI.md for more information about GitHub Actions CI or the workflows README to see a list of phrases to trigger workflows.

@sagnghos

Copy link
Copy Markdown
Contributor Author

/gemini review

@sagnghos sagnghos changed the title Spanner: Extend SpannerIO to support Spanner OMNI mTLS setup Spanner: Extend SpannerIO to support Spanner Omni mTLS setup Jun 11, 2026

@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 mTLS client certificates (certificate path and key path) across the Beam Spanner connector, including SpannerIO, SpannerConfig, SpannerAccessor, and cross-language configurations, to enable native Spanner Omni support. It also updates integration tests to use a new SpannerTestHelper. The review feedback identifies several key issues: the client certificate configuration in SpannerAccessor is incorrectly nested inside the plainText block and will be skipped by default; unconditionally setting NoCredentials in SpannerConfig.withExperimentalHost creates order-dependency; validation is needed in SpannerTransformRegistrar to prevent silent failures when only one certificate parameter is provided; SpannerTestHelper should explicitly set NoCredentials in Omni mode to avoid ADC loading issues; and MetadataSpannerConfigFactory should pass ValueProviders directly rather than calling .get().

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@sagnghos sagnghos marked this pull request as ready for review June 12, 2026 04:47
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enables mTLS authentication for Spanner Omni by extending the SpannerConfig and SpannerIO APIs. It provides a standardized way to pass client certificate and key paths, ensuring secure connectivity for Spanner Omni users. Additionally, it refactors the integration test suite to dynamically support Spanner Omni configurations, facilitating easier validation in secure environments.

Highlights

  • mTLS Support for Spanner Omni: Added support for configuring client certificates and keys in SpannerConfig to enable mTLS connections to Spanner Omni.
  • API Extensions: Extended SpannerIO transforms (Read, Write, ReadAll, etc.) to allow users to specify mTLS credentials via new withClientCert methods.
  • Integration Test Improvements: Introduced SpannerTestHelper to centralize Spanner Omni configuration and updated existing integration tests to support mTLS-enabled environments.
New Features

🧠 You can now enable Memory (public preview) to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@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 configuring mTLS client certificates (via certificate and key paths) in SpannerConfig, SpannerIO, and cross-language configurations to natively support Spanner Omni. It also introduces SpannerTestHelper to simplify integration test setup when running against Spanner Omni. Feedback on the changes highlights two key issues: first, unconditionally setting NoCredentials in withExperimentalHost introduces order-dependency in the fluent API, which could silently overwrite user-provided credentials; second, calling .get() on the clientCert and clientKey ValueProvider instances in SpannerAccessor without checking isAccessible() first may throw an IllegalStateException during pipeline construction.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@github-actions

Copy link
Copy Markdown
Contributor

Assigning reviewers:

R: @ahmedabu98 for label java.
R: @nielm for label spanner.

Note: If you would like to opt out of this review, comment assign to next reviewer.

Available commands:

  • stop reviewer notifications - opt out of the automated review tooling
  • remind me after tests pass - tag the comment author after tests pass
  • waiting on author - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)

The PR bot will only process comments in the main thread (not review comments).

@nielm nielm 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.

LGTM

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.

2 participants