Skip to content

feat: Add PSC DNS and Global Write Endpoint support to Python Connector#1424

Merged
hessjcg merged 3 commits into
mainfrom
psc-dns-support
Jul 23, 2026
Merged

feat: Add PSC DNS and Global Write Endpoint support to Python Connector#1424
hessjcg merged 3 commits into
mainfrom
psc-dns-support

Conversation

@hessjcg

@hessjcg hessjcg commented May 29, 2026

Copy link
Copy Markdown
Collaborator

The Private Service Connect (PSC) DNS Name Resolution & Fallback feature enables the connector to securely connect to Cloud SQL database instances using Private Service Connect (PSC) DNS and custom domain names (CNAMEs).

The connector can now dial PSC instances using its DNS hostname (e.g., 0123456789ab.fedcba9876543.us-central1.sql-psc.goog) or a custom domain CNAME pointing to the instance PSC DNS hostname. The connectors will dynamically resolve this hostname to its real Cloud SQL instance connection name via the SQL Admin API. Furthermore, if local DNS resolution of this hostname fails (e.g., on local developer networks lacking a private DNS route), the connectors gracefully fall back to dialing the instance's Private or Public IP address dynamically retrieved from metadata.

See also: GoogleCloudPlatform/cloud-sql-go-connector#1106

@hessjcg
hessjcg force-pushed the psc-dns-support branch from 6c79503 to e97e08b Compare May 29, 2026 20:14
@hessjcg hessjcg changed the title Add PSC DNS and Global Write Endpoint support to Python Connector feat: Add PSC DNS and Global Write Endpoint support to Python Connector May 29, 2026
@hessjcg
hessjcg force-pushed the psc-dns-support branch from e97e08b to 54b7048 Compare May 29, 2026 20:27
@hessjcg
hessjcg force-pushed the psc-dns-support branch 2 times, most recently from 70138b1 to 583323a Compare July 15, 2026 19:10
@hessjcg
hessjcg marked this pull request as ready for review July 15, 2026 19:55
@hessjcg
hessjcg requested a review from a team as a code owner July 15, 2026 19:55
@hessjcg
hessjcg force-pushed the psc-dns-support branch 2 times, most recently from f265351 to f42df6b Compare July 23, 2026 19:21
…with Go

- Reject 'global' region in direct PSC DNS resolution in DnsResolver to force CNAME/TXT fallback.
- Remove fallback to Private/Public IP in Connector when DNS fails and preferred IP is a hostname.
- Update test_connector.py to assert no fallback from PSC to Private IP when DNS fails.
- Add test_resolver.py test to verify global region skips direct resolution.
@hessjcg
hessjcg enabled auto-merge (squash) July 23, 2026 22:35
- Add __init__ to DefaultResolver and DnsResolver to accept client in constructor.
- Remove set_client method from DnsResolver.
- Lazy-initialize self._resolver in Connector.connect_async passing the initialized self._client.
- Update tests to use constructor injection instead of set_client.
- Fix lint (ruff) and type checking (mypy) errors.
@hessjcg
hessjcg merged commit b34e9c6 into main Jul 23, 2026
22 of 23 checks passed
@hessjcg
hessjcg deleted the psc-dns-support branch July 23, 2026 22:55
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