mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-04 10:07:28 +01:00
helm: expose launcher durable impl
This commit is contained in:
1 parent
4b1f3f4d6f
commit
4389be1e7b
8 files changed
+66
-3
No files matched your search
@@ -56,6 +56,7 @@ spec:
|
||||
- "--launcher-image={{ include "seaweed-block.image" . }}"
|
||||
- "--launcher-namespace={{ .Release.Namespace }}"
|
||||
- "--launcher-durable-root={{ .Values.blockmaster.durableRoot }}"
|
||||
- "--launcher-durable-impl={{ .Values.blockmaster.durableImpl }}"
|
||||
{{- if .Values.blockmaster.launcherStatus }}
|
||||
- "--launcher-status"
|
||||
{{- end }}
|
||||
|
||||
@@ -30,7 +30,8 @@
|
||||
"blockmaster": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"stateHostPath": { "type": "string" },
|
||||
"durableImpl": { "type": "string", "enum": ["walstore", "smartwal"] },
|
||||
"stateHostPath": { "type": "string" },
|
||||
"stateHostPathType": { "type": "string" },
|
||||
"statePermissionsImage": {
|
||||
"type": "object",
|
||||
|
||||
@@ -39,6 +39,7 @@ blockmaster:
|
||||
launcherNamespace: kube-system
|
||||
launcherStatus: true
|
||||
launcherPVCOwnerRef: true
|
||||
durableImpl: walstore
|
||||
stateHostPath: ""
|
||||
stateHostPathType: DirectoryOrCreate
|
||||
statePermissionsImage:
|
||||
|
||||
@@ -36,6 +36,7 @@ type flags struct {
|
||||
launcherImage string
|
||||
launcherMasterAddr string
|
||||
launcherDurableRoot string
|
||||
launcherDurableImpl string
|
||||
launcherStateHostPath string
|
||||
launcherReplicationAck string
|
||||
launcherISCSIPortBase int
|
||||
@@ -75,6 +76,7 @@ func parseFlags(args []string) (flags, error) {
|
||||
fs.StringVar(&f.launcherImage, "launcher-image", "sw-block:local", "G15d rendered blockvolume container image")
|
||||
fs.StringVar(&f.launcherMasterAddr, "launcher-master-addr", "", "G15d master address used in rendered blockvolume args; defaults to listener address after bind")
|
||||
fs.StringVar(&f.launcherDurableRoot, "launcher-durable-root", "/var/lib/sw-block", "G15d rendered blockvolume durable root base")
|
||||
fs.StringVar(&f.launcherDurableImpl, "launcher-durable-impl", "walstore", "G15d rendered blockvolume durable implementation: walstore (default) or smartwal")
|
||||
fs.StringVar(&f.launcherStateHostPath, "launcher-state-hostpath", "", "optional hostPath base mounted at the blockvolume durable root; empty keeps generated blockvolume state on throwaway emptyDir")
|
||||
fs.StringVar(&f.launcherReplicationAck, "launcher-replication-ack", "best-effort", "G15d rendered blockvolume replication ACK profile: best-effort, sync-quorum, or sync-all")
|
||||
fs.IntVar(&f.launcherISCSIPortBase, "launcher-iscsi-port-base", 3260, "G15d iSCSI port base for generated blockvolume workloads")
|
||||
@@ -328,6 +330,7 @@ func runLifecycleLauncherTick(h *master.Host, f flags) error {
|
||||
Image: f.launcherImage,
|
||||
MasterAddr: masterAddr,
|
||||
DurableRootBase: f.launcherDurableRoot,
|
||||
DurableImpl: f.launcherDurableImpl,
|
||||
StateHostPathBase: f.launcherStateHostPath,
|
||||
ReplicationAck: f.launcherReplicationAck,
|
||||
OwnerReferenceToPVC: f.launcherPVCOwnerRef,
|
||||
|
||||
@@ -18,6 +18,7 @@ type K8sRenderConfig struct {
|
||||
Image string
|
||||
MasterAddr string
|
||||
DurableRootBase string
|
||||
DurableImpl string
|
||||
StateHostPathBase string
|
||||
RecoveryMode string
|
||||
ReplicationAck string
|
||||
@@ -49,6 +50,14 @@ func RenderBlockVolumeDeployments(plan lifecycle.BlockVolumeWorkloadPlan, cfg K8
|
||||
if cfg.DurableRootBase == "" {
|
||||
cfg.DurableRootBase = stateMountPath
|
||||
}
|
||||
if cfg.DurableImpl == "" {
|
||||
cfg.DurableImpl = "walstore"
|
||||
}
|
||||
switch cfg.DurableImpl {
|
||||
case "walstore", "smartwal":
|
||||
default:
|
||||
return nil, fmt.Errorf("launcher: durable impl %q invalid; want walstore or smartwal", cfg.DurableImpl)
|
||||
}
|
||||
if cfg.StateHostPathBase != "" && path.Clean(cfg.DurableRootBase) != stateMountPath {
|
||||
return nil, fmt.Errorf("launcher: state hostPath requires durable root base %q, got %q", stateMountPath, cfg.DurableRootBase)
|
||||
}
|
||||
@@ -173,7 +182,7 @@ func blockVolumeArgs(plan lifecycle.BlockVolumeWorkloadPlan, replica lifecycle.B
|
||||
"--data-addr=" + replica.DataAddr,
|
||||
"--ctrl-addr=" + replica.CtrlAddr,
|
||||
"--durable-root=" + durableRoot(plan, replica, cfg),
|
||||
"--durable-impl=walstore",
|
||||
"--durable-impl=" + cfg.DurableImpl,
|
||||
fmt.Sprintf("--durable-blocks=%d", plan.SizeBytes/4096),
|
||||
"--durable-blocksize=4096",
|
||||
"--recovery-mode=" + cfg.RecoveryMode,
|
||||
|
||||
@@ -36,6 +36,7 @@ func TestG15d_K8sRenderer_RendersBlockVolumeDeploymentArgs(t *testing.T) {
|
||||
"--volume-id=pvc-a",
|
||||
"--replica-id=r1",
|
||||
"--durable-root=/var/lib/sw-block/pvc-a/r1",
|
||||
"--durable-impl=walstore",
|
||||
"--recovery-mode=dual-lane",
|
||||
"--replication-ack=best-effort",
|
||||
"sw-block.seaweedfs.com/volume: pvc-a",
|
||||
@@ -60,6 +61,33 @@ func TestG15d_K8sRenderer_RendersBlockVolumeDeploymentArgs(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestPhase34_K8sRendererCanRenderSmartWALDurableImpl(t *testing.T) {
|
||||
manifests, err := RenderBlockVolumeDeployments(sampleWorkloadPlan(), K8sRenderConfig{
|
||||
MasterAddr: "m:9333",
|
||||
DurableImpl: "smartwal",
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("RenderBlockVolumeDeployments: %v", err)
|
||||
}
|
||||
raw := string(manifests[0].YAML)
|
||||
if !strings.Contains(raw, "--durable-impl=smartwal") {
|
||||
t.Fatalf("manifest missing smartwal durable impl:\n%s", raw)
|
||||
}
|
||||
}
|
||||
|
||||
func TestPhase34_K8sRendererRejectsUnknownDurableImpl(t *testing.T) {
|
||||
_, err := RenderBlockVolumeDeployments(sampleWorkloadPlan(), K8sRenderConfig{
|
||||
MasterAddr: "m:9333",
|
||||
DurableImpl: "maybe",
|
||||
})
|
||||
if err == nil {
|
||||
t.Fatal("expected error")
|
||||
}
|
||||
if !strings.Contains(err.Error(), "durable impl") {
|
||||
t.Fatalf("error=%v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestG15d_K8sRenderer_RF2UsesDistinctNamesAndPorts(t *testing.T) {
|
||||
manifests, err := RenderBlockVolumeDeployments(sampleWorkloadPlan(), K8sRenderConfig{MasterAddr: "m:9333"})
|
||||
if err != nil {
|
||||
|
||||
+18
-1
@@ -53,6 +53,17 @@ surface stays read-only. The utility:
|
||||
- fsyncs the file,
|
||||
- writes `smartwal-corruption-evidence.txt`.
|
||||
|
||||
Added a launcher/Helm selection seam:
|
||||
|
||||
```text
|
||||
blockmaster --launcher-durable-impl=walstore|smartwal
|
||||
Helm value: blockmaster.durableImpl
|
||||
```
|
||||
|
||||
The default remains `walstore` to preserve existing Helm gates. A SmartWAL D4
|
||||
scenario must explicitly set `blockmaster.durableImpl=smartwal`; otherwise it
|
||||
is not testing SmartWAL at all.
|
||||
|
||||
The inspector returns:
|
||||
|
||||
```text
|
||||
@@ -79,7 +90,8 @@ whether an offset is inside the WAL ring or extent region.
|
||||
Command:
|
||||
|
||||
```text
|
||||
go test ./core/storage/smartwal ./cmd/sw-block-testutil
|
||||
go test ./core/storage/smartwal ./cmd/sw-block-testutil ./core/launcher ./cmd/blockmaster
|
||||
helm template sw-block charts/seaweed-block --set blockmaster.durableImpl=smartwal
|
||||
```
|
||||
|
||||
Result:
|
||||
@@ -87,6 +99,8 @@ Result:
|
||||
```text
|
||||
ok github.com/seaweedfs/seaweed-block/core/storage/smartwal
|
||||
ok github.com/seaweedfs/seaweed-block/cmd/sw-block-testutil
|
||||
ok github.com/seaweedfs/seaweed-block/core/launcher
|
||||
ok github.com/seaweedfs/seaweed-block/cmd/blockmaster
|
||||
```
|
||||
|
||||
Tests prove:
|
||||
@@ -98,6 +112,8 @@ Tests prove:
|
||||
- Truncated SmartWAL files are rejected.
|
||||
- The mutation utility writes evidence, flips a real record CRC byte, and the
|
||||
corrupted record no longer decodes as valid.
|
||||
- Helm can render `--launcher-durable-impl=smartwal` for D4 without changing
|
||||
the default release path.
|
||||
|
||||
## D4 gate rule
|
||||
|
||||
@@ -117,6 +133,7 @@ before_bytes=<sample>
|
||||
after_bytes=<sample>
|
||||
mutation=flip_last_record_crc_byte
|
||||
restart_persistence=hostpath
|
||||
durable_impl=smartwal
|
||||
```
|
||||
|
||||
If those fields are not present, the D4 scenario must fail closed or be marked
|
||||
|
||||
@@ -190,6 +190,9 @@ Precheck artifact:
|
||||
contract for future D4 injection code.
|
||||
- `cmd/sw-block-testutil smartwal-corrupt-latest-record` is the TestOps-only
|
||||
mutation utility; do not put mutating corruption under `sw-block ops`.
|
||||
- Helm/launcher must explicitly set `blockmaster.durableImpl=smartwal` /
|
||||
`--launcher-durable-impl=smartwal`; the default Helm path remains `walstore`
|
||||
and is not valid evidence for a SmartWAL corruption claim.
|
||||
|
||||
Scenario shape:
|
||||
|
||||
|
||||
Reference in new issue
Block a user