From 45e3c01857a2ad7a787d18221dfc839895ab8d7b Mon Sep 17 00:00:00 2001 From: Michael Date: Thu, 4 Jun 2026 05:20:51 +0200 Subject: [PATCH] feat(helm): add topology spread constraints configuration to StatefulSet (#3187) Co-authored-by: houseme --- helm/README.md | 2 ++ helm/rustfs/templates/statefulset.yaml | 4 ++++ helm/rustfs/values.yaml | 10 ++++++++++ 3 files changed, 16 insertions(+) diff --git a/helm/README.md b/helm/README.md index 6dffc1d73..1706df8ea 100644 --- a/helm/README.md +++ b/helm/README.md @@ -152,6 +152,8 @@ uer. `ClusterIssuer` or `Issuer`. | | storageclass.pvcAnnotations.data | map | `{}` | Data pvc customized annotations. | | storageclass.pvcAnnotations.logs | map | `{}` | Logs pvc customized annotations. | | tolerations | list | `[]` | | +| topologySpreadConstraints.enabled | bool | `false` | Enable custom topology spread constraints on distributed-mode StatefulSet pods. | +| topologySpreadConstraints.constraints | list | `[]` | Raw `spec.template.spec.topologySpreadConstraints` entries applied to the distributed StatefulSet when enabled. | | gatewayApi.enabled | bool | `false` | To enable/disable gateway api support. | | gatewayApi.gatewayClass | string | `traefik` | Gateway class implementation. | | gatewayApi.listeners.http.name | string | `web` | Gateway API http listener name. | diff --git a/helm/rustfs/templates/statefulset.yaml b/helm/rustfs/templates/statefulset.yaml index da1dca98d..f0e035bac 100644 --- a/helm/rustfs/templates/statefulset.yaml +++ b/helm/rustfs/templates/statefulset.yaml @@ -60,6 +60,10 @@ spec: tolerations: {{- toYaml .Values.tolerations | nindent 8 }} {{- end }} + {{- if and .Values.topologySpreadConstraints.enabled .Values.topologySpreadConstraints.constraints }} + topologySpreadConstraints: + {{- toYaml .Values.topologySpreadConstraints.constraints | nindent 8 }} + {{- end }} securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }} initContainers: diff --git a/helm/rustfs/values.yaml b/helm/rustfs/values.yaml index 691ab1059..cf96194e6 100644 --- a/helm/rustfs/values.yaml +++ b/helm/rustfs/values.yaml @@ -302,6 +302,16 @@ affinity: topologyKey: kubernetes.io/hostname nodeAffinity: {} +topologySpreadConstraints: + enabled: false + constraints: [] + # - maxSkew: 1 + # topologyKey: topology.kubernetes.io/zone + # whenUnsatisfiable: ScheduleAnyway + # labelSelector: + # matchLabels: + # app.kubernetes.io/name: rustfs + storageclass: name: local-path dataStorageSize: 256Mi