Skip to content

Commit beab659

Browse files
test(seaweedfs): pin the naming guard's MultiZone zone-component classification
MultiZone (and Simple-with-pools) tenants render no plain `volume` component — extra/seaweedfs sets volume.enabled=false and the vendored chart emits one component per zone key with suffix `volume-<key>`, truncated at (62 - len(suffix)), which is SHORTER than the 56-char cut the guard's renamedVolumePrefix replays. The final review pass flagged this divergence as a guard bypass. For the supported instance the prefixes cannot diverge: the tenant module hardcodes the name `seaweedfs`, the fullname is 16 chars, and nothing truncates until a zone/pool key of ~40+ characters. Three new cases pin that supported path — legacy-only zones adopt, release-named-only zones refuse as class S, both generations refuse — since the suite previously had no zone shapes at all and the zone objects are the ONLY evidence on a MultiZone tenant. The divergence beyond that boundary (long instance names or absurd keys) is an accepted, documented limit, not a fix: decided in the 1.6 triage, recorded in _naming.tpl (both copies, kept in lockstep) and the runbook's Scope section. Instance names are fixed by the tenant module, so absurd keys are the only reachable trigger; revisit if instance naming is ever opened up. Assisted-By: Claude <[email protected]> Signed-off-by: Myasnikov Daniil <[email protected]>
1 parent 8c5155b commit beab659

3 files changed

Lines changed: 114 additions & 2 deletions

File tree

‎packages/extra/seaweedfs/templates/_naming.tpl‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,21 @@
2222
2323
The guard deliberately does NOT call seaweedfs.fullname directly: that helper
2424
reads .Values.fullnameOverride, which this chart PINS to `seaweedfs`, so it
25-
returns the chart-named generation — the opposite of what is wanted here. */}}
25+
returns the chart-named generation — the opposite of what is wanted here.
26+
27+
ACCEPTED LIMIT — zone/pool volume components. MultiZone (and Simple-with-
28+
pools) tenants get per-group components with suffix `volume-<key>`, cut at
29+
(62 - len(suffix)), i.e. SHORTER than the 56 this helper reconstructs. The
30+
prefixes only diverge when the fullname exceeds that shorter cut: for the
31+
supported instance (the tenant module hardcodes the name `seaweedfs`,
32+
fullname 16 chars) that takes a zone/pool key of ~40+ characters, and for
33+
the default `volume` group it can never happen (its suffix IS the 56 cut).
34+
A guard prefix that diverges means a release-named zone component the guard
35+
cannot see. Decided 2026-07-17 (1.6 triage): accepted and documented in
36+
docs/operations/seaweedfs-431-rename-recovery.md (Scope) rather than
37+
reconstructed per-key — instance names are fixed by the tenant module and
38+
absurd keys are the only reachable trigger. Revisit if instance naming is
39+
ever opened up or a key-length clamp lands in extra/seaweedfs. */}}
2640
{{- define "seaweedfs.renamedVolumePrefix" -}}
2741
{{- $release := . -}}
2842
{{- $full := $release -}}

‎packages/system/seaweedfs/templates/_naming.tpl‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,21 @@
2222
2323
The guard deliberately does NOT call seaweedfs.fullname directly: that helper
2424
reads .Values.fullnameOverride, which this chart PINS to `seaweedfs`, so it
25-
returns the chart-named generation — the opposite of what is wanted here. */}}
25+
returns the chart-named generation — the opposite of what is wanted here.
26+
27+
ACCEPTED LIMIT — zone/pool volume components. MultiZone (and Simple-with-
28+
pools) tenants get per-group components with suffix `volume-<key>`, cut at
29+
(62 - len(suffix)), i.e. SHORTER than the 56 this helper reconstructs. The
30+
prefixes only diverge when the fullname exceeds that shorter cut: for the
31+
supported instance (the tenant module hardcodes the name `seaweedfs`,
32+
fullname 16 chars) that takes a zone/pool key of ~40+ characters, and for
33+
the default `volume` group it can never happen (its suffix IS the 56 cut).
34+
A guard prefix that diverges means a release-named zone component the guard
35+
cannot see. Decided 2026-07-17 (1.6 triage): accepted and documented in
36+
docs/operations/seaweedfs-431-rename-recovery.md (Scope) rather than
37+
reconstructed per-key — instance names are fixed by the tenant module and
38+
absurd keys are the only reachable trigger. Revisit if instance naming is
39+
ever opened up or a key-length clamp lands in extra/seaweedfs. */}}
2640
{{- define "seaweedfs.renamedVolumePrefix" -}}
2741
{{- $release := . -}}
2842
{{- $full := $release -}}

