CHANGES: - k8s/infra/databases/memory-db.yaml: instances 3 → 2 - Updated comment from '3 instances' to '2 instances' REASONING: - Reduces resource overhead (high availability at 2 is sufficient) - Maintains quorum for failover (minimum 2 for HA) - Saves memory/CPU allocation on homelab cluster - ArgoCD will manage rollout automatically DEPLOYMENT: - ArgoCD will detect spec change and reconcile - CNPG will scale down one pod - Data preserved (3→2 replication, no data loss)
59 lines
1.5 KiB
YAML
59 lines
1.5 KiB
YAML
---
|
|
# CNPG Postgres cluster for Poimen Memory system (GitOps, declarative extensions).
|
|
# 2 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:
|
|
name: memory-db
|
|
namespace: poimen
|
|
annotations:
|
|
argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true
|
|
spec:
|
|
instances: 2
|
|
imageName: ghcr.io/cloudnative-pg/postgresql:16.2
|
|
enableSuperuserAccess: false
|
|
storage:
|
|
size: 10Gi
|
|
storageClass: longhorn
|
|
resources:
|
|
requests: { memory: "512Mi", cpu: "250m" }
|
|
limits: { memory: "2Gi", cpu: "1" }
|
|
affinity:
|
|
podAntiAffinityType: preferred
|
|
topologyKey: kubernetes.io/hostname
|
|
tolerations:
|
|
- 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
|