From a206b5b41bc9a8309e9467d0db9a64a9bba9e035 Mon Sep 17 00:00:00 2001 From: jackwotherspoon Date: Mon, 24 Jul 2023 13:01:26 +0000 Subject: [PATCH 1/3] chore(cloud-sql): update GKE sample comments --- cloud-sql/mysql/sqlalchemy/deployment.yaml | 14 +++++++++++++- cloud-sql/postgres/sqlalchemy/deployment.yaml | 14 +++++++++++++- cloud-sql/sql-server/sqlalchemy/deployment.yaml | 4 ++++ 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/cloud-sql/mysql/sqlalchemy/deployment.yaml b/cloud-sql/mysql/sqlalchemy/deployment.yaml index dd9cd1c684d..3233d7cd37c 100644 --- a/cloud-sql/mysql/sqlalchemy/deployment.yaml +++ b/cloud-sql/mysql/sqlalchemy/deployment.yaml @@ -38,10 +38,18 @@ spec: env: - name: PORT value: "8080" + # This project uses environment variables to determine + # how you would like to run your application + # To use the Python connector (recommended) - use INSTANCE_CONNECTION_NAME (proj:region:instance) + # To use TCP - Setting INSTANCE_HOST will use TCP (e.g., 127.0.0.1) + # To use Unix, use INSTANCE_UNIX_SOCKET (e.g., /cloudsql/proj:region:instance) - name: INSTANCE_HOST value: "127.0.0.1" - name: DB_PORT - value: "3306" + value: "3306" + # To use Automatic IAM Authentication (recommended) + # use DB_IAM_USER instead of DB_USER + # you may also remove the DB_PASS environment variable - name: DB_USER valueFrom: secretKeyRef: @@ -67,6 +75,10 @@ spec: # following flag to have the proxy connect over private IP # - "--private-ip" + # If you are not connecting with Automatic IAM, you can delete + # the following flag. + - "--auto-iam-authn" + # tcp should be set to the port the proxy should listen on # and should match the DB_PORT value set above. # Defaults: MySQL: 3306, Postgres: 5432, SQLServer: 1433 diff --git a/cloud-sql/postgres/sqlalchemy/deployment.yaml b/cloud-sql/postgres/sqlalchemy/deployment.yaml index 48a6fb86dee..4c738ba4b96 100644 --- a/cloud-sql/postgres/sqlalchemy/deployment.yaml +++ b/cloud-sql/postgres/sqlalchemy/deployment.yaml @@ -38,10 +38,18 @@ spec: env: - name: PORT value: "8080" + # This project uses environment variables to determine + # how you would like to run your application + # To use the Python connector (recommended) - use INSTANCE_CONNECTION_NAME (proj:region:instance) + # To use TCP - Setting INSTANCE_HOST will use TCP (e.g., 127.0.0.1) + # To use Unix, use INSTANCE_UNIX_SOCKET (e.g., /cloudsql/proj:region:instance) - name: INSTANCE_HOST value: "127.0.0.1" - name: DB_PORT - value: "5432" + value: "5432" + # To use Automatic IAM Authentication (recommended) + # use DB_IAM_USER instead of DB_USER + # you may also remove the DB_PASS environment variable - name: DB_USER valueFrom: secretKeyRef: @@ -67,6 +75,10 @@ spec: # following flag to have the proxy connect over private IP # - "--private-ip" + # If you are not connecting with Automatic IAM, you can delete + # the following flag. + - "--auto-iam-authn" + # tcp should be set to the port the proxy should listen on # and should match the DB_PORT value set above. # Defaults: MySQL: 3306, Postgres: 5432, SQLServer: 1433 diff --git a/cloud-sql/sql-server/sqlalchemy/deployment.yaml b/cloud-sql/sql-server/sqlalchemy/deployment.yaml index 470728022ff..526eaa9d599 100644 --- a/cloud-sql/sql-server/sqlalchemy/deployment.yaml +++ b/cloud-sql/sql-server/sqlalchemy/deployment.yaml @@ -38,6 +38,10 @@ spec: env: - name: PORT value: "8080" + # This project uses environment variables to determine + # how you would like to run your application + # To use the Python connector (recommended) - use INSTANCE_CONNECTION_NAME (proj:region:instance) + # To use TCP - Setting INSTANCE_HOST will use TCP (e.g., 127.0.0.1) - name: INSTANCE_HOST value: "127.0.0.1" - name: DB_PORT From 981669c71ea849a34ef938e10b3e777f0e9bfe8c Mon Sep 17 00:00:00 2001 From: jackwotherspoon Date: Thu, 27 Jul 2023 15:31:25 +0000 Subject: [PATCH 2/3] chore: update based on PR feedback --- cloud-sql/mysql/sqlalchemy/deployment.yaml | 9 +++++---- cloud-sql/postgres/sqlalchemy/deployment.yaml | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/cloud-sql/mysql/sqlalchemy/deployment.yaml b/cloud-sql/mysql/sqlalchemy/deployment.yaml index 3233d7cd37c..460484c25b4 100644 --- a/cloud-sql/mysql/sqlalchemy/deployment.yaml +++ b/cloud-sql/mysql/sqlalchemy/deployment.yaml @@ -40,16 +40,17 @@ spec: value: "8080" # This project uses environment variables to determine # how you would like to run your application - # To use the Python connector (recommended) - use INSTANCE_CONNECTION_NAME (proj:region:instance) + # To use the Python Connector (recommended) - use INSTANCE_CONNECTION_NAME (proj:region:instance) # To use TCP - Setting INSTANCE_HOST will use TCP (e.g., 127.0.0.1) # To use Unix, use INSTANCE_UNIX_SOCKET (e.g., /cloudsql/proj:region:instance) - name: INSTANCE_HOST value: "127.0.0.1" - name: DB_PORT value: "3306" - # To use Automatic IAM Authentication (recommended) - # use DB_IAM_USER instead of DB_USER - # you may also remove the DB_PASS environment variable + # For Automatic IAM Authentication with the Python Connector + # use DB_IAM_USER instead of DB_USER (recommended) + # You may also remove the DB_PASS environment variable if + # you use Automatic IAM Authentication - name: DB_USER valueFrom: secretKeyRef: diff --git a/cloud-sql/postgres/sqlalchemy/deployment.yaml b/cloud-sql/postgres/sqlalchemy/deployment.yaml index 4c738ba4b96..c7105edd200 100644 --- a/cloud-sql/postgres/sqlalchemy/deployment.yaml +++ b/cloud-sql/postgres/sqlalchemy/deployment.yaml @@ -40,16 +40,17 @@ spec: value: "8080" # This project uses environment variables to determine # how you would like to run your application - # To use the Python connector (recommended) - use INSTANCE_CONNECTION_NAME (proj:region:instance) + # To use the Python Connector (recommended) - use INSTANCE_CONNECTION_NAME (proj:region:instance) # To use TCP - Setting INSTANCE_HOST will use TCP (e.g., 127.0.0.1) # To use Unix, use INSTANCE_UNIX_SOCKET (e.g., /cloudsql/proj:region:instance) - name: INSTANCE_HOST value: "127.0.0.1" - name: DB_PORT value: "5432" - # To use Automatic IAM Authentication (recommended) - # use DB_IAM_USER instead of DB_USER - # you may also remove the DB_PASS environment variable + # For Automatic IAM Authentication with the Python Connector + # use DB_IAM_USER instead of DB_USER (recommended) + # You may also remove the DB_PASS environment variable if + # you use Automatic IAM Authentication - name: DB_USER valueFrom: secretKeyRef: From 348cce591e7d23108cceda58100a5f8b7b77af04 Mon Sep 17 00:00:00 2001 From: jackwotherspoon Date: Thu, 27 Jul 2023 16:34:17 +0000 Subject: [PATCH 3/3] chore: add comment --- cloud-sql/mysql/sqlalchemy/deployment.yaml | 4 +++- cloud-sql/postgres/sqlalchemy/deployment.yaml | 2 ++ cloud-sql/sql-server/sqlalchemy/deployment.yaml | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/cloud-sql/mysql/sqlalchemy/deployment.yaml b/cloud-sql/mysql/sqlalchemy/deployment.yaml index 460484c25b4..af5110cc354 100644 --- a/cloud-sql/mysql/sqlalchemy/deployment.yaml +++ b/cloud-sql/mysql/sqlalchemy/deployment.yaml @@ -66,8 +66,10 @@ spec: secretKeyRef: name: key: database + # If you are using the Python Connector (recommended), you can + # remove cloud-sql-proxy (everything below this line) - name: cloud-sql-proxy - # This uses the latest version of the Cloud SQL proxy + # This uses the latest version of the Cloud SQL Proxy # It is recommended to use a specific version for production environments. # See: https://github.com/GoogleCloudPlatform/cloudsql-proxy image: gcr.io/cloud-sql-connectors/cloud-sql-proxy:latest diff --git a/cloud-sql/postgres/sqlalchemy/deployment.yaml b/cloud-sql/postgres/sqlalchemy/deployment.yaml index c7105edd200..895d769535b 100644 --- a/cloud-sql/postgres/sqlalchemy/deployment.yaml +++ b/cloud-sql/postgres/sqlalchemy/deployment.yaml @@ -66,6 +66,8 @@ spec: secretKeyRef: name: key: database + # If you are using the Python Connector (recommended), you can + # remove cloud-sql-proxy (everything below this line) - name: cloud-sql-proxy # This uses the latest version of the Cloud SQL proxy # It is recommended to use a specific version for production environments. diff --git a/cloud-sql/sql-server/sqlalchemy/deployment.yaml b/cloud-sql/sql-server/sqlalchemy/deployment.yaml index 526eaa9d599..f32536c2994 100644 --- a/cloud-sql/sql-server/sqlalchemy/deployment.yaml +++ b/cloud-sql/sql-server/sqlalchemy/deployment.yaml @@ -65,6 +65,8 @@ spec: secretKeyRef: name: key: database + # If you are using the Python Connector (recommended), you can + # remove cloud-sql-proxy (everything below this line) - name: cloud-sql-proxy # This uses the latest version of the Cloud SQL proxy # It is recommended to use a specific version for production environments.