feat(v2/postgres): support CLOUDSQL_IAM passwordless DSN
Summary
Aligns v2/postgres with the fairway proto change that moved PostgreSQLFormat from PostgreSQLSecret onto PostgreSQL itself, and adds support for the new CLOUDSQL_IAM format used by the Cloud SQL Auth Proxy with --auto-iam-authn.
Details
Proto consumption
projection()now reads format fromPostgreSQL.formatinstead ofsecret_ref.format(the field's new home).
CLOUDSQL_IAM path
When format == CLOUDSQL_IAM:
newFromProtono longer requires a Secrets provider (no Kubernetes Secret is mounted in this mode).dsn()short-circuits to a newcloudsqlIAMDSNhelper that builds a passwordlesspostgres://URL fromPostgreSQL.host/port/database_name/username.- Pool address (
pool_host/pool_port) is honored when connection pooling is enabled, falling back to direct host/port — future-proofing for CloudSQL deployments that expose a separate pool endpoint. - Defense-in-depth: each required field is checked for empty/zero and reports a new
ErrMissingConfigFieldon violation, even though fairway's CEL rules already enforce presence at proto-validate time.
Tests
TestClientOptions_DSNextended with 9 new cases:- happy path (with and without a Secrets provider, including IAM-flavoured username escaping)
pool_host/pool_portoverride when pooling enabledpool_host/pool_portignored when pooling disabled- each of host / port / database_name / username missing →
ErrMissingConfigField
- Existing test fixtures rewritten to set
FormatonPostgreSQLdirectly (moved fromPostgreSQLSecret).
Why
Required for the Runway V2 CloudSQL story: the GKE chart injects a cloud-sql-proxy sidecar with --auto-iam-authn, the workload's GCP SA authenticates to the proxy, and labkit needs to dial the proxy on 127.0.0.1 without a password. Without CLOUDSQL_IAM, labkit's projection() falls through to ErrUnknownSecretFormat and dsn() blocks waiting for a non-existent password secret.
Dependency
Bumps fairway to an unreleased commit on feat/cloudsql-iam-format that introduces PostgreSQLFormat.CLOUDSQL_IAM (gitlab-com/gl-infra/platform/runway/fairway!103 (merged)). Will be re-pinned to a tagged release before merge.
Relates to: gitlab-com/gl-infra/platform/runway/team#921 (closed) Relates to: gitlab-com/gl-infra/platform/runway/team#930 (closed)