Repository navigation
Enforce durability placement during CSI staging - #646
Hrishikesh Kashyap (Hrishikeshkashyap) wants to merge 4 commits into
Conversation
95862c7 to
0a267c9
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Both ownership fallbacks ignore the driver's actual CSI topology key, breaking resolution from retained PV topology.
2 open findings
What changed in this PR
Enforces durability ownership beyond Pod admission by retaining PV topology and requiring existing storage during CSI staging.
Changes:
- Persists failover policy and initial ownership during provisioning.
- Adds staging ownership checks and an existing-only volume recovery path.
- Extends tests and documents durability behavior.
| File | Description |
|---|---|
| internal/webhook/hyperconverged/handler.go | Adds retained-topology placement fallback. |
| internal/webhook/hyperconverged/handler_unit_test.go | Tests topology fallback. |
| internal/csi/node/node.go | Enforces ownership and existing-only staging. |
| internal/csi/node/node_test.go | Tests durability staging and failures. |
| internal/csi/core/lvm/node.go | Exposes existing-only volume preparation. |
| internal/csi/core/lvm/lvm.go | Prevents allocation when existing storage is required. |
| internal/csi/core/lvm/lvm_test.go | Tests reuse and missing-volume behavior. |
| internal/csi/core/interfaces.go | Adds shared policies and existing-only interface. |
| internal/csi/core/fake.go | Tracks recovery-path calls for tests. |
| internal/csi/controller/controller.go | Persists policy and retains durability topology. |
| internal/csi/controller/controller_test.go | Tests durability topology retention. |
| docs/user-guide.md | Explains durability guarantees. |
| docs/design/webhooks.md | Documents scheduling and staging enforcement. |
| docs/design/pv-recovery.md | Distinguishes recovery policies. |
| docs/architecture.md | Summarizes durability enforcement. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
0a267c9 to
372f2e7
Compare
372f2e7 to
af9a777
Compare
e5f9092 to
bb7d786
Compare
|
Replaced the full cached-PV scan during staging with a controller-runtime field index keyed by CSI driver and volume handle. The index is registered during driver manager setup, and staging retrieves only matching PVs while preserving duplicate-identity rejection. Added tests for index registration, identity filtering, updates, and existing ambiguity checks. |
bb7d786 to
6ad00d2
Compare
2d37563 to
a74153a
Compare
ac44ae0 to
6e9c5e9
Compare
6e9c5e9 to
d9cdd88
Compare
|
Please add durability-mode E2E coverage for the new staging guarantees, using the existing E2E fixtures/infrastructure. The shared E2E StorageClass does not set The important scenarios are:
These should exercise the actual provisioner -> persisted PV metadata/topology -> scheduler -> node plugin -> LVM path. The fake-backed tests are useful for branch/call-count assertions, but cannot establish those real scheduling and storage postconditions. |
Retain hard topology and owner metadata for durability volumes. Reject wrong-node staging and require an existing LV instead of allocating an empty replacement, while preserving availability recovery. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Verify retained topology, owner validation, existing-only LVM staging, and missing-volume error handling. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Document retained topology, fixed ownership, and existing-only durability staging. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
d9cdd88 to
7b4d0b5
Compare
Use the driver topology key for ownerless durability staging and webhook placement while retaining hostname compatibility. Cover driver topology, wrong-node rejection, and hostname fallback in regression tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
7b4d0b5 to
5237382
Compare
Added explicit durability tests for checksum-preserving restaging, Pending replacement when the owner is cordoned, and missing-LV rejection without recreation. Cross-compilation passes; cluster execution is still pending. Destructive coverage requires explicitly disposable Kind. |
There was a problem hiding this comment.
🔵 Needs a closer look
Durability recovery safety remains unverified because v0.4.1 can recreate missing durability LVs, while mixed-version rollout/rollback testing, disposable-cluster staging/resize validation, and exact runtime LVM2 provenance are unavailable.
1 resolved since last review
Review effort: Balanced
|
Follow-up idea: in the durability ownership fallback, consider fetching the Node as PartialObjectMetadata rather than a full Node, since this check only needs its name and labels. Also consider coalescing concurrent Node reads (for example, with singleflight keyed by node name) so simultaneous staging requests on the DaemonSet pod do not issue duplicate GETs. These can be handled in a follow-up PR, separately from this PR’s correctness changes. |


Durability placement remains enforceable after binding and during node staging, rather than relying only on Pod admission.
Changes
CreateVolume.AccessibleTopologyfor durability volumes while preserving availability-mode recovery.selected-nodeis empty, falling back to the initial owner.Tests
Regression coverage includes CSI identity lookup, topology and ownership fallback, static PV capacity, pending resize, orphan cleanup, expansion annotation persistence, and PV-less expansion.