feat(connections): native Cloud SQL Auth Proxy integration#1844
Open
datlechin wants to merge 1 commit into
Open
feat(connections): native Cloud SQL Auth Proxy integration#1844datlechin wants to merge 1 commit into
datlechin wants to merge 1 commit into
Conversation
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1728.
Adds native Google Cloud SQL Auth Proxy support so Cloud SQL users no longer run
cloud-sql-proxyin a terminal and hand-point a connection at its port. TablePro starts the proxy when you connect and stops it when you disconnect, the same way it manages SSH and Cloudflare tunnels.Design
The proxy is a per-connection transport attribute (
cloudSQLProxyModeonDatabaseConnection), not aDatabaseType: a Cloud SQL instance is still MySQL, PostgreSQL, or SQL Server, and only the network path differs. It mirrors the existing Cloudflare tunnel end to end.CloudSQLProxyManager(an actor) supervises thecloud-sql-proxyprocess, allocates a free loopback port, waits for readiness with a TCP probe plus an stderr scan, then reuses the sharedtunneledConnection(from:localPort:)rewrite unchanged. On disconnect, quit, or process death it is torn down, with the same PID-persist and stale-PID sweep the Cloudflare path uses.Binary provisioning: resolves
cloud-sql-proxyfrom PATH, Homebrew, or the gcloud SDK first; otherwise a "Download" button in the pane fetches Google's binary, verifies a hardcoded SHA-256 pin (v2.23.0), and strips quarantine. Google's macOS binaries are not Apple-notarized, so a locally installed one is preferred.Authentication: Application Default Credentials, a service account key (stored in the Keychain, written to a
0600temp file only while the proxy runs and never passed on the command line), and IAM database authentication (--auto-iam-authn).Shared tunnel dispatch (and two bug fixes)
Eight
DatabaseManagersites used to hand-enumerate "SSH or Cloudflare?" by name. They now share oneTunnelManagingprotocol (both tunnel actors already satisfy it) plusDatabaseConnection.activeTunnelKind/enabledTunnelKindsandactiveTunnelManager(for:). Two of those sites only ever closed the SSH tunnel, so a failed test connection or a cancelled connect leaked thecloudflaredprocess; the shared dispatch fixes both. Mutual exclusivity is now an N-way check.Shared subprocess plumbing was extracted so it isn't written twice:
CloudflaredProcessbecame the genericSupervisedProcessRunner, and the loopback port helpers becameLoopbackPort.Tests
ConnectionTunnelKindacross every SSH/Cloudflare/proxy combination.CloudSQLProxyManageragainst a fake runner: readiness, startup failure, invalid instance, missing binary, service-account-key file lifecycle (written0600, removed on close), terminate, and stale-PID sweep.CloudSQLProxyBinaryManager: checksum match installs, mismatch is rejected, and an installed binary short-circuits without fetching.Docs and changelog
New
docs/databases/cloud-sql-proxy.mdx, plus CHANGELOGAdded(feature) andFixed(the Cloudflare process leak) entries.Notes
swiftlint lint --strictis clean on the changed files.