feat: add shared PgBouncer deployment

This commit is contained in:
Ryan Moon
2026-04-02 22:13:34 -05:00
parent ed98974c91
commit 54591c43ef
4 changed files with 107 additions and 0 deletions

20
argocd/pgbouncer-app.yaml Normal file
View File

@@ -0,0 +1,20 @@
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: pgbouncer
namespace: argocd
spec:
project: default
source:
repoURL: ssh://git@git-ssh.lunarfront.tech/ryan/lunarfront-charts.git
targetRevision: main
path: pgbouncer
destination:
server: https://kubernetes.default.svc
namespace: pgbouncer
syncPolicy:
automated:
prune: true
selfHeal: true
syncOptions:
- CreateNamespace=true

25
pgbouncer/configmap.yaml Normal file
View File

@@ -0,0 +1,25 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: pgbouncer-config
namespace: pgbouncer
data:
pgbouncer.ini: |
[databases]
gitea = host=lunarfront-postgres-do-user-35277853-0.e.db.ondigitalocean.com port=25060 dbname=gitea user=gitea
windmill = host=lunarfront-postgres-do-user-35277853-0.e.db.ondigitalocean.com port=25060 dbname=windmill user=windmill
[pgbouncer]
listen_port = 5432
listen_addr = 0.0.0.0
auth_type = plain
auth_file = /etc/pgbouncer/userlist.txt
pool_mode = transaction
max_client_conn = 200
default_pool_size = 5
min_pool_size = 1
reserve_pool_size = 2
server_tls_sslmode = require
ignore_startup_parameters = extra_float_digits
log_connections = 0
log_disconnections = 0

51
pgbouncer/deployment.yaml Normal file
View File

@@ -0,0 +1,51 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: pgbouncer
namespace: pgbouncer
spec:
replicas: 1
selector:
matchLabels:
app: pgbouncer
template:
metadata:
labels:
app: pgbouncer
spec:
containers:
- name: pgbouncer
image: pgbouncer/pgbouncer:1.23.1
ports:
- containerPort: 5432
volumeMounts:
- name: config
mountPath: /etc/pgbouncer/pgbouncer.ini
subPath: pgbouncer.ini
- name: userlist
mountPath: /etc/pgbouncer/userlist.txt
subPath: userlist.txt
resources:
requests:
cpu: 10m
memory: 32Mi
limits:
cpu: 200m
memory: 64Mi
livenessProbe:
tcpSocket:
port: 5432
initialDelaySeconds: 10
periodSeconds: 30
readinessProbe:
tcpSocket:
port: 5432
initialDelaySeconds: 5
periodSeconds: 10
volumes:
- name: config
configMap:
name: pgbouncer-config
- name: userlist
secret:
secretName: pgbouncer-userlist

11
pgbouncer/service.yaml Normal file
View File

@@ -0,0 +1,11 @@
apiVersion: v1
kind: Service
metadata:
name: pgbouncer
namespace: pgbouncer
spec:
selector:
app: pgbouncer
ports:
- port: 5432
targetPort: 5432