shahar1 commented on code in PR #73646:
URL: https://github.com/apache/airflow/pull/73646#discussion_r4472003952


##########
providers/google/docs/connections/gcp_sql.rst:
##########
@@ -78,6 +78,32 @@ Extra (optional)
 
         export 
AIRFLOW_CONN_GOOGLE_CLOUD_SQL_DEFAULT='gcpcloudsql://user:[email protected]:3306/mydb?database_type=mysql&project_id=example-project&location=europe-west1&instance=testinstance&use_proxy=True&sql_proxy_use_tcp=False'
 
+Using Cloud SQL Auth Proxy v2
+-----------------------------
+
+By default Airflow runs Cloud SQL Auth Proxy v1. To run Cloud SQL Auth Proxy 
v2 instead, set

Review Comment:
   nit: This PR closes #72681, but nothing here tells a MySQL 8.4 user that v2 
is the fix. They would start from a `1045 Access denied` after an instance 
restart, and because the default stays v1 they have to opt in. Could you add a 
sentence saying that Cloud SQL for MySQL 8.4 users on `caching_sha2_password` 
need v2?



##########
providers/google/docs/connections/gcp_sql.rst:
##########
@@ -78,6 +78,32 @@ Extra (optional)
 
         export 
AIRFLOW_CONN_GOOGLE_CLOUD_SQL_DEFAULT='gcpcloudsql://user:[email protected]:3306/mydb?database_type=mysql&project_id=example-project&location=europe-west1&instance=testinstance&use_proxy=True&sql_proxy_use_tcp=False'
 
+Using Cloud SQL Auth Proxy v2
+-----------------------------
+
+By default Airflow runs Cloud SQL Auth Proxy v1. To run Cloud SQL Auth Proxy 
v2 instead, set
+``"sql_proxy_major_version": 2`` in the ``extra`` field. ``sql_proxy_version`` 
must also be set to the v2
+release to download, as there is no "latest" download for v2, unless the 
``sql_proxy_binary_path`` argument

Review Comment:
   nit: `--auto-ip` first shipped in proxy v2.2.0, but 
`CLOUD_SQL_PROXY_V2_VERSION_REGEX` also accepts v2.0.0 to v2.1.2. Those 
releases should exit on the unknown flag, and the task would then fail with 
`The cloud_sql_proxy finished early`. The same applies to an older binary 
passed through `sql_proxy_binary_path`. Could you say "v2.2.0 or newer" here?



##########
providers/google/docs/connections/gcp_sql.rst:
##########
@@ -78,6 +78,32 @@ Extra (optional)
 
         export 
AIRFLOW_CONN_GOOGLE_CLOUD_SQL_DEFAULT='gcpcloudsql://user:[email protected]:3306/mydb?database_type=mysql&project_id=example-project&location=europe-west1&instance=testinstance&use_proxy=True&sql_proxy_use_tcp=False'
 
+Using Cloud SQL Auth Proxy v2
+-----------------------------
+
+By default Airflow runs Cloud SQL Auth Proxy v1. To run Cloud SQL Auth Proxy 
v2 instead, set
+``"sql_proxy_major_version": 2`` in the ``extra`` field. ``sql_proxy_version`` 
must also be set to the v2
+release to download, as there is no "latest" download for v2, unless the 
``sql_proxy_binary_path`` argument
+of the hook or operator points to an existing v2 binary.
+
+Cloud SQL Auth Proxy v2 connects only to the instance's public IP by default, 
while v1 falls back to the
+private IP when the instance has no public IP. Airflow passes ``--auto-ip`` to 
v2 to keep the v1 behavior,
+so instances with only a private IP work with both versions.

Review Comment:
   minor: `--auto-ip` covers the IP difference, but two authentication 
differences between v1 and v2 are still undocumented.
   
   - When the connection has no `key_path` or `keyfile_dict`, v1 tries gcloud's 
active account first and then Application Default Credentials 
(`authenticatedClient` in v1.37.0). v2 uses Application Default Credentials 
only, unless `--gcloud-auth` is passed, and Airflow doesn't pass it. So a 
worker authenticated only through `gcloud auth login` or `gcloud auth 
activate-service-account` can work on v1 and then fail, or use a different 
identity, on v2. The existing log line in `_get_credential_parameters` 
("Falling back to default activated account") is also inaccurate for v2.
   - As you noted in #72681, v2 attributes its SQL Admin API calls to the 
credentials' quota project, which can produce a `403 SERVICE_DISABLED` naming 
an unrelated project.
   
   Could you add a short note here covering both? I got the first point from 
the proxy's sources and docs and didn't run it, so please correct me if the 
real binary behaves differently.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to