Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Cloud SQL backend: document (and optionally provision) Private Service Connect for ATE_API_POSTGRES_CLOUDSQL_IP_TYPE=psc

オープン 初心者向け
#2,875 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@SamPriyadarshi がすでに取り組んでいます。

2026年10月20日 から。

  • #2960 @SamPriyadarshi による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
72/100
issue の種類
ドキュメント
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
gcp, google-cloud

調査の方向性

tools/setup-gcp/cloud-sql.mdから始め、特に既存のセットアップとSQLのセクションを確認し、リンクされた参照スクリプトと照合してPSCのプロビジョニングの詳細を検証します。PSCインスタンスとエンドポイントの作成、必要なDNSレコード、エンドポイントのIPを使ったSQLステップの実行を記述します。PSCのみを使用するインスタンスのセットアップと検証をガイドで扱えたら完了です。プロビジョニングの自動化は、将来的に任意で行う作業です。

索引モデルが issue の本文から書いたものです。

説明

area/dev-infra kind/docs kind/feature
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
  1. 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
    on cloudsqlconn 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:

    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-dns with PSC auto-connections is
    the managed alternative).

  2. 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 list shows - for both PRIMARY_ADDRESS and
    PRIVATE_ADDRESS). Connecting to the PSC endpoint's internal IP with sslmode=require works.

  3. 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 pscServiceAttachmentLink and dnsName from gcloud 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> (status ACCEPTED)
    • 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
  1. Docs first: a "Private Service Connect" subsection in tools/setup-gcp/cloud-sql.md covering
    the provisioning steps above, the DNS requirement, §2 over the endpoint IP, and how to verify.
  2. Optionally later: setup-gcp create cloudsql --connectivity=psa|psc that 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

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

agent-substrate/substrate のほかの issue

agent-substrate/substrate の issue をすべて見る

似ている issue

Go の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。