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