Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: v1
name: pgdog
version: v0.70
version: v0.71
appVersion: "0.1.47"
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,28 @@ mirrors:

### High Availability

#### StatefulSet WAL storage

PgDog can persist its two-phase commit WAL when running as a StatefulSet.
Enable `walPvc` and configure the requested capacity:

```yaml
statefulSet:
enabled: true
walPvc:
enabled: true
size: 5Gi
```

The StatefulSet creates one `ReadWriteOnce` persistent volume claim per replica
and mounts it at `/var/lib/pgdog`. The generated PgDog configuration sets
`two_phase_commit_wal_dir` to that mount point automatically. An explicit
`twoPhaseCommitWalDir` value takes precedence.

The claims use the cluster's default `StorageClass`. Ensure one is configured
for dynamic provisioning before enabling `walPvc`. This option has no effect
when PgDog runs as a Deployment.

#### PodDisruptionBudget

Ensures minimum pod availability during voluntary disruptions
Expand Down
2 changes: 2 additions & 0 deletions templates/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ data:
{{- end }}
{{- if hasKey .Values "twoPhaseCommitWalDir" }}
two_phase_commit_wal_dir = {{ .Values.twoPhaseCommitWalDir | quote }}
{{- else if and .Values.statefulSet.enabled .Values.statefulSet.walPvc.enabled }}
two_phase_commit_wal_dir = "/var/lib/pgdog"
{{- end }}
{{- if hasKey .Values "twoPhaseCommitWalSegmentSize" }}
two_phase_commit_wal_segment_size = {{ include "pgdog.intval" .Values.twoPhaseCommitWalSegmentSize }}
Expand Down
15 changes: 15 additions & 0 deletions templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,10 @@ spec:
mountPath: /etc/pgdog
- name: users
mountPath: /etc/secrets/pgdog
{{- if and .Values.statefulSet.enabled .Values.statefulSet.walPvc.enabled }}
- name: wal
mountPath: /var/lib/pgdog
{{- end }}
{{- if .Values.tlsGenerateSelfSignedCert }}
- name: tls
mountPath: /etc/pgdog-tls
Expand Down Expand Up @@ -254,3 +258,14 @@ spec:
topologySpreadConstraints:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if and .Values.statefulSet.enabled .Values.statefulSet.walPvc.enabled }}
volumeClaimTemplates:
- metadata:
name: wal
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: {{ .Values.statefulSet.walPvc.size | quote }}
{{- end }}
3 changes: 3 additions & 0 deletions test/values-statefulset.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Test StatefulSet deployment mode
statefulSet:
enabled: true
walPvc:
enabled: true
size: 5Gi
6 changes: 6 additions & 0 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ replicas: 2
statefulSet:
# enabled switches from Deployment to StatefulSet
enabled: false
# walPvc creates one persistent volume claim per StatefulSet pod.
# The volume is mounted at /var/lib/pgdog. When enabled,
# twoPhaseCommitWalDir defaults to this mount point.
walPvc:
enabled: false
size: 1Gi

# env allows setting custom environment variables on the pgdog container
# Note: NODE_ID is automatically generated and cannot be overridden
Expand Down
Loading