From e3e04683069815acb1058cc24086cf6e617ddca0 Mon Sep 17 00:00:00 2001 From: Ping Qiu Date: Mon, 4 May 2026 13:56:13 -0700 Subject: [PATCH] docs(readme): cut to engineering-tone (#38) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace the marketing-leaning prose with a terser, fact-first README: status / why this exists / architecture / quick start / repo layout / development / current limitations / license. Drops abstract slogans and adjective stacks. Keeps every concrete command, path, image reference, and limitation that was previously documented. Net: 362 → 190 lines. --- seaweed-block/README.md | 402 ++++++++++++---------------------------- 1 file changed, 115 insertions(+), 287 deletions(-) diff --git a/seaweed-block/README.md b/seaweed-block/README.md index 1dcf82c89f..3fda5b4796 100644 --- a/seaweed-block/README.md +++ b/seaweed-block/README.md @@ -1,160 +1,76 @@ -# seaweed-block (Alpha) +# seaweed-block -**Kubernetes CSI · iSCSI today · WAL-backed recovery · RF=2/RF=3 roadmap** +`seaweed-block` is an experimental block storage service for Kubernetes. -

- seaweed-block alpha architecture: Kubernetes PVC to CSI, blockmaster, blockvolume, iSCSI, and WAL recovery -

+It provides a CSI-based block volume path backed by SeaweedFS components. The +current implementation focuses on a small, understandable storage stack for +testing block volume creation, attach, mount, write/read, and cleanup flows. -`seaweed-block` is a small, opinionated block storage service for Kubernetes. +## Status -It's built for the middle path: teams who need replicated PersistentVolumes but -find Ceph/Rook too heavy for a 3-node edge cluster, and find Local PVs too -fragile for real workloads. The goal is a storage engine that's small enough to -read, with recovery semantics you can actually reason about. +Alpha. -> **⚠️ Alpha.** Today this passes a single-node smoke path: dynamic PVC create → -> CSI attach → iSCSI mount → pod write/read checksum → cleanup. It is **not** -> production-ready. Multi-node failover, durable packaging, and failover-under- -> mount are still ahead. If you need five-nines today, this isn't it yet. +The current code passes a single-node Kubernetes smoke test: ---- +```text +dynamic PVC create +→ CSI attach +→ iSCSI mount +→ pod write/read checksum +→ cleanup +``` -## Why build this? +This is not production-ready. -Storage in Kubernetes usually forces a choice between two extremes: +Known missing pieces: -- **The giants:** Ceph/Rook are mature and powerful, but operationally heavy - for small teams or lab environments. -- **The basics:** Local PVs are simple but don't handle replication or node - failure gracefully. +- multi-node failover +- failover while a volume is mounted +- durable production packaging (the alpha manifest still uses `emptyDir`) +- broader recovery testing +- RF=2/RF=3 replication on the Kubernetes path +- a real operator (a manifest launcher does the work today) -`seaweed-block` exists because we wanted a storage engine where the recovery -logic isn't a black box — where you can trace how data moves between peers -without a PhD in distributed systems. +## Why this exists ---- +Kubernetes storage usually comes down to two options: -## The design (or: how we plan to not lose data) +- a full storage stack such as Ceph/Rook +- Local PVs with weaker failure handling -Three principles drive the architecture. +`seaweed-block` explores a smaller block storage design for cases where a full +storage platform is too heavy but local storage is not enough. The current +goal is to validate the control path, data path, and recovery model before +expanding the system. -### 1. WAL + extent (write-ahead-log first) +## Architecture -Writes don't disappear into a complex filesystem. They hit a WAL-style path -first, then drain into extent storage: +The alpha path: + +- Kubernetes PVC +- CSI driver +- block master / controller +- block volume process +- iSCSI target +- WAL-backed local write path + +The local write path: ```text write → WAL → flush/checkpoint → extent ``` -This makes the local data lifecycle explicit and easy to debug when things go -sideways. The current alpha uses `walstore`; a smarter WAL backend is on the -roadmap behind an explicit test gate. +The WAL-first design makes writes easier to inspect and recover during +development. -### 2. Dual-lane recovery +Recovery is split into base transfer and live WAL feeding so normal writes +keep flowing while a peer catches up. Only one peer is the source of truth +for a recovery stream at any given time. -Recovery shouldn't choke the hot path. We separate base data transfers from -live WAL feeding so normal writes keep flowing while a peer catches up. - -The rule that prevents the classic multi-sender bugs: - -```text -one peer, one monotonic WAL feeding owner -``` - -Only one peer is the source of truth for a recovery stream at any given time. - -### 3. Protocol and execution separation - -Control-plane facts and data-plane execution stay strictly separated: - -```text -observation != authority -placement intent != assignment -authority moved != data continuity proven -frontend fact != storage readiness -``` - -This is slower to design but much easier to audit. It's also what keeps iSCSI, -future NVMe-oF, recovery, and placement from quietly redefining each other's -contracts. - ---- - -## How it compares - -This isn't a feature comparison — it's the intended product position. - -| System | Strength | Tradeoff | -| :--- | :--- | :--- | -| **Ceph/Rook** | mature, powerful, broad storage platform | operationally heavy for small clusters | -| **OpenEBS local engines** | Kubernetes-friendly, easy to start | behavior varies by chosen engine/topology | -| **seaweed-block** | **small, inspectable, recovery-contract-driven** | **early alpha, incomplete** | - -The pitch, if it lands: simpler than a full distributed storage platform, more -structured than ad-hoc local disks, CSI-first, designed for RF=2/RF=3, iSCSI -first with NVMe-oF later, and recovery semantics that are documented and -testable. - ---- - -## What actually works today - -The current code can survive a single-node Kubernetes alpha smoke run: - -- ✅ CSI dynamic PVC `CreateVolume` -- ✅ blockmaster lifecycle and automated placement -- ✅ launcher-generated `blockvolume` Deployment -- ✅ iSCSI frontend attach, mount, and pod write/read checksums -- ✅ CSI `DeleteVolume` cleanup path (alpha smoke removes the launcher-generated - blockvolume Deployments today; an operator will replace this manual sweep) -- ✅ no dangling iSCSI sessions after cleanup -- ✅ TestOps registry and a minimal `cmd/sw-testops` CLI - -Current alpha defaults: - -- Kubernetes: single-node k3s lab -- frontend: iSCSI -- backend: `walstore` -- launcher-generated blockvolume state: `emptyDir` -- demo StorageClass replication: RF=1 - -### What's explicitly NOT claimed (yet) - -These boundaries matter for an alpha — read them before evaluating: - -- not production-ready -- not multi-node validated as a Kubernetes product -- not durable across blockvolume pod restart in the alpha manifest -- not yet a full operator (a manifest launcher does the work today) -- no failover-under-mounted-PVC claim -- no NVMe-oF CSI claim yet -- no performance or soak-test claim - -### What's next on the to-do list - -- move the alpha manifest off `emptyDir` to a durable node-local path -- ship a proper operator (replace the manual launcher) -- multi-node validation for RF=2/RF=3 -- failover-under-load (pulling the rug while a pod is writing) -- one-command install path -- reduce noisy debug logs - ---- - -## Quick Start +## Quick start You need a Linux Kubernetes node where privileged CSI pods are allowed and -`iscsi_tcp` is loadable. k3s works well for this. - -**Prerequisites** - -- Docker -- `kubectl` -- a running Kubernetes cluster (e.g. k3s) -- `iscsi_tcp` loadable on the node -- `KUBECONFIG` pointing at your cluster +`iscsi_tcp` is loadable. k3s works. For a default k3s install: @@ -162,13 +78,13 @@ For a default k3s install: export KUBECONFIG="${KUBECONFIG:-/etc/rancher/k3s/k3s.yaml}" ``` -**Fast path: use published alpha images** +### Fast path: published images ```bash bash scripts/run-k8s-demo-ghcr.sh "$PWD" ``` -This uses: +This pulls: ```text ghcr.io/seaweedfs/seaweed-block:alpha @@ -177,7 +93,42 @@ ghcr.io/seaweedfs/seaweed-block-csi:alpha If the GHCR packages are not public yet, use the local build path below. -To install the alpha stack and use your own PVC/app instead of the bundled demo: +### Local build path + +```bash +bash scripts/build-alpha-images.sh "$PWD" +``` + +For k3s, import both images: + +```bash +docker save sw-block:local | sudo k3s ctr images import - +docker save sw-block-csi:local | sudo k3s ctr images import - +``` + +### Run the smoke test + +```bash +bash scripts/run-k8s-alpha.sh "$PWD" +``` + +Expected: + +```text +[alpha] PASS: dynamic PVC create/delete completed checksum write/read and cleanup +``` + +### Run the app demo (PVC survives pod replacement) + +```bash +bash scripts/run-alpha-app-demo.sh "$PWD" +``` + +The demo writes from one pod, deletes it, then mounts the same PVC from a +second pod and verifies the data. See +[docs/kubernetes-app-demo.md](docs/kubernetes-app-demo.md). + +### Use your own PVC ```bash bash scripts/install-k8s-alpha.sh "$PWD" @@ -187,176 +138,53 @@ kubectl apply -f examples/kubernetes/basic-app/writer-pod.yaml ``` `apply-k8s-alpha-blockvolumes.sh` is temporary. It applies the blockvolume -workload generated by blockmaster until a real operator owns that reconciliation. +workload generated by blockmaster until a real operator owns that +reconciliation. -**Local build path** - -```bash -bash scripts/build-alpha-images.sh "$PWD" -``` - -**Import (k3s example — both images)** - -```bash -docker save sw-block:local | sudo k3s ctr images import - -docker save sw-block-csi:local | sudo k3s ctr images import - -``` - -If your cluster pulls from a registry instead of local k3s images: - -```bash -export SW_BLOCK_IMAGE=registry.example.com/storage/sw-block:alpha -export SW_BLOCK_CSI_IMAGE=registry.example.com/storage/sw-block-csi:alpha - -bash scripts/build-alpha-images.sh "$PWD" -docker push "$SW_BLOCK_IMAGE" -docker push "$SW_BLOCK_CSI_IMAGE" -``` - -The demo scripts render the manifests with those image names at runtime. - -**Run the app demo** - -```bash -bash scripts/run-k8s-demo.sh "$PWD" -``` - -Expected result: +## Repository layout ```text -[app-demo] PASS: app pod wrote data, replacement app pod read it back through the same PVC, cleanup complete +cmd/ command entry points (blockmaster, blockvolume, blockcsi) +core/ core storage logic (authority, csi, host, lifecycle, recovery, replication) +internal/ non-public packages and TestOps registry +deploy/ Kubernetes manifests +docs/ design and quickstart docs +examples/ Kubernetes examples +scripts/ build, install, and smoke-test helpers ``` -This is the best first demo for Kubernetes users: one app pod writes -`/data/demo.bin`, a replacement app pod mounts the same PVC, and the replacement -pod verifies the checksum. See -[docs/quickstart-kubernetes.md](docs/quickstart-kubernetes.md). +## Development -**Short smoke path** +Run tests: + +```bash +go test ./... +``` + +Run the Kubernetes alpha smoke: ```bash bash scripts/run-k8s-alpha.sh "$PWD" ``` -Expected result: - -```text -[alpha] PASS: dynamic PVC create/delete completed checksum write/read and cleanup -``` - -The app-demo walkthrough is also available at -[docs/kubernetes-app-demo.md](docs/kubernetes-app-demo.md). - -To adapt the PVC shape for your own app, start with -[examples/kubernetes/basic-app](examples/kubernetes/basic-app). - -For the manual `kubectl apply` flow, see -[deploy/k8s/alpha/README.md](deploy/k8s/alpha/README.md). - ---- - -## Simple user manual - -The current alpha flow: - -1. Build `sw-block:local` and `sw-block-csi:local`. -2. Deploy blockmaster, CSI controller, and CSI node manifests. -3. Create a PVC using the `sw-block-dynamic` StorageClass. -4. Apply the launcher-generated blockvolume Deployment. -5. Run a pod that mounts the PVC. -6. Delete the pod and PVC. -7. Confirm the launcher-generated blockvolume workload and iSCSI sessions are - gone. - -`scripts/run-k8s-alpha.sh "$PWD"` runs that whole path. Still a lab workflow — -a real operator should eventually replace the manual launcher step. - ---- - -## Roadmap - -**Near-term** - -- replace `emptyDir` with a durable node-local path -- one-command install path -- operator/controller for launcher-generated workloads -- easier remote K8s shell scenarios in TestOps -- reduce log noise - -**Availability** - -- RF=2/RF=3 Kubernetes path -- multi-node attach -- failover while a pod stays mounted -- returned-replica reintegration -- WAL retention and flow-control under pressure - -**Protocol/backend** - -- keep iSCSI as MVP default -- protocol-neutral CSI dispatch -- NVMe-oF behind the same frontend-target model -- smart WAL backend behind an explicit test gate - -**More detail** +More detail: - [docs/architecture.md](docs/architecture.md) - [docs/developer-architecture.md](docs/developer-architecture.md) - [docs/runtime-state-machines.md](docs/runtime-state-machines.md) - [docs/roadmap.md](docs/roadmap.md) ---- +## Current limitations -## Repository layout +This project is still early. -```text -cmd/ - blockmaster/ control plane daemon - blockvolume/ per-replica data/frontend daemon - blockcsi/ CSI controller/node plugin - sw-testops/ minimal TestOps scenario runner +Do not use it for production workloads. The current alpha is for local +development, design validation, and Kubernetes smoke testing. -core/ - authority/ assignment publication and observation model - csi/ CSI implementation - host/ composed master/volume hosts - lifecycle/ desired volume, node inventory, placement intent - launcher/ Kubernetes manifest renderer - recovery/ recovery execution components - replication/ peer replication pieces +Before production use, the project needs stronger recovery behavior, multi-node +support, durable packaging, observability, failure testing, and operational +documentation. -deploy/k8s/alpha/ alpha Kubernetes manifests and manual guide -docs/ architecture and roadmap notes -examples/ copyable Kubernetes app examples -internal/ non-public support libraries and TestOps registry -scripts/ build and smoke-test helpers -``` +## License ---- - -## Development tests - -Development tests need Go installed. - -Useful smoke tests: - -```bash -go test ./cmd/sw-testops ./internal/testops ./cmd/blockcsi \ - ./core/launcher ./cmd/blockmaster ./core/host/master \ - ./core/lifecycle -count=1 -``` - -Kubernetes alpha smoke: - -```bash -bash scripts/run-k8s-alpha.sh "$PWD" -``` - ---- - -## Honesty note - -Read this repo as an alpha block-storage system with a runnable Kubernetes -smoke path and a serious recovery/control-plane design under construction. - -It is not finished storage software. +Apache-2.0