Skip to content

Commit ec4bbf4

Browse files
committed
fix(seaweedfs): soften master anti-affinity for small clusters
The vendored subchart pins the master to a hard hostname anti-affinity (requiredDuringSchedulingIgnoredDuringExecution). With the master StatefulSet at three replicas, the surplus Pods stay Pending forever on clusters with fewer than three nodes, so `helm install --wait` never returns and the S3 stack never comes up. Soften the term to a strong preference (weight 100) so the masters still spread across distinct nodes when the cluster has them, while single- and dual-node clusters can bring the master up. Mirrors the posture already used for the s3 component. Selector and topologyKey are unchanged; only required -> preferred. Assisted-By: Claude <[email protected]> Signed-off-by: Aleksei Sviridkin <[email protected]>
1 parent 10f8e2d commit ec4bbf4

2 files changed

Lines changed: 55 additions & 0 deletions

File tree

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
suite: seaweedfs master anti-affinity
2+
3+
# Pins the master anti-affinity override that keeps the 3-replica master
4+
# StatefulSet schedulable on clusters with fewer than three nodes. The upstream
5+
# subchart ships a HARD hostname anti-affinity
6+
# (requiredDuringSchedulingIgnoredDuringExecution); with three replicas that
7+
# leaves the surplus master Pods Pending forever on a single- or dual-node
8+
# cluster, so `helm install --wait` never returns. The overlay softens it to a
9+
# strong preference (weight 100) so the masters still spread across distinct
10+
# nodes when the cluster has them. This guards against a subchart bump silently
11+
# re-hardening the term back to required.
12+
13+
templates:
14+
- charts/seaweedfs/templates/master/master-statefulset.yaml
15+
16+
release:
17+
name: seaweedfs
18+
namespace: cozy-seaweedfs
19+
20+
tests:
21+
- it: softens the master hostname anti-affinity to a preference
22+
asserts:
23+
- notExists:
24+
path: spec.template.spec.affinity.podAntiAffinity.requiredDuringSchedulingIgnoredDuringExecution
25+
- equal:
26+
path: spec.template.spec.affinity.podAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution[0].weight
27+
value: 100
28+
- equal:
29+
path: spec.template.spec.affinity.podAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution[0].podAffinityTerm.topologyKey
30+
value: kubernetes.io/hostname
31+
- equal:
32+
path: spec.template.spec.affinity.podAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution[0].podAffinityTerm.labelSelector.matchLabels["app.kubernetes.io/component"]
33+
value: master

‎packages/system/seaweedfs/values.yaml‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,28 @@ seaweedfs:
4545
timeoutSeconds: 30
4646
readinessProbe:
4747
timeoutSeconds: 30
48+
# The upstream subchart pins the master to a HARD hostname anti-affinity
49+
# (requiredDuringSchedulingIgnoredDuringExecution). With the 3-replica
50+
# StatefulSet above, that makes the master unschedulable on clusters with
51+
# fewer than three nodes: the surplus master Pods stay Pending forever, so
52+
# `helm install --wait` never returns and Flux loops install/uninstall —
53+
# the whole S3 stack never comes up. Soften it to a strong preference
54+
# (weight 100) so the masters still spread across distinct nodes whenever
55+
# the cluster has them, while single- and dual-node clusters can still
56+
# bring the master up. Same posture already used for the s3 component
57+
# below. Selector and topologyKey are unchanged from the subchart default;
58+
# only required -> preferred.
59+
affinity: |
60+
podAntiAffinity:
61+
preferredDuringSchedulingIgnoredDuringExecution:
62+
- weight: 100
63+
podAffinityTerm:
64+
labelSelector:
65+
matchLabels:
66+
app.kubernetes.io/name: {{ template "seaweedfs.name" . }}
67+
app.kubernetes.io/instance: {{ .Release.Name }}
68+
app.kubernetes.io/component: master
69+
topologyKey: kubernetes.io/hostname
4870
volume:
4971
replicas: 2
5072
resizeHook:

0 commit comments

Comments
 (0)