From 5a06de52ee135e26d8d9e8d87b037d8b44e76ad1 Mon Sep 17 00:00:00 2001 From: u1 Date: Tue, 6 Jan 2026 00:18:53 +0000 Subject: [PATCH] feat(db): add postgres statefulset (timescaledb) --- kustomize/base/postgres/statefulset.yaml | 67 ++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 kustomize/base/postgres/statefulset.yaml diff --git a/kustomize/base/postgres/statefulset.yaml b/kustomize/base/postgres/statefulset.yaml new file mode 100644 index 0000000..f5a0246 --- /dev/null +++ b/kustomize/base/postgres/statefulset.yaml @@ -0,0 +1,67 @@ +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: postgres + annotations: + argocd.argoproj.io/sync-wave: "0" +spec: + serviceName: postgres + replicas: 1 + selector: + matchLabels: + app: postgres + template: + metadata: + labels: + app: postgres + spec: + containers: + - name: postgres + image: timescale/timescaledb:2.14.2-pg16 + imagePullPolicy: IfNotPresent + ports: + - name: pg + containerPort: 5432 + envFrom: + - secretRef: + name: trade-postgres + volumeMounts: + - name: data + mountPath: /var/lib/postgresql/data + - name: initdb + mountPath: /docker-entrypoint-initdb.d + readOnly: true + readinessProbe: + exec: + command: + - sh + - -ec + - pg_isready -U "$POSTGRES_USER" -d "$POSTGRES_DB" + initialDelaySeconds: 5 + periodSeconds: 5 + timeoutSeconds: 3 + failureThreshold: 20 + livenessProbe: + exec: + command: + - sh + - -ec + - pg_isready -U "$POSTGRES_USER" -d "$POSTGRES_DB" + initialDelaySeconds: 30 + periodSeconds: 10 + timeoutSeconds: 3 + failureThreshold: 10 + volumes: + - name: initdb + configMap: + name: postgres-initdb + volumeClaimTemplates: + - metadata: + name: data + spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 20Gi + storageClassName: local-path