feat(postgresql): request extensions on CNPG clusters #350
Reference in New Issue
Block a user
No description provided.
Delete Branch "feat/postgres-extensions"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Lets
PostgreSQLScorerequest Postgres extensions on CNPG clusters.What
PostgreSQLConfig.extensions: Vec<String>(default empty).postgresql.cnpg.io/v1Database(<cluster>-app) for theappdatabase, with each extension set toensure: present.Databasestatus, and the app that needs the extension fails on its own until it is there.Why
Untrusted extensions such as pgvector's
vectorneed the superuser; theapprole cannot create them. ADatabaseresource reconciles on existing clusters too, whileinitdb.postInitApplicationSQLonly runs when a cluster is created. iaai needsvectorfor Keep's vector search (NationTech/iaai#30 follow-up).Tested
Database(apiVersion, kind, spec).cargo fmt --check,cargo check --workspace --all-targets,cargo test --workspace --exclude harmony-fleet-e2e(880 passed).harmony-fleet-e2edoes not link on macOS (libvirt), unrelated.kubectl apply --dry-run=serverof the generated manifest against a CNPG 1.x cluster: accepted.Not covered
@@ -333,0 +415,4 @@.create_interpret().execute(inventory, topology).await?;if self.config.wait_for_ready {why nest this inside extensions empty check? And why add wait for database in this file? K8s (and harmony's) design is eventually consistent, we don't want to block a deployment because a db takes time or fails to fire up, we want the DB itself to fail and let us know but other systems to handle that gracefully, retrying until the DB comes up.
So at the higher level it is ok to have a mechanism to wait on the DB, or at least to know if it is healthy, but blocking deployment within a nested if only active when there is an extension feels wrong.
I removed the wait for db, it was indeed out of place
LGTM
Didn't know that extensions were per database, I thought they were per instance (cluster) in CNPG.