Skip to content

feat: Add PSC DNS and Global Write Endpoint support to NodeJS Connector#593

Open
hessjcg wants to merge 1 commit into
mainfrom
feat-psc-dns
Open

feat: Add PSC DNS and Global Write Endpoint support to NodeJS Connector#593
hessjcg wants to merge 1 commit into
mainfrom
feat-psc-dns

Conversation

@hessjcg

@hessjcg hessjcg commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

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

The connector can now dial PSC instances using:

Its regional DNS hostname (e.g., 0123456789ab.fedcba9876543.us-central1.sql-psc.goog)
A custom domain CNAME pointing to the instance PSC DNS hostname
A Global Write Endpoint DNS hostname (e.g., 0123456789ab.fedcba9876543.global.sql-psc.goog)
The connectors will dynamically resolve this hostname to its real Cloud SQL instance connection name via the SQL Admin API.

For Global Write Endpoints (which use the "global" region in their DNS name), the resolver bypasses direct API resolution (as "global" is not a valid API region) and forces fallback to CNAME resolution. This CNAME should point to the active regional instance DNS hostname, enabling automatic failover.

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

@hessjcg
hessjcg requested a review from a team as a code owner July 24, 2026 20:15
@google-cla

google-cla Bot commented Jul 24, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

This change implements Private Service Connect (PSC) DNS Name Resolution & Fallback feature for the NodeJS connector, allowing it to securely connect to Cloud SQL database instances using PSC DNS hostnames, custom domain names (CNAMEs), and Global Write Endpoints.

- Updated dns-lookup.ts to support CNAME resolution and return sorted TXT records.
- Updated sqladmin-fetcher.ts to implement resolveConnectSettings calling the SQL Admin API endpoint.
- Updated parse-instance-connection-name.ts with the resolution algorithm:
  - Match well-known DNS pattern and resolve via SQL Admin API.
  - Fallback to TXT records.
  - Fallback to CNAME records (up to depth 10 to prevent loops).
- Updated tests and mocks to verify the new resolution logic.
Comment thread src/cloud-sql-instance.ts
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.

2 participants