Skip to content

Commit 545cc24

Browse files
feat: add CloudNativePG operator and migrate chat-api to CNPG
- Add CloudNativePG operator (v0.23.0) as alternative to Crunchy PGO - Create CNPG Cluster for chat-api (simpler, no Patroni overhead) - Update chat-api to use CNPG secret (chat-db-cnpg-app) - Keep Crunchy PGO available for HA production workloads CloudNativePG is lighter weight for dev/single-instance deployments. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent 63953c4 commit 545cc24

File tree

5 files changed

+70
-2
lines changed

5 files changed

+70
-2
lines changed

clusters/dev/kustomization.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ resources:
1818
- ../../platform/infrastructure/storage/longhorn/base
1919
# Database
2020
- ../../platform/infrastructure/database/pgo/base
21+
- ../../platform/infrastructure/database/cloudnative-pg/base
2122
# AI Platform
2223
- ../../platform/infrastructure/ai-platform/open-webui/base
2324
# Observability
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
apiVersion: argoproj.io/v1alpha1
2+
kind: Application
3+
metadata:
4+
name: cloudnative-pg
5+
namespace: argocd
6+
annotations:
7+
argocd.argoproj.io/sync-wave: "1"
8+
spec:
9+
project: default
10+
source:
11+
repoURL: https://cloudnative-pg.github.io/charts
12+
chart: cloudnative-pg
13+
targetRevision: 0.23.0
14+
helm:
15+
valuesObject:
16+
crds:
17+
create: true
18+
destination:
19+
name: CLUSTER
20+
namespace: cnpg-system
21+
syncPolicy:
22+
automated:
23+
allowEmpty: true
24+
selfHeal: true
25+
prune: true
26+
syncOptions:
27+
- Validate=true
28+
- CreateNamespace=true
29+
- PruneLast=true
30+
- ServerSideApply=true
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
resources:
4+
- application.yaml
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
apiVersion: postgresql.cnpg.io/v1
2+
kind: Cluster
3+
metadata:
4+
name: chat-db-cnpg
5+
namespace: chat-api
6+
annotations:
7+
argocd.argoproj.io/sync-wave: "3"
8+
argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true
9+
spec:
10+
instances: 1
11+
12+
postgresql:
13+
parameters:
14+
shared_buffers: "256MB"
15+
effective_cache_size: "512MB"
16+
17+
storage:
18+
storageClass: longhorn
19+
size: 5Gi
20+
21+
resources:
22+
requests:
23+
memory: "512Mi"
24+
cpu: "250m"
25+
limits:
26+
memory: "1Gi"
27+
cpu: "1"
28+
29+
bootstrap:
30+
initdb:
31+
database: chat
32+
owner: chatapi

tenants/product-team/apps/chat/overlays/dev/kustomization.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ kind: Kustomization
33

44
resources:
55
- ../../base
6-
- postgres-cluster.yaml
6+
# - postgres-cluster.yaml # Crunchy PGO - disabled, using CloudNativePG instead
7+
- cnpg-cluster.yaml
78
- openrouter-secrets.yaml
89
- github-secrets.yaml
910

@@ -40,5 +41,5 @@ patches:
4041
- name: DATABASE_URL
4142
valueFrom:
4243
secretKeyRef:
43-
name: chat-db-pguser-chatapi
44+
name: chat-db-cnpg-app
4445
key: uri

0 commit comments

Comments
 (0)