Skip to content

Commit 5cbb3a6

Browse files
committed
fix(seaweedfs): give the lifecycle admin volume its own storage class
volume.storageClass is picked for volume server data, and in a MultiZone instance it can name a class whose volumes exist in one zone or on one node. Reusing it for the admin volume would tie the admin to that zone or node, so losing it would stop lifecycle enforcement for the whole instance, a placement nobody chose for the admin. The admin volume now takes lifecycle.storageClass, and the cluster default when that is empty. Assisted-by: LLM Signed-off-by: Alexey Artamonov <[email protected]>
1 parent 62b4213 commit 5cbb3a6

6 files changed

Lines changed: 35 additions & 8 deletions

File tree

‎packages/extra/seaweedfs/README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,5 @@
8080
| `s3.resourcesPreset` | Default sizing preset used when `resources` is omitted. | `string` | `t1.small` |
8181
| `lifecycle` | S3 bucket lifecycle configuration. | `object` | `{}` |
8282
| `lifecycle.enabled` | Run the SeaweedFS admin server and a worker that applies bucket lifecycle rules, once a day. When disabled, rules are still accepted and stored, but not applied. Ignored with the Client topology, whose rules are enforced by the instance it connects to. Rules stored before enabling are applied on the first pass, minutes after the switch. While on, in a bucket without versioning enabled, an object overwritten between the daily listing and its expiry delete can be deleted although it is new. | `bool` | `false` |
83+
| `lifecycle.storageClass` | StorageClass of the admin server's 1Gi job-state volume. Empty uses the cluster default; `volume.storageClass` is not used, because in MultiZone it can be local to one zone. Prefer a replicated class: on a node-local one, losing the node stops lifecycle enforcement. Set it before enabling lifecycle: the class is part of the admin StatefulSet's volume claim template, which cannot change, so changing it while lifecycle is on makes every upgrade of the instance fail until it is reverted. To move the volume, disable lifecycle, delete the `admin-data-seaweedfs-admin-0` PVC of the instance, change the class and enable lifecycle again. | `string` | `""` |
8384

‎packages/extra/seaweedfs/templates/seaweedfs.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ spec:
385385
enabled: {{ .Values.lifecycle.enabled }}
386386
secret:
387387
existingSecret: {{ .Release.Name }}-admin-credentials
388-
{{- with .Values.volume.storageClass }}
388+
{{- with .Values.lifecycle.storageClass }}
389389
data:
390390
storageClass: {{ . }}
391391
{{- end }}

‎packages/extra/seaweedfs/tests/lifecycle_test.yaml‎

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,15 @@ tests:
7474
path: spec.values.seaweedfs.worker.enabled
7575
value: false
7676

77-
# The admin's volume follows volume.storageClass when the instance sets one.
78-
# Zone storage classes are not followed: the admin is not pinned to a zone.
79-
- it: puts the admin volume on the instance's storage class
77+
# volume.storageClass is chosen for volume data, and in MultiZone it can be
78+
# a class local to one zone, while the admin is not pinned to any zone. Its
79+
# volume therefore takes its own class, and the cluster default otherwise.
80+
- it: puts the admin volume on the lifecycle storage class
8081
template: templates/seaweedfs.yaml
8182
set:
8283
<<: *enabled
83-
volume:
84+
lifecycle:
85+
enabled: true
8486
storageClass: replicated
8587
documentSelector:
8688
path: metadata.name
@@ -90,7 +92,24 @@ tests:
9092
path: spec.values.seaweedfs.admin.data.storageClass
9193
value: replicated
9294

93-
- it: leaves the admin volume on the cluster default when the instance names none
95+
- it: does not put the admin volume on the volume storage class
96+
template: templates/seaweedfs.yaml
97+
set:
98+
<<: *enabled
99+
topology: MultiZone
100+
replicationFactor: 1
101+
volume:
102+
storageClass: zone-a-local
103+
zones:
104+
a: {}
105+
documentSelector:
106+
path: metadata.name
107+
value: seaweedfs-system
108+
asserts:
109+
- notExists:
110+
path: spec.values.seaweedfs.admin.data
111+
112+
- it: leaves the admin volume on the cluster default when lifecycle names none
94113
template: templates/seaweedfs.yaml
95114
set: *enabled
96115
documentSelector:

‎packages/extra/seaweedfs/values.schema.json‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -878,6 +878,11 @@
878878
"description": "Run the SeaweedFS admin server and a worker that applies bucket lifecycle rules, once a day. When disabled, rules are still accepted and stored, but not applied. Ignored with the Client topology, whose rules are enforced by the instance it connects to. Rules stored before enabling are applied on the first pass, minutes after the switch. While on, in a bucket without versioning enabled, an object overwritten between the daily listing and its expiry delete can be deleted although it is new.",
879879
"type": "boolean",
880880
"default": false
881+
},
882+
"storageClass": {
883+
"description": "StorageClass of the admin server's 1Gi job-state volume. Empty uses the cluster default; `volume.storageClass` is not used, because in MultiZone it can be local to one zone. Prefer a replicated class: on a node-local one, losing the node stops lifecycle enforcement. Set it before enabling lifecycle: the class is part of the admin StatefulSet's volume claim template, which cannot change, so changing it while lifecycle is on makes every upgrade of the instance fail until it is reverted. To move the volume, disable lifecycle, delete the `admin-data-seaweedfs-admin-0` PVC of the instance, change the class and enable lifecycle again.",
884+
"type": "string",
885+
"default": ""
881886
}
882887
}
883888
}

‎packages/extra/seaweedfs/values.yaml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ s3:
195195

196196
## @typedef {struct} Lifecycle - Enforcement of S3 bucket lifecycle rules.
197197
## @field {bool} [enabled] - Run the SeaweedFS admin server and a worker that applies bucket lifecycle rules, once a day. When disabled, rules are still accepted and stored, but not applied. Ignored with the Client topology, whose rules are enforced by the instance it connects to. Rules stored before enabling are applied on the first pass, minutes after the switch. While on, in a bucket without versioning enabled, an object overwritten between the daily listing and its expiry delete can be deleted although it is new.
198+
## @field {string} [storageClass] - StorageClass of the admin server's 1Gi job-state volume. Empty uses the cluster default; `volume.storageClass` is not used, because in MultiZone it can be local to one zone. Prefer a replicated class: on a node-local one, losing the node stops lifecycle enforcement. Set it before enabling lifecycle: the class is part of the admin StatefulSet's volume claim template, which cannot change, so changing it while lifecycle is on makes every upgrade of the instance fail until it is reverted. To move the volume, disable lifecycle, delete the `admin-data-seaweedfs-admin-0` PVC of the instance, change the class and enable lifecycle again.
198199

199200
## @param {Lifecycle} [lifecycle] - S3 bucket lifecycle configuration.
200201
lifecycle:
@@ -206,3 +207,4 @@ lifecycle:
206207
# the delete loses its new content, which a tenant bucket that rewrites a
207208
# fixed key can hit. On by default only once that path carries identity.
208209
enabled: false
210+
storageClass: ""

0 commit comments

Comments
 (0)