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
+25
View File
@@ -0,0 +1,25 @@
=== M2.2 Verification: CNPG memory-db + pgvector ===
a1_cluster_healthy:
Cluster: 3/3 instances ready
✅ PASS: Cluster in healthy state (3/3 ready)
a2_extension_installed:
Extension: vector|0.7.0
✅ PASS: pgvector installed and active
a3_declarative_not_manual:
Database CRD extensions: [{"name":"vector","ensure":"present"}]
✅ PASS: Extension declared in Database CRD (git-managed, not manual)
a4_argocd_synced:
ArgoCD App: Succeeded / Healthy
✅ PASS: Application Synced/Healthy
a5_app_user_can_ddl:
✅ PASS: App user can CREATE/DROP tables
a6_hnsw_available:
✅ PASS: HNSW index creation available (pgvector 0.7.0 working)
=== Verification complete ===
Executable
+95
View File
@@ -0,0 +1,95 @@
#!/bin/bash
# M2.2 Verification: CNPG memory-db cluster with pgvector extension
# Run: bash verify/m2.2.sh | diff - verify/expected/m2.2.txt
set -e
NAMESPACE="poimen"
CLUSTER_NAME="memory-db"
DB_NAME="memory"
DB_CRD_NAME="memory"
APP_NAME="poimen-memory-app"
echo "=== M2.2 Verification: CNPG memory-db + pgvector ==="
echo ""
# a1_cluster_healthy
echo "a1_cluster_healthy:"
CLUSTER_STATUS=$(kubectl get cluster -n "$NAMESPACE" "$CLUSTER_NAME" -o jsonpath='{.status.readyInstances}/{.spec.instances}' 2>/dev/null || echo "0/0")
echo " Cluster: $CLUSTER_STATUS instances ready"
if [[ "$CLUSTER_STATUS" == "3/3" ]]; then
echo " ✅ PASS: Cluster in healthy state (3/3 ready)"
else
echo " ❌ FAIL: Expected 3/3, got $CLUSTER_STATUS"
fi
echo ""
# a2_extension_installed
echo "a2_extension_installed:"
PGUSER=app \
PGDATABASE="$DB_NAME" \
PGHOST="memory-db-rw.poimen.svc.cluster.local" \
psql -tAc "SELECT extname, extversion FROM pg_extension WHERE extname='vector'" 2>/dev/null | \
while IFS='|' read -r extname extversion; do
if [[ -n "$extname" ]]; then
echo " Extension: $extname v$extversion"
echo " ✅ PASS: pgvector installed and active"
else
echo " ❌ FAIL: pgvector not installed (pg_extension is empty)"
fi
done
echo ""
# a3_declarative_not_manual
echo "a3_declarative_not_manual:"
EXTENSIONS=$(kubectl get database -n "$NAMESPACE" "$DB_CRD_NAME" -o jsonpath='{.spec.extensions}' 2>/dev/null || echo "")
if [[ "$EXTENSIONS" == *"vector"* ]]; then
echo " Database CRD extensions: $EXTENSIONS"
echo " ✅ PASS: Extension declared in Database CRD (git-managed, not manual)"
else
echo " ❌ FAIL: Database CRD missing pgvector extension declaration"
fi
echo ""
# a4_argocd_synced
echo "a4_argocd_synced:"
APP_STATUS=$(kubectl get application -n argocd "$APP_NAME" -o jsonpath='{.status.operationState.phase},{.status.health.status}' 2>/dev/null || echo "Unknown,Unknown")
SYNC_STATUS=$(echo "$APP_STATUS" | cut -d',' -f1)
HEALTH_STATUS=$(echo "$APP_STATUS" | cut -d',' -f2)
echo " ArgoCD App: $SYNC_STATUS / $HEALTH_STATUS"
if [[ "$SYNC_STATUS" == "Succeeded" && "$HEALTH_STATUS" == "Healthy" ]]; then
echo " ✅ PASS: Application Synced/Healthy"
elif [[ "$HEALTH_STATUS" == "Healthy" ]]; then
echo " ✅ PASS: Application Healthy (sync may be in-progress)"
else
echo " ⚠️ WARNING: ArgoCD status is $APP_STATUS (may need sync)"
fi
echo ""
# a5_app_user_can_ddl
echo "a5_app_user_can_ddl:"
PGUSER=app \
PGDATABASE="$DB_NAME" \
PGHOST="memory-db-rw.poimen.svc.cluster.local" \
psql -tAc "CREATE TABLE test_ddl_tmp (id int); DROP TABLE test_ddl_tmp;" 2>/dev/null && {
echo " ✅ PASS: App user can CREATE/DROP tables"
} || {
echo " ❌ FAIL: App user DDL operations failed (permission denied?)"
}
echo ""
# a6_hnsw_available
echo "a6_hnsw_available:"
PGUSER=app \
PGDATABASE="$DB_NAME" \
PGHOST="memory-db-rw.poimen.svc.cluster.local" \
psql -tAc "CREATE TABLE test_hnsw_tmp (id int, v vector(768));
CREATE INDEX idx_v ON test_hnsw_tmp USING hnsw (v vector_cosine_ops);
DROP INDEX idx_v;
DROP TABLE test_hnsw_tmp;" 2>/dev/null && {
echo " ✅ PASS: HNSW index creation available (pgvector 0.7.0 working)"
} || {
echo " ❌ FAIL: HNSW index creation failed (pgvector not loaded?)"
}
echo ""
echo "=== Verification complete ==="