Skip to content

Commit 2ab64cd

Browse files
kvapsclaude
andcommitted
feat(api): StoragePool.Spec.DestroyOnDelete consent flag (Phase 10.8 step)
Operators opt into the destructive teardown path explicitly: with DestroyOnDelete=true (default false), deleting the StoragePool CRD also runs vgremove --force / zpool destroy + wipefs -a so the discovery loop can re-publish the freed devices as PhysicalDevice CRDs. Default-false matches the GitOps "you delete the manifest, the CRD goes away, but the on-disk data sticks around for manual rescue" model — safer than the alternative even though it leaks unmanaged VGs/zpools across deletes. The reconciler half (finalizer + actual vgremove call) lands once Phase 10.1 promotes the satellite's StoragePool reconciler to a controller-runtime watcher; this commit just lays down the typed field + admission validation. Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
1 parent 8e4ceb4 commit 2ab64cd

2 files changed

Lines changed: 24 additions & 0 deletions

File tree

api/v1alpha1/storagepool_types.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,18 @@ type StoragePoolSpec struct {
5353
// props is the LINSTOR property map for this pool.
5454
// +optional
5555
Props map[string]string `json:"props,omitempty"`
56+
57+
// destroyOnDelete controls whether `kubectl delete storagepool`
58+
// also runs the destructive teardown — `vgremove --force` /
59+
// `zpool destroy` plus `wipefs -a` so the discovery loop can
60+
// re-publish the freed devices as `PhysicalDevice` CRDs.
61+
// Default false: deleting the CRD only removes the LINSTOR-side
62+
// pool registration; the on-disk VG / zpool stays intact and
63+
// can be re-imported manually with `vgchange -ay` / `zpool
64+
// import`. Operators must opt in to the destructive path
65+
// explicitly. Phase 10.8.
66+
// +optional
67+
DestroyOnDelete bool `json:"destroyOnDelete,omitempty"`
5668
}
5769

5870
// StoragePoolStatus is the observed state of a storage pool, populated by

config/crd/bases/blockstor.io.blockstor.io_storagepools.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,18 @@ spec:
3939
spec:
4040
description: spec defines the desired state of StoragePool
4141
properties:
42+
destroyOnDelete:
43+
description: |-
44+
destroyOnDelete controls whether `kubectl delete storagepool`
45+
also runs the destructive teardown — `vgremove --force` /
46+
`zpool destroy` plus `wipefs -a` so the discovery loop can
47+
re-publish the freed devices as `PhysicalDevice` CRDs.
48+
Default false: deleting the CRD only removes the LINSTOR-side
49+
pool registration; the on-disk VG / zpool stays intact and
50+
can be re-imported manually with `vgchange -ay` / `zpool
51+
import`. Operators must opt in to the destructive path
52+
explicitly. Phase 10.8.
53+
type: boolean
4254
nodeName:
4355
description: |-
4456
nodeName is the name of the satellite hosting this pool. Same as the

0 commit comments

Comments
 (0)