‎packages/system/seaweedfs/tests/naming_guard_test.yaml‎

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,90 @@ tests:
462462
- failedTemplate:
463463
errorPattern: "has BOTH naming generations present"
464464

465+
# ---------------------------------------------------------------------------
466+
# MultiZone (and Simple-with-pools) tenants have NO plain `volume` component —
467+
# extra/seaweedfs sets volume.enabled=false and renders one component per zone
468+
# key, suffix `volume-<key>`. For the supported instance (the tenant module
469+
# hardcodes the name `seaweedfs`, fullname 16 chars) nothing is truncated, so
470+
# the reconstructed prefix `seaweedfs-system-volume` must prefix-match every
471+
# zone component. These pin that. The reconstruction does NOT cover zone
472+
# components of long-named instances or ~40+ char zone keys — an accepted,
473+
# documented limit (_naming.tpl, runbook Scope), deliberately not tested.
474+
# ---------------------------------------------------------------------------
475+
476+
- it: renders for a legacy-only MultiZone tenant (zone components adopt in place)
477+
kubernetesProvider:
478+
scheme: *scheme
479+
objects:
480+
- *ns
481+
- kind: PersistentVolumeClaim
482+
apiVersion: v1
483+
metadata:
484+
name: data1-seaweedfs-volume-md-0
485+
namespace: tenant-fresh
486+
- kind: StatefulSet
487+
apiVersion: apps/v1
488+
metadata:
489+
name: seaweedfs-volume-md
490+
namespace: tenant-fresh
491+
labels:
492+
app.kubernetes.io/name: seaweedfs
493+
asserts:
494+
- hasDocuments:
495+
count: 0
496+
497+
- it: refuses class S for a MultiZone tenant with only zone components (fresh 1.5.x)
498+
kubernetesProvider:
499+
scheme: *scheme
500+
objects:
501+
- *ns
502+
# No plain `volume` component exists on a MultiZone tenant — the zone
503+
# objects are the ONLY release-named evidence, so if the prefix match
504+
# missed them this tenant would render and be renamed away from its data.
505+
- kind: PersistentVolumeClaim
506+
apiVersion: v1
507+
metadata:
508+
name: data1-seaweedfs-system-volume-md-0
509+
namespace: tenant-fresh
510+
- kind: StatefulSet
511+
apiVersion: apps/v1
512+
metadata:
513+
name: seaweedfs-system-volume-md
514+
namespace: tenant-fresh
515+
labels:
516+
app.kubernetes.io/name: seaweedfs
517+
asserts:
518+
- failedTemplate:
519+
errorPattern: "keeps its data on volumes named after the Helm release"
520+
521+
- it: refuses both-generations for a MultiZone tenant
522+
kubernetesProvider:
523+
scheme: *scheme
524+
objects:
525+
- *ns
526+
- kind: PersistentVolumeClaim
527+
apiVersion: v1
528+
metadata:
529+
name: data1-seaweedfs-volume-md-0
530+
namespace: tenant-fresh
531+
- kind: PersistentVolumeClaim
532+
apiVersion: v1
533+
metadata:
534+
name: data1-seaweedfs-system-volume-md-0
535+
namespace: tenant-fresh
536+
- kind: StatefulSet
537+
apiVersion: apps/v1
538+
metadata:
539+
name: seaweedfs-system-volume-md
540+
namespace: tenant-fresh
541+
labels:
542+
app.kubernetes.io/name: seaweedfs
543+
status:
544+
readyReplicas: "0"
545+
asserts:
546+
- failedTemplate:
547+
errorPattern: "has BOTH naming generations present"
548+
465549
- it: ignores unrelated data1-*-volume-* claims of other apps
466550
kubernetesProvider:
467551
scheme: *scheme

0 commit comments

Comments
 (0)