Skip to content

Support Postgres branches in BranchInfrastructure#324

Merged
nickvanw merged 1 commit into
mainfrom
postgres-branch-infrastructure
Jul 8, 2026
Merged

Support Postgres branches in BranchInfrastructure#324
nickvanw merged 1 commit into
mainfrom
postgres-branch-infrastructure

Conversation

@nickvanw

@nickvanw nickvanw commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Summary

The branch infrastructure endpoint (GET .../branches/:branch/infrastructure) now serves Postgres branches. This adds the Postgres response shape to the SDK so consumers (e.g. the CLI) can show infrastructure for Postgres databases.

Changes

  • BranchInfrastructure becomes a discriminated union with per-engine sub-structs: Type plus exactly one of Vitess (Ready, Pods — unchanged fields) or Postgres (State, PrimaryName, Nodes, Bouncers, volume/promotion metadata). A custom UnmarshalJSON selects the engine struct from the response's type field.
  • New types: PostgresInfraNode (instance name, role, AZ, cluster size, volume usage/capacity, region, pending disk replacement) and PostgresInfraBouncer (PgBouncer deployment with its SKU).

Why

Rather than forcing Postgres data into the Vitess pods shape (which has per-container ready/restart detail that doesn't apply to Postgres instances), the API returns an engine-native shape per database kind. Modeling that as one struct-per-engine keeps each engine's fields together and makes consumer code branch once on the populated engine instead of guessing which of a flat struct's fields are meaningful. This restructures the existing BranchInfrastructure type, but the endpoint is feature-gated with no stability guarantee.

@nickvanw nickvanw requested a review from a team as a code owner July 8, 2026 21:24
@nickvanw nickvanw force-pushed the postgres-branch-infrastructure branch from 37b1b45 to dbbb6b6 Compare July 8, 2026 21:26
The branch infrastructure API now serves Postgres branches with a
Postgres-native shape: nodes and bouncers instead of pods, since
Postgres infrastructure has no per-container pod detail.

BranchInfrastructure becomes a discriminated union: the response's type
field selects which engine-specific struct (Vitess or Postgres) is
decoded, so exactly one of the two is set and consumers branch on the
populated engine rather than picking through a merged field bag. The
endpoint is feature-gated with no stability guarantee.
@nickvanw nickvanw force-pushed the postgres-branch-infrastructure branch from dbbb6b6 to 6092874 Compare July 8, 2026 21:35
@nickvanw nickvanw merged commit 2b98858 into main Jul 8, 2026
5 checks passed
@nickvanw nickvanw deleted the postgres-branch-infrastructure branch July 8, 2026 22:19
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.

2 participants