Skip to content

Add Cloud SQL Auth Proxy v2 mode to CloudSqlProxyRunner - #72785

Closed
kokhlo wants to merge 2 commits into
apache:mainfrom
kokhlo:fix/cloud-sql-proxy-v2
Closed

kokhlo wants to merge 2 commits into
apache:mainfrom
kokhlo:fix/cloud-sql-proxy-v2

Conversation

@kokhlo

@kokhlo kokhlo commented Sep 9, 2026 •

Copy link
Copy Markdown

Description

Adds a sql_proxy_major_version option to CloudSqlProxyRunner (default 1 — behavior unchanged) that opts into running the Cloud SQL Auth Proxy v2 binary.

Why

The runner is hard-wired to Auth Proxy v1: CLOUD_SQL_PROXY_DOWNLOAD_URL/CLOUD_SQL_PROXY_VERSION_DOWNLOAD_URL point at the v1 buckets, and _build_command_line_parameters() emits -dir and -instances, both removed in v2. v1 cannot complete caching_sha2_password full authentication — on Cloud SQL for MySQL 8.4 (where it is the default and mysql_native_password is unavailable, ERROR 4052) the first connection after a server restart, failover or maintenance event fails with 1045 Access denied. Auth Proxy v1 no longer receives development; its startup banner recommends v2.

Reported in #72681.

What changes

  • sql_proxy_major_version=2 builds the v2 command line: --unix-socket <dir> + positional instance connection name, --auto-iam-authn when sql_proxy_enable_iam_login is set.
  • v2 downloads come from GitHub releases (GoogleCloudPlatform/cloud-sql-proxy), validated by a v2-specific version regex; an explicit sql_proxy_version is required in v2 mode (no legacy 'latest' alias exists for the new binary layout).
  • start_proxy also accepts the v2 ready-line ("ready to accept new connections") alongside the v1 one.
  • Unknown major versions are rejected with a clear error.

Tests

6 new unit tests in providers/google/tests/unit/google/cloud/hooks/test_cloud_sql.py (v2 command line, IAM mapping, download URL, v1-style version rejection, version requirement, unknown major version rejection).

TestCloudSqlProxyRunner (all, incl. 6 new) .... 18 passed
full file ..................................... 132 passed, 6 env-related failures identical on clean main (baseline-verified via git stash)

Related

Closes #72681

The runner was hard-wired to Auth Proxy v1, whose download URLs,
-dir/-instances flag set and binary layout cannot complete
caching_sha2_password full authentication on Cloud SQL for MySQL
8.4 — the first connection after a server restart, failover or
maintenance event fails with 1045 Access denied, and the account
cannot be moved back to mysql_native_password (ERROR 4052).

A new sql_proxy_major_version option (default 1, unchanged) opts
into the v2 binary: GitHub-releases download URL with its own
version regex, --unix-socket + positional instance instead of
-dir/-instances, --auto-iam-authn for IAM login, and the v2
ready-line on startup.
@kokhlo
kokhlo requested a review from shahar1 as a code owner September 9, 2026 08:06
@shahar1 shahar1 changed the title fix(google): add Cloud SQL Auth Proxy v2 mode to CloudSqlProxyRunner Add Cloud SQL Auth Proxy v2 mode to CloudSqlProxyRunner Sep 15, 2026

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

Welcome to Apache Airflow!
I'd kindly ask to read our guidelines regarding AI-assisted contributions, and include an AI attribution section in the PR body according to the existing template.

@@ -0,0 +1,22 @@
Google provider: ``CloudSqlProxyRunner`` can now run Cloud SQL Auth Proxy v2

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.

Could you please remove this file? (currently we don't use newsfragments for changes in providers)

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 5 days if no further activity occurs. Thank you for your contributions.

@github-actions github-actions Bot added the stale Stale PRs per the .github/workflows/stale.yml policy file label Nov 4, 2026
@shahar1

shahar1 commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Closing in favor of #73646

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stale Stale PRs per the .github/workflows/stale.yml policy file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CloudSqlProxyRunner cannot authenticate against Cloud SQL for MySQL 8.4 (caching_sha2_password full auth fails on Auth Proxy v1)

2 participants