Cloud SQL backend: document (and optionally provision) Private Service Connect for ATE_API_POSTGRES_CLOUDSQL_IP_TYPE=psc
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 72/100
- issue の種類
- ドキュメント
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- gcp, google-cloud
- 領域
- cloud, database, documentation
調査の方向性
tools/setup-gcp/cloud-sql.mdから始め、特に既存のセットアップとSQLのセクションを確認し、リンクされた参照スクリプトと照合してPSCのプロビジョニングの詳細を検証します。PSCインスタンスとエンドポイントの作成、必要なDNSレコード、エンドポイントのIPを使ったSQLステップの実行を記述します。PSCのみを使用するインスタンスのセットアップと検証をガイドで扱えたら完了です。プロビジョニングの自動化は、将来的に任意で行う作業です。
索引モデルが issue の本文から書いたものです。
説明
Summary
ate-setup already accepts ATE_API_POSTGRES_CLOUDSQL_IP_TYPE=psc and configures the Cloud SQL
Auth Proxy sidecar for it (CSQL_PROXY_PSC=true, cmd/ate-setup/internal/steps/cloudsql.go#L201-L202),
but there is no supported way to get a working PSC instance: tools/setup-gcp/cloud-sql.md says
psc "require[s] an instance configured accordingly out-of-band" (cloud-sql.md#L148-L152), and
setup-gcp create cloudsql only creates private-services-access instances
(tools/setup-gcp/cmd/cloudsql.go#L201-L205; no PSC flag among #L456-L461).
I validated the full PSC path end to end on v0.5.0 (GKE 1.36.4): PSC-only instance, PSC endpoint,
DNS, the one-time roles/schema SQL, install with IP_TYPE=psc, then the counter demo, which
suspended and resumed on a different worker with state preserved. Several steps are not obvious and
are not written down anywhere in the repo.
What is missing / non-obvious
-
The proxy needs DNS for the instance's PSC name. The proxy image used here,
cloud-sql-proxy:2.25.2(manifests/ate-install/cloudsql/proxy-sidecar-patch.yaml#L38), is built
oncloudsqlconn v1.25.0, which uses the instance's PSC DNS name
(<uid>.<project-label>.<region>.sql.goog) as the address and dials it by name, not by IP:- https://github.com/GoogleCloudPlatform/cloud-sql-go-connector/blob/v1.25.0/internal/cloudsql/refresh.go#L114-L138
- https://github.com/GoogleCloudPlatform/cloud-sql-go-connector/blob/v1.25.0/dialer.go#L612-L615
So the cluster's VPC needs a record for that name pointing at the PSC endpoint (a private Cloud
DNS zone with an A record worked; GCP's--enable-psc-auto-dnswith PSC auto-connections is
the managed alternative). -
The one-time SQL step in cloud-sql.md §2 doesn't work on a PSC-only instance. It reads
ipAddresses[0].ipAddress(cloud-sql.md#L85), but an instance created with--no-assign-ip
and PSC has no IP addresses (gcloud sql instances listshows-for both PRIMARY_ADDRESS and
PRIVATE_ADDRESS). Connecting to the PSC endpoint's internal IP withsslmode=requireworks. -
Provisioning steps (none are in setup-gcp or the docs):
gcloud sql instances create ... --enable-private-service-connect --allowed-psc-projects=<project> --no-assign-ip --database-flags=cloudsql.iam_authentication=on- read
pscServiceAttachmentLinkanddnsNamefromgcloud sql instances describe gcloud compute addresses create <name> --region=<region> --subnet=<cluster subnet>gcloud compute forwarding-rules create <name> --region=<region> --network=<vpc> --address=<name> --target-service-attachment=<pscServiceAttachmentLink>(statusACCEPTED)gcloud dns managed-zones create <zone> --dns-name=<dnsName> --visibility=private --networks=<vpc>gcloud dns record-sets create <dnsName> --type=A --ttl=300 --rrdatas=<endpoint IP> --zone=<zone>- then the existing GSA / IAM DB user / Workload Identity steps (cloud-sql.md §1) and the §2 SQL
against the endpoint IP.
Why
PSC avoids VPC peering and private-services-access range allocation, and avoids the
non-transitive-peering limits of PSA, which matters in Shared VPC and other locked-down network
setups.
Proposal
- Docs first: a "Private Service Connect" subsection in
tools/setup-gcp/cloud-sql.mdcovering
the provisioning steps above, the DNS requirement, §2 over the endpoint IP, and how to verify. - Optionally later:
setup-gcp create cloudsql --connectivity=psa|pscthat creates the endpoint
and DNS idempotently (or uses PSC auto-connections plus--enable-psc-auto-dns).
I'm happy to send the docs PR. A working reference script (idempotent, verified end to end):
https://github.com/SamPriyadarshi/agent-substrate-on-gke/blob/e3bbf2c/scripts/setup-cloudsql.sh
Related
#1561, #996, #2382 (DSN as flags, may touch the same config), #2825
- 主要言語
- Go
- スター
- 5.7k
- フォーク
- 612
- 平均マージ
- 2日 14時間
- マージ済み PR(30日)
- 571
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
agent-substrate/substrate のほかの issue
-
[Low] CSI plugin builds staging directories from storage_volume_id without a containment check対応中かも @ericcurtin が今日担当しました。 オープンarea/security kind/bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
agent-substrate/substrate#2935 ·
メンテナーはふだん 1 日以内に返信
-
[Low] CleanupSandboxState joins an unchecked id into paths it RemoveAll()s対応中かも @ericcurtin が 1 日前に担当しました。 オープンarea/security kind/bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
agent-substrate/substrate#2932 ·
メンテナーはふだん 1 日以内に返信
-
[Low] guestVolumeSource can map host paths containing ".." outside the microVM guest share対応中かも @jiayimeow が 4 日前に担当しました。 オープンarea/security kind/bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
agent-substrate/substrate#2920 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
[Low] setupImageVolumes builds host mount paths from vol.Name without a containment check対応中かも @abhisheksharma2411 が 3 日前に担当しました。 オープンarea/security kind/bug
難易度 2/5 1〜3時間 初心者へのやさしさ 73/100
agent-substrate/substrate#2919 ·
メンテナーはふだん 1 日以内に返信
-
[Low] ate-api-server accepts client certificates chained to system roots when --pod-identity-ca-certs is unset対応中かも @abhisheksharma2411 が 3 日前に担当しました。 オープンarea/security kind/bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
agent-substrate/substrate#2918 ·
メンテナーはふだん 1 日以内に返信
agent-substrate/substrate の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
JakeChampion/lang#13132 ·
メンテナーはふだん 1 日以内に返信
-
[BUG] deploy.restart_policy without condition drops the restart policy対応中かも @akshat-lakhera が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
docker/compose#14383 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
Azure/azure-storage-fuse#2429 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
AvengeMedia/dank-greeter#39 · コメント 1 件 ·
-
bug: dataplane client ignores SERVER_BASEPATH, so create/delete topic miss the subpath対応中かも @bhataprameya が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
redpanda-data/console#2693 ·
メンテナーはふだん 2 日以内に返信