Skip to content

Cloudsql split + nais alpha postgres - #784

Merged
jhrv merged 10 commits into
mainfrom
cloudsql-split
Oct 1, 2026
Merged

jhrv merged 10 commits into
mainfrom
cloudsql-split

Conversation

@jhrv

@jhrv jhrv commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

This pull request introduces experimental support for managing and accessing Nais Postgres instances through the CLI. It adds new commands for listing Postgres branches, requesting personal access, and connecting via a secure local tunnel. The implementation includes API integrations, command definitions, access management logic, and comprehensive tests.

New Nais Postgres CLI Features:

  • Adds a new postgres command group with subcommands for listing branches, launching a local psql session, and exposing a relay tunnel for secure access. [1] [2] [3] [4]

Access Management and API Integration:

  • Implements the AccessAPI interface and related logic in internal/alpha/postgres/access.go to handle brokered access requests, polling for readiness, and retrieving connection materials securely.
  • Provides a relay tunnel mechanism to securely proxy Postgres connections through the CLI, supporting end-to-end TLS and local loopback access.

Command Flags and Environment Handling:

  • Introduces structured flag types for the new commands, including validation for access level, TTL, and reason, as well as output formatting and label filtering for listing branches.
  • Ensures inherited environment variables do not interfere with new Postgres sessions by filtering out PG* variables. [1] [2]

Listing and Display Enhancements:

  • Adds logic to fetch and display team Postgres branches with support for environment and label filters, and outputs results in table or JSON format. [1] [2]

Testing and Reliability:

  • Includes unit tests for access polling logic and environment variable filtering to ensure robust and predictable behavior. [1] [2]

Dependency Updates:

  • Adds new dependencies for QUIC protocol support, required by the relay tunnel implementation. [1] [2]

jhrv added 6 commits October 1, 2026 08:02
Match the API schema where PostgresBranch.name is local to its Postgres.
List Nais branches as <postgres>/<branch> and link to the Postgres
resource. Update the schema snapshot, regenerate the client, and cover the
Nais + Cloud SQL merge and environment filtering with a table test.
@github-actions

github-actions Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

📝 Changelog preview

Below is a preview of the Changelog that will be added to the next release. Only commit messages that follow the Conventional Commits specification will be included in the Changelog.

v6.0.0 - 2026-10-01

Full Changelog: v5.50.3...v6.0.0

🚀 Features

  • (postgres) Show local branch names in postgres list (309c899)
  • Split and prepare postgres subcmds (97032aa)
  • (cli) 💥 Breaking change: Drop Zalando Postgres, alias nais postgres to cloudsql (c73144b)

🐛 Bug Fixes

  • Dont use removed pg fields (2c14155)
  • Instances -> branches (414b96a)
  • Fmt (1b5ea3d)
  • Fmt and combine (53b0cce)
  • (alpha postgres) Validate relay token, clean up on signals, bound setup (ad886bd)
  • Deprecation msg (fcf42e0)

jhrv added 4 commits October 1, 2026 10:42
… setup

Reject anything but unpadded base64url of 32 bytes before building the
Authorization header, since the HTTP stack echoes invalid header values in
errors. Run cleanup on SIGTERM and Ctrl-C, bound access creation with the
polling timeout, and drop an unused Cloud SQL flag type.
Remove the legacy in-cluster Postgres code and grantPostgresAccess client.
nais postgres and nais pg now run the Cloud SQL commands so the transition
is soft; Nais Postgres lives under nais alpha postgres.
   Remove the legacy in-cluster Postgres code and grantPostgresAccess client.
   nais postgres and nais pg now run the Cloud SQL commands and print a
   deprecation warning; Nais Postgres lives under nais alpha postgres.
@jhrv
jhrv merged commit 64557f0 into main Oct 1, 2026
22 checks passed
@jhrv
jhrv deleted the cloudsql-split branch October 1, 2026 09:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant