Skip to content
This repository has been archived by the owner on Jun 6, 2023. It is now read-only.

Commit

Permalink
Adds topologySpreadConstraints to the statefulset (#58)
Browse files Browse the repository at this point in the history
* Adds topologySpreadConstraints to the statefulset.

Adds topologySpreadConstraints to the statefulset so that users can ensure that keydb instances are placed in different AZs.

* Fixes label selector

* Fixes indentation
  • Loading branch information
jared-schmidt-niceincontact authored Oct 17, 2022
1 parent a5e2363 commit 39d816b
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
20 changes: 20 additions & 0 deletions keydb/templates/sts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,26 @@ spec:
selector:
matchLabels:
{{- include "keydb.selectorLabels" . | nindent 6 }}
{{- if .Values.topologySpreadConstraints }}
topologySpreadConstraints:
{{- range .Values.topologySpreadConstraints }}
- labelSelector:
matchLabels:
{{- include "keydb.selectorLabels" $ | nindent 10 }}
topologyKey: {{ default "topology.kubernetes.io/zone" .topologyKey }}
maxSkew: {{ .maxSkew }}
{{- if .minDomains }}
minDomains: {{ .minDomains }}
{{- end }}
whenUnsatisfiable: {{ default "DoNotSchedule" .whenUnsatisfiable }}
{{- if .nodeAffinityPolicy }}
nodeAffinityPolicy: {{ .nodeAffinityPolicy }}
{{- end }}
{{- if .nodeTaintsPolicy }}
nodeTaintsPolicy: {{ .nodeTaintsPolicy }}
{{- end }}
{{- end }}
{{- end }}
template:
metadata:
annotations:
Expand Down
9 changes: 9 additions & 0 deletions keydb/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,15 @@ tolerations: {}
nodeSelector: {}
# topology.kubernetes.io/region: some-region

topologySpreadConstraints: []
# - maxSkew: 1
# ## Optional keys
# # whenUnsatisfiable: DoNotSchedule
# # topologyKey: "topology.kubernetes.io/zone"
# # minDomains: 0
# # nodeAffinityPolicy: Honor
# # nodeTaintsPolicy: Honor

affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
Expand Down

0 comments on commit 39d816b

Please sign in to comment.