Skip to content

feat(chart): run the Kates database on CloudNativePG - #600

Merged
bmscomp merged 1 commit into
mainfrom
feat/cnpg-database
Nov 5, 2026
Merged

bmscomp merged 1 commit into
mainfrom
feat/cnpg-database

Conversation

@bmscomp

@bmscomp bmscomp commented Nov 5, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds opt-in cnpg.enabled: a CloudNativePG Cluster replaces the bundled single Postgres. Three instances by default, one per node, synchronous replication with dataDurability: preferred.
  • Points the API and the migration job at the -rw Service and the operator's -app Secret. The JDBC URL gets connect, socket and keepalive timeouts.
  • Refuses to render with postgresql.enabled or externalDatabase.enabled set, or when the postgresql.cnpg.io/v1 API is absent.
  • Adds "A Database That Survives a Node" to the deployment chapter, with the operator values and a migration procedure.
  • Bumps kates to 0.17.0 and kates-platform to 0.8.27. Defaults are unchanged.

Test results

Throwaway four-node kind cluster:

Test Result
Migrate a bundled install to CNPG Marker row preserved, API started on CNPG
Kill the primary's node, one operator replica on that node (default) Failover took 366 s
Kill the primary's node, two operator replicas spread across nodes Database reads back in 83 s, twice, same API pod

The operator performs the failover, so a single replica on the lost node delays it. The book gives the two-replica values.

Passing locally: helm lint, the new CI assertion step, chart_bumps, version pins, book style and index, actionlint, TestMCPCaveat.

Not covered

  • Whether the active operator replica was on the killed node in the 83 s runs is unproven.
  • No test run was in progress during the kills.
  • helm template of the kates-platform umbrella fails locally in the kafka-cluster subchart's test-11 tiered-storage template. Not compared against main.
  • kates deploy does not install CNPG yet. That follow-up must not switch an existing bundled release, since --ha defaults to true and the switch would start an empty database.
  • CNPG backups are not configured.

Add an opt-in cnpg.enabled value that replaces the bundled single
Postgres with a CloudNativePG Cluster: three instances by default, one
per node, with synchronous replication that prefers availability.

The API and the migration job reach the primary through the -rw Service
and read the password from the operator's -app Secret. The JDBC URL gets
socket, connect and keepalive timeouts so a dead primary fails fast and
the API reconnects to the new one.

The chart refuses to render with postgresql.enabled or
externalDatabase.enabled set, or without the postgresql.cnpg.io/v1 API.

The book documents the install and a tested migration. A single operator
replica on the lost node delays failover to 366 s; two replicas spread
across nodes brought database reads back in 83 s.
@bmscomp
bmscomp merged commit 571da38 into main Nov 5, 2026
68 checks passed
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