Skip to content

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

Draft
hessjcg wants to merge 1 commit into
mainfrom
psc-dns-support
Draft

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

Conversation

@hessjcg
Copy link
Copy Markdown
Collaborator

@hessjcg hessjcg commented May 29, 2026

Add PSC DNS and Global Write Endpoint support to Python Connector

  • Implement resolve_cname and resolve_txt async wrappers inside DnsResolver.
  • Implement SetClient in DnsResolver to inject the lazy-loaded CloudSQLClient.
  • Update DnsResolver.resolve() to intercept direct PSC DNS names and call resolve_connect_settings() API.
  • Handle CNAME recursive resolution loop recursion-free (max 10 depth) inside resolve(), checking loop circularity.
  • Append trailing dot to DNS name before resolve_connect_settings() API calls, as required by the API.
  • Implement resolve_connect_settings() inside CloudSQLClient to fetch metadata on ConnectSettings resolve REST endpoint.
  • Implement _get_fallback_ip() and _is_ip_address() helpers in connector.py.
  • Update connector.py connect_async() to support fallback to Private/Primary (Public) IP from metadata if CNAME/PSC DNS resolution fails and metadata preferred address is a hostname.
  • Add comprehensive unit tests for direct PSC DNS, simple CNAME to PSC, recursive CNAMEs, and CNAME loop detection in test_resolver.py.
  • Add test_Connector_connect_async_custom_dns_resolver_fallback_psc_to_private_ip unit test to test_connector.py.

TAG=agy
CONV=0b6ef4f2-88db-48b8-9bb9-54cd56459291

@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
- Implement resolve_cname and resolve_txt async wrappers inside DnsResolver.
- Implement SetClient in DnsResolver to inject the lazy-loaded CloudSQLClient.
- Update DnsResolver.resolve() to intercept direct PSC DNS names and call resolve_connect_settings() API.
- Handle CNAME recursive resolution loop recursion-free (max 10 depth) inside resolve(), checking loop circularity.
- Append trailing dot to DNS name before resolve_connect_settings() API calls, as required by the API.
- Implement resolve_connect_settings() inside CloudSQLClient to fetch metadata on ConnectSettings resolve REST endpoint.
- Implement _get_fallback_ip() and _is_ip_address() helpers in connector.py.
- Update connector.py connect_async() to support fallback to Private/Primary (Public) IP from metadata if CNAME/PSC DNS resolution fails and metadata preferred address is a hostname.
- Add comprehensive unit tests for direct PSC DNS, simple CNAME to PSC, recursive CNAMEs, and CNAME loop detection in test_resolver.py.
- Add test_Connector_connect_async_custom_dns_resolver_fallback_psc_to_private_ip unit test to test_connector.py.

TAG=agy
CONV=0b6ef4f2-88db-48b8-9bb9-54cd56459291
@hessjcg hessjcg force-pushed the psc-dns-support branch from e97e08b to 54b7048 Compare May 29, 2026 20:27
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.

1 participant