mirror of
https://github.com/deuxfleurs-org/garage.git
synced 2026-12-03 06:26:43 +00:00
helm: add topologySpreadConstraints (fix #1208)
This commit is contained in:
committed by
maximilien
parent
1ce75c694d
commit
751ea034fa
@@ -278,6 +278,15 @@ affinity:
|
||||
app.kubernetes.io/name: garage
|
||||
topologyKey: kubernetes.io/hostname
|
||||
|
||||
# -- Example: place each replica in a separate zone
|
||||
topologySpreadConstraints:
|
||||
- maxSkew: 1
|
||||
topologyKey: topology.kubernetes.io/zone
|
||||
whenUnsatisfiable: DoNotSchedule
|
||||
labelSelector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: garage
|
||||
|
||||
# -- Optional priority class name to assign to the pods.
|
||||
# See https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption/
|
||||
# This is expected to reference a PriorityClass you define yourself.
|
||||
|
||||
@@ -136,6 +136,10 @@ spec:
|
||||
tolerations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.topologySpreadConstraints }}
|
||||
topologySpreadConstraints:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if and .Values.persistence.enabled (eq .Values.deployment.kind "StatefulSet") }}
|
||||
volumeClaimTemplates:
|
||||
- metadata:
|
||||
|
||||
@@ -47,6 +47,10 @@ tests:
|
||||
equal:
|
||||
path: spec.volumeClaimTemplates[0].spec.storageClassName
|
||||
value: fast-ssd
|
||||
- template: templates/workload.yaml
|
||||
equal:
|
||||
path: spec.template.spec.topologySpreadConstraints[0].topologyKey
|
||||
value: topology.kubernetes.io/zone
|
||||
- template: templates/workload.yaml
|
||||
contains:
|
||||
path: spec.template.spec.imagePullSecrets
|
||||
|
||||
@@ -212,3 +212,30 @@ tests:
|
||||
- equal:
|
||||
path: spec.template.spec.serviceAccountName
|
||||
value: default
|
||||
|
||||
- it: omits topologySpreadConstraints by default
|
||||
template: templates/workload.yaml
|
||||
asserts:
|
||||
- isNull:
|
||||
path: spec.template.spec.topologySpreadConstraints
|
||||
|
||||
- it: sets topologySpreadConstraints when configured
|
||||
template: templates/workload.yaml
|
||||
set:
|
||||
topologySpreadConstraints:
|
||||
- maxSkew: 1
|
||||
topologyKey: topology.kubernetes.io/zone
|
||||
whenUnsatisfiable: DoNotSchedule
|
||||
labelSelector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: garage
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.topologySpreadConstraints
|
||||
value:
|
||||
- maxSkew: 1
|
||||
topologyKey: topology.kubernetes.io/zone
|
||||
whenUnsatisfiable: DoNotSchedule
|
||||
labelSelector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: garage
|
||||
|
||||
@@ -252,6 +252,10 @@ tolerations: []
|
||||
|
||||
affinity: {}
|
||||
|
||||
# -- Topology spread constraints for the pods, e.g. to place each node in a separate zone.
|
||||
# See https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/
|
||||
topologySpreadConstraints: []
|
||||
|
||||
# -- Optional priority class name to assign to the pods.
|
||||
# See [the k8s pod-priority doc](https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption/)
|
||||
priorityClassName: ""
|
||||
|
||||
Reference in New Issue
Block a user