feat(balancer): declare the cnpg balancer role and Database - #183
Draft
TineoC wants to merge 2 commits into
Draft
Conversation
First half of moving Balancer off AWS RDS (CodeForPhilly/balancer-main#526). Production still reads from RDS; this only stands the cluster up beside it. Mirrors cfp-sandbox-cluster's layout: chart v0.28.0 as a holosource, projected to _infra/cloudnative-pg/operator and rendered by a helm3 lens with CRDs included; the Cluster CR and namespace sit outside the lens root and pass through raw. Two deliberate omissions, both documented inline: - no managed.roles — the balancer role's passwordSecret must be sealed first, or cnpg reports a reconcile error until it exists - no backup stanza — needs an object store and credentials that do not exist yet. Nothing may depend on this cluster as a sole copy until that lands. Storage class is pinned to linode-block-storage-retain rather than taking the cluster default, which sandbox does. Refs CodeForPhilly/balancer-main#526
Second half of standing cnpg up for Balancer (CodeForPhilly/balancer-main#526). Creates an empty `balancer` database on shared-cluster with pgvector enabled, so the RDS dump has somewhere to be restored to. Still no cutover: the app's sealed SQL_HOST is untouched and production keeps reading from RDS. Splits balancer/ into app/ + cnpg/ to match cfp-sandbox-cluster. The Database CR has to stay in the cloudnative-pg namespace — cnpg requires it to sit beside the Cluster it targets — so it cannot live under the kustomization that rewrites everything to `balancer`. The existing kustomization moves to app/ unchanged, along with its holomapping. The managed role names balancer-db-credentials, which must be sealed into cloudnative-pg.secrets/ before this merges or cnpg will report a role reconcile error. Note cnpg does not pick up a newly-created passwordSecret on its periodic resync — force it with: kubectl annotate cluster -n cloudnative-pg shared-cluster \ cnpg.io/reconciliationLoop="$(date +%s)" --overwrite Refs CodeForPhilly/balancer-main#526, CodeForPhilly/cfp-sandbox-cluster#162
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Step 4 (continued) of CodeForPhilly/balancer-main#526. Creates an empty
balancerdatabase onshared-clusterwith pgvector enabled, so the RDS dump has somewhere to land.Still no cutover. The app's sealed
SQL_HOSTis untouched; production keeps reading from AWS RDS after this merges.What changed
balancer/splits intoapp/+cnpg/, matching cfp-sandbox-cluster. TheDatabaseCR must stay in thecloudnative-pgnamespace — cnpg requires it beside theClusterit targets — so it cannot sit under the kustomization that rewrites everything tobalancer. The existingbalancer/kustomization.yamlmoves tobalancer/app/unchanged, and its holomapping moves with it (.holo/branches/k8s-manifests/balancer/app/manifests.toml). The new top-level kustomization just composes the two, setting no namespace of its own.balancer/cnpg/database.yaml—Database/balancer, ownerbalancer, with:That answers the "is pgvector available on the CfP database?" question from the original Slack thread. It has to go through
Database.spec.extensionsrather than aCREATE EXTENSION— thebalancerrole has no SUPERUSER, so cnpg-controller runs it as postgres. Sandbox verifiedvector 0.8.2this way._infra/cloudnative-pg/shared-cluster.yaml— adds themanaged.rolesentry deferred out of #182.Blocker before this can merge
balancer-db-credentialsmust be sealed intocloudnative-pg.secrets/first. Until that Secret exists, cnpg reports a role reconcile error. It needs cluster access, so it is not something I can deliver as a PR.Gotcha from cfp-sandbox-cluster#162, worth having in hand: cnpg does not pick up a newly-created
passwordSecreton its periodic resync. A two-hour wait produced nothing; this reconciled in seconds:Verification after deploy
Last line is the one that matters: nothing about the running app should move.
Next, once this is in
pg_dumpRDS →pg_restoreinto this database → per-tablen_live_tupparity check against RDS → only then re-sealbalancer-configwith the cnpg host and bump the image off1.1.5. And an object store +ScheduledBackupbefore this cluster holds the only copy of anything.