infra/homelab/postgres-cluster.yml

109 lines
2.5 KiB
YAML

apiVersion: postgres-operator.crunchydata.com/v1beta1
kind: PostgresCluster
metadata:
name: hippo
spec:
image: git.gmem.ca/arch/custom-postgres:15
imagePullPolicy: Always
postgresVersion: 15
databaseInitSQL:
key: init.sql
name: init-sql
instances:
- name: instance1
replicas: 3
dataVolumeClaimSpec:
accessModes:
- "ReadWriteOnce"
resources:
requests:
storage: 1Gi
patroni:
dynamicConfiguration:
postgresql:
parameters:
shared_preload_libraries: vectors
backups:
pgbackrest:
manual:
repoName: repo1
options:
- --type=full
image: registry.developers.crunchydata.com/crunchydata/crunchy-pgbackrest:ubi8-2.47-1
global:
repo1-retention-full: "14"
repo1-retention-full-type: time
repos:
- name: repo1
volume:
volumeClaimSpec:
accessModes:
- "ReadWriteOnce"
resources:
requests:
storage: 1Gi
schedules:
full: "0 1 * * 0"
differential: "0 1 * * 1-6"
monitoring:
pgmonitor:
exporter:
image: registry.developers.crunchydata.com/crunchydata/crunchy-postgres-exporter:ubi8-5.4.3-0
users:
- name: authentik
databases:
- authentik
- name: immich
databases:
- immich
- name: pterodactyl
databases:
- pterodactyl
- name: piped
databases:
- piped
- name: soju
databases:
- soju
- name: atuin
databases:
- atuin
---
apiVersion: v1
kind: ConfigMap
metadata:
name: init-sql
data:
init.sql: |
\c authentik
GRANT CREATE ON SCHEMA public TO "authentik";
\c immich
GRANT CREATE ON SCHEMA public TO "immich";
CREATE EXTENSION vectors;
\c pterodactyl
GRANT CREATE ON SCHEMA public TO "pterodactyl";
\c piped
GRANT CREATE ON SCHEMA public TO "piped";
\c soju
GRANT CREATE ON SCHEMA public TO "soju";
\c atuin
GRANT CREATE ON SCHEMA public TO "atuin";
---
apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
name: hippo
spec:
selector:
matchLabels:
postgres-operator.crunchydata.com/cluster: hippo
postgres-operator.crunchydata.com/crunchy-postgres-exporter: "true"
podTargetLabels:
- postgres-operator.crunchydata.com/cluster
- postgres-operator.crunchydata.com/role
- postgres-operator.crunchydata.com/instance
podMetricsEndpoints:
- port: exporter
interval: 30s