fix(storageclass): preserve guest-only resources#6
Conversation
|
Focused review at exact head
Evidence:
The ownership primitive itself is compatible with generic |
61ce65f to
2caf64c
Compare
|
Current-head re-review at The previous three findings are fixed on the success path: translate patches now run before the final marker write; the deletion expectation names the StorageClass GVK; selector mismatch and full controller adoption/deletion are covered. Exact-head focused and shared gates pass. P0 - a translate-patch error still persists a partially mutated, unowned mirrored object. Independent exact-head error injection proves this:
The red assertions are: Required contract: when translate patching fails, do not persist any virtual mutation. A robust shape is to build/patch/mark a deep copy and only assign it to the object after all fallible transforms succeed, while retaining the patcher's original pre-state for the final write; alternatively, make the defer skip persistence when the transform path has returned an error. Add this error-injection regression so both marker and prior fields are unchanged after the failed reconcile. Gates at exact head:
No PR #5 stacking or live rollout until this closes. |
2caf64c to
0b0186f
Compare
|
Current-head focused re-review at The error-path blocker is closed. The deterministic regression now proves both halves of the contract after an injected patch failure that deletes the marker before returning error:
The earlier findings also remain closed: final marker is after successful translate patches, owned host-delete asserts an explicit empty StorageClass GVK, selector mismatch covers owned/unowned branches, and full Independent gates at exact head:
Evidence boundary: this approves PR #6 by itself. PR #5 remains orthogonal and unstacked; a combined current-head full-Reconcile gate is still required before producing or rolling a runtime image. No live rollout is approved by this comment. |
Summary
Fixes the vcluster defect recorded in apecloud/kubeblocks#10614.
apecloud/vclusterhas Issues disabled, so the linked KubeBlocks issue contains the scene and reproduction evidence.Root cause
hostStorageClassSyncer.SyncToHostunconditionally deleted the virtual object whenever its mapped host object was missing. The mirror mapper treats host objects as managed, while imported virtual StorageClasses carried no ownership marker. As a result, enabling fromHost StorageClass sync deleted unrelated guest-only StorageClasses, including a generated S3 StorageClass used by BackupRepo. Helm rollback cannot restore such a deletion.Constructed test scene and reproducibility
b98b1ae5a603fa504daf1e745d65784c5a0be0eawith fromHost StorageClass sync disabled.SyncToHostand is deleted.The regression test failed against the base with
virtual state mismatch: expected the guest object, existing state was empty.Contract
Tests
go test -v ./pkg/controllers/resources/storageclasses -run TestFromHostSync -count=1-> rc1 atPreserve_guest-only_storage_class_when_host_resource_is_absentgo test ./pkg/controllers/resources/storageclasses -count=1git diff --checkScope boundary
This is a vcluster StorageClass lifecycle fix. It is not an etcd restore PASS and does not authorize rollout until a focused review, patched image identity proof, and the previously defined guest/host live gates pass.