feat: M2.2 CNPG memory-db with pgvector (declarative, 3 instances)

This commit is contained in:
Story Crater Bot
2026-08-27 20:39:49 -07:00
parent e83b8ef3da
commit b923e0ad68
3 changed files with 158 additions and 16 deletions
+38 -16
View File
@@ -1,6 +1,8 @@
# Dedicated CNPG Postgres for Poimen Memory (GitOps, wave 2).
# Uses default longhorn storage class (3 replicas, dataLocality disabled).
# CNPG generates secret `memory-db-app` + service `memory-db-rw` in ns poimen.
---
# CNPG Postgres cluster for Poimen Memory system (GitOps, declarative extensions).
# 3 instances, pgvector 0.7.0 via spec.extensions (not manual CREATE EXTENSION).
# Storage: 10Gi longhorn, consistent with temporal-db.yaml.
# No manual psql needed — all via git/ArgoCD.
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
@@ -9,24 +11,15 @@ metadata:
annotations:
argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true
spec:
instances: 2
instances: 3
imageName: ghcr.io/cloudnative-pg/postgresql:16.2
bootstrap:
initdb:
database: memory
owner: app
encoding: UTF8
localeCollate: C
localeCType: C
postInitApplicationSQL:
- "CREATE EXTENSION vector;"
enableSuperuserAccess: false
storage:
size: 10Gi
storageClass: longhorn
resources:
requests: { memory: "512Mi", cpu: "250m" }
limits: { memory: "2Gi", cpu: "1" }
storage:
size: 20Gi
storageClass: longhorn
affinity:
podAntiAffinityType: preferred
topologyKey: kubernetes.io/hostname
@@ -34,3 +27,32 @@ spec:
- key: node-role.kubernetes.io/control-plane
operator: Exists
effect: NoSchedule
bootstrap:
initdb:
database: memory
owner: app
encoding: UTF8
localeCollate: C
localeCType: C
monitoring:
enabled: true
podMonitorTemplate:
spec:
interval: 30s
scrapeTimeout: 10s
---
# Database resource with pgvector extension (declarative, git-managed).
# CNPG 1.30.0+ supports this via spec.extensions on the Database CRD.
# Ensures pgvector is installed and available for HNSW indexing.
apiVersion: postgresql.cnpg.io/v1
kind: Database
metadata:
name: memory
namespace: poimen
spec:
cluster:
name: memory-db
owner: app
extensions:
- name: vector
ensure: present