Skip to content

Commit 1675c51

Browse files
authored
feat: multi-az flag (#130)
1 parent 9c99c4b commit 1675c51

6 files changed

Lines changed: 43 additions & 3 deletions

File tree

Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
apiVersion: v1
22
name: pgdog
3-
version: v0.74
4-
appVersion: "0.1.52"
3+
version: v0.75
4+
appVersion: "v0.1.52"

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,20 @@ podAntiAffinity:
160160
type: soft # "soft" (preferred) or "hard" (required)
161161
```
162162

163+
#### Multi-AZ
164+
165+
Spread replicas evenly across availability zones with a maximum skew of one:
166+
167+
```yaml
168+
multiAz:
169+
enabled: true
170+
whenUnsatisfiable: ScheduleAnyway
171+
```
172+
173+
This uses the `topology.kubernetes.io/zone` node label. Set
174+
`whenUnsatisfiable` to `DoNotSchedule` to make the constraint strict. Additional
175+
constraints can be set with `topologySpreadConstraints`.
176+
163177
### Config Change Restarts
164178

165179
By default, ConfigMap changes are not automatically picked up by

scripts/schema-overrides.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,12 @@ topologySpreadConstraints:
462462
description: Topology spread constraints
463463
items:
464464
type: object
465+
multiAz.enabled:
466+
type: boolean
467+
description: Enable spreading pods evenly across availability zones
468+
multiAz.whenUnsatisfiable:
469+
enum: ["DoNotSchedule", "ScheduleAnyway"]
470+
description: Action to take when the zone spread constraint cannot be satisfied
465471

466472
# --- Pod anti-affinity ---
467473
podAntiAffinity.enabled:

templates/deployment.yaml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,9 +279,19 @@ spec:
279279
{{- end }}
280280
{{- end }}
281281
{{- end }}
282-
{{- with .Values.topologySpreadConstraints }}
282+
{{- if or .Values.multiAz.enabled .Values.topologySpreadConstraints }}
283283
topologySpreadConstraints:
284+
{{- if .Values.multiAz.enabled }}
285+
- maxSkew: 1
286+
topologyKey: topology.kubernetes.io/zone
287+
whenUnsatisfiable: {{ .Values.multiAz.whenUnsatisfiable }}
288+
labelSelector:
289+
matchLabels:
290+
{{- include "pgdog.selectorLabels" . | nindent 14 }}
291+
{{- end }}
292+
{{- with .Values.topologySpreadConstraints }}
284293
{{- toYaml . | nindent 8 }}
294+
{{- end }}
285295
{{- end }}
286296
{{- if and .Values.statefulSet.enabled .Values.statefulSet.walPvc.enabled }}
287297
volumeClaimTemplates:

test/values-multi-az.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Test multi-AZ topology spread rendering
2+
multiAz:
3+
enabled: true
4+
whenUnsatisfiable: DoNotSchedule

values.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,12 @@ topologySpreadConstraints: []
397397
# matchLabels:
398398
# app: pgdog
399399

400+
# multiAz spreads pods evenly across availability zones with a maximum skew of 1.
401+
multiAz:
402+
enabled: true
403+
# Valid values: DoNotSchedule, ScheduleAnyway
404+
whenUnsatisfiable: ScheduleAnyway
405+
400406
# podAntiAffinity enables default anti-affinity rules to spread pods
401407
# across nodes
402408
# Set to true for automatic pod anti-affinity configuration

0 commit comments

Comments
 (0)