Repository navigation
eve-k volumemgr: reclaim orphaned PVCs after a stale generation is swept - #6406
Conversation
0a27db6 to
d86e9ba
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #6406 +/- ##
==========================================
+ Coverage 28.48% 29.01% +0.53%
==========================================
Files 540 551 +11
Lines 98258 99894 +1636
==========================================
+ Hits 27985 28987 +1002
- Misses 68003 68683 +680
+ Partials 2270 2224 -46 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
d86e9ba to
679921b
Compare
|
|
…tusCtx The reclaim test in lf-edge#6406 passes the context by address at every call site, while initStatusCtx returns a pointer already. Taking its address again yields **volumemgrContext and cmd/volumemgr stops compiling. Pass the pointer straight through. Branch-local: it belongs on lf-edge#6406 once that PR rebases onto current master, not on this integration branch. Signed-off-by: eriknordmark <erik@zededa.com> Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…tusCtx The reclaim test in lf-edge#6406 passes the context by address at every call site, while initStatusCtx returns a pointer already. Taking its address again yields **volumemgrContext and cmd/volumemgr stops compiling. Pass the pointer straight through. Branch-local: it belongs on lf-edge#6406 once that PR rebases onto current master, not on this integration branch. Signed-off-by: eriknordmark <erik@zededa.com> Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…tusCtx The reclaim test in lf-edge#6406 passes the context by address at every call site, while initStatusCtx returns a pointer already. Taking its address again yields **volumemgrContext and cmd/volumemgr stops compiling. Pass the pointer straight through. Branch-local: it belongs on lf-edge#6406 once that PR rebases onto current master, not on this integration branch. Signed-off-by: eriknordmark <erik@zededa.com> Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…tusCtx The reclaim test in lf-edge#6406 passes the context by address at every call site, while initStatusCtx returns a pointer already. Taking its address again yields **volumemgrContext and cmd/volumemgr stops compiling. Pass the pointer straight through. Branch-local: it belongs on lf-edge#6406 once that PR rebases onto current master, not on this integration branch. Signed-off-by: eriknordmark <erik@zededa.com> Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…tusCtx The reclaim test in lf-edge#6406 passes the context by address at every call site, while initStatusCtx returns a pointer already. Taking its address again yields **volumemgrContext and cmd/volumemgr stops compiling. Pass the pointer straight through. Branch-local: it belongs on lf-edge#6406 once that PR rebases onto current master, not on this integration branch. Signed-off-by: eriknordmark <erik@zededa.com> Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…tusCtx The reclaim test in lf-edge#6406 passes the context by address at every call site, while initStatusCtx returns a pointer already. Taking its address again yields **volumemgrContext and cmd/volumemgr stops compiling. Pass the pointer straight through. Branch-local: it belongs on lf-edge#6406 once that PR rebases onto current master, not on this integration branch. Signed-off-by: eriknordmark <erik@zededa.com> Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Integration branch on master with the conversion chain (lf-edge#6530, lf-edge#6063, fork#6) and the purge/PVC robustness set (lf-edge#6442, lf-edge#6406, lf-edge#6478). Records the tips each piece was replayed from, the branch-local adapters that no PR carries, and the storage-resizer content pin. Signed-off-by: eriknordmark <erik@zededa.com> Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…tusCtx The reclaim test in lf-edge#6406 passes the context by address at every call site, while initStatusCtx returns a pointer already. Taking its address again yields **volumemgrContext and cmd/volumemgr stops compiling. Pass the pointer straight through. Branch-local: it belongs on lf-edge#6406 once that PR rebases onto current master, not on this integration branch. Signed-off-by: eriknordmark <erik@zededa.com> Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
@andrewd-zededa Heads-up on a collision: #6478 adds Neither version is a superset of the other, so this needs a decision rather than a drop:
The union would be roughly Either order works from here: you fold it into #6406 and I rebase #6478 onto it, or I land the framework commit from #6478 ("evetest: reach kubectl through the framework", which is a separate commit for exactly this reason) and you drop yours. Do you have a preference? Worth settling soon — #6478 only compiles today because this one has not merged. |
…tusCtx The reclaim test in lf-edge#6406 passes the context by address at every call site, while initStatusCtx returns a pointer already. Taking its address again yields **volumemgrContext and cmd/volumemgr stops compiling. Pass the pointer straight through. Branch-local: it belongs on lf-edge#6406 once that PR rebases onto current master, not on this integration branch. Signed-off-by: eriknordmark <erik@zededa.com> Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> (cherry picked from commit 32182f2)
Both PRs promote the tests/apps kubectl plumbing into EdgeDevice, and they picked different shapes: lf-edge#6406 bakes the app namespace into RunKubectl and brings the richer KubeItemList a PVC's phase needs, while lf-edge#6478 takes an explicit namespace plus a per-call timeout, which the Longhorn workaround needs to reach longhorn-system. Keep lf-edge#6478's runner as the only one and move KubectlListItems onto it; the local copy in the app helpers is then dead and goes, as does the duplicate cluster outage-threshold key lf-edge#6478 and lf-edge#6505 each declare. Both PRs also pre-date master's volume-generation policy argument on PurgeApplication, so their two cluster call sites pass the bump policy they were written against. Branch-local: it belongs on whichever of the two rebases last. Signed-off-by: eriknordmark <erik@zededa.com> Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Integration branch on master with the conversion chain (lf-edge#6530, lf-edge#6063, fork#6) and the robustness set (lf-edge#6442, lf-edge#6406, lf-edge#6478, lf-edge#6505, lf-edge#6451, lf-edge#6590, lf-edge#6599). Records the tips each piece was replayed from, where two PRs collide and which side won, the branch-local adapters that no PR carries, and the storage-resizer content pin. Signed-off-by: eriknordmark <erik@zededa.com> Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…tusCtx The reclaim test in lf-edge#6406 passes the context by address at every call site, while initStatusCtx returns a pointer already. Taking its address again yields **volumemgrContext and cmd/volumemgr stops compiling. Pass the pointer straight through. Branch-local: it belongs on lf-edge#6406 once that PR rebases onto current master, not on this integration branch. Signed-off-by: eriknordmark <erik@zededa.com> Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> (cherry picked from commit 32182f2) (cherry picked from commit 7b2d1da)
Both PRs promote the tests/apps kubectl plumbing into EdgeDevice, and they picked different shapes: lf-edge#6406 bakes the app namespace into RunKubectl and brings the richer KubeItemList a PVC's phase needs, while lf-edge#6478 takes an explicit namespace plus a per-call timeout, which the Longhorn workaround needs to reach longhorn-system. Keep lf-edge#6478's runner as the only one and move KubectlListItems onto it; the local copy in the app helpers is then dead and goes, as does the duplicate cluster outage-threshold key lf-edge#6478 and lf-edge#6505 each declare. Both PRs also pre-date master's volume-generation policy argument on PurgeApplication, so their two cluster call sites pass the bump policy they were written against. Branch-local: it belongs on whichever of the two rebases last. Signed-off-by: eriknordmark <erik@zededa.com> Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> (cherry picked from commit 2514912)
Integration branch on master with the conversion chain plus the fault-injection stress harness (lf-edge#6530, lf-edge#6063, fork#6, fork#7) and the robustness set (lf-edge#6442, lf-edge#6406, lf-edge#6478, lf-edge#6505, lf-edge#6451, lf-edge#6590, lf-edge#6599). Records the tips each piece was replayed from, where two PRs collide and which side won, the branch-local adapters that no PR carries, and the chaos storage-resizer content pin. Signed-off-by: eriknordmark <erik@zededa.com> Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…tusCtx The reclaim test in lf-edge#6406 passes the context by address at every call site, while initStatusCtx returns a pointer already. Taking its address again yields **volumemgrContext and cmd/volumemgr stops compiling. Pass the pointer straight through. Branch-local: it belongs on lf-edge#6406 once that PR rebases onto current master, not on this integration branch. Signed-off-by: eriknordmark <erik@zededa.com> Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Both PRs add a kubectl runner to EdgeDevice, so taking them together leaves two RunKubectl methods and two EVEKubeAppNamespace constants on one type and the framework stops compiling. Keep lf-edge#6478's runner, which takes an explicit timeout, and move lf-edge#6406's KubectlListItems onto it; the local copies in the apps tests go away with it. Two of lf-edge#6406's call sites also predate master: SeparateClusterPort is a function now, and PurgeApplication takes a volume-generation policy. Branch-local: it belongs on lf-edge#6406 once that PR rebases onto current master, not on this integration branch. Signed-off-by: eriknordmark <erik@zededa.com> Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…tusCtx The reclaim test in lf-edge#6406 passes the context by address at every call site, while initStatusCtx returns a pointer already. Taking its address again yields **volumemgrContext and cmd/volumemgr stops compiling. Pass the pointer straight through. Branch-local: it belongs on lf-edge#6406 once that PR rebases onto current master, not on this integration branch. Signed-off-by: eriknordmark <erik@zededa.com> Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Both PRs add a kubectl runner to EdgeDevice, so taking them together leaves two RunKubectl methods and two EVEKubeAppNamespace constants on one type and the framework stops compiling. Keep lf-edge#6478's runner, which takes an explicit timeout, and move lf-edge#6406's KubectlListItems onto it; the local copies in the apps tests go away with it. Two of lf-edge#6406's call sites also predate master: SeparateClusterPort is a function now, and PurgeApplication takes a volume-generation policy. Branch-local: it belongs on lf-edge#6406 once that PR rebases onto current master, not on this integration branch. Signed-off-by: eriknordmark <erik@zededa.com> Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
working on a rebase |
679921b to
cfb5a11
Compare
|
Expanding the fix to gate on cluster mode IsReplicated and dnid/backup dnid handling. |
cfb5a11 to
806e550
Compare
@eriknordmark I rebased on your changes, this branch should be ready soon |
806e550 to
f146368
Compare
f146368 to
620e434
Compare
sweepStaleGenerations deletes a stale purge generation's VMIRS and pod, but not its PVC. When the purge lands while the node is down, volumemgr never creates a VolumeStatus for the old generation, so nothing deletes that PVC. Add gcPVCs to volumemgr's GC tick. The PVC list is cluster-wide, but a controller need not send every volume to every node, so a PVC this node has no record of may be live elsewhere. gcPVCs deletes a PVC only when this node's config holds the same volume at a newer generation, no VolumeConfig or VolumeStatus here names the PVC's own generation, and this node owns the volume or is its backup DNID. gcPVCs runs on volumemgr's main loop, so GetPVCList takes a deadline from its caller, and gcPVCs uses a short one since the next tick retries. DeletePVC gets the kubeAPITimeout the other kubeapi calls use. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Andrew Durbin <andrewd@zededa.com>
EdgeDevice gains KubectlListNames, built on RunKubectl, so a test can list PVCs and other objects in the EVE app namespace. tests/apps kept a local copy of this helper; the cluster tests now need it too. EdgeClusterConfig gains AddBlankVolume. It gives every selected node the same standalone volume. It can leave nodes out, because a controller need not send a volume to every node of a cluster, and it can start the volume at a later generation or under a UUID the test chose. EdgeCluster gains WaitForFreshNodesReady. After a power-off, the last cluster report still shows the node Ready, so WaitUntilNodesAreReady returns before it has booted. The fresh variant counts only reports that arrive after the call, and replaces the upgrade test's own copy. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Andrew Durbin <andrewd@zededa.com>
assertNoOrphanedPVCs asked only that each PVC present was expected, and listPVCNames returned an empty list on any kubectl error, so the check passed while k3s was down. listPVCNames now fails on a kubectl error, and the check also requires each created volume to still have its PVC. TestVMAppPurgeAfterPowerCycle runs it again, with timer.gc.vdisk at its 60s floor and a shorter timeout to match. TestClusterPVCGCDeletesOnlyOrphans runs on three nodes. A standalone persistent volume goes to two of them only. An orphan PVC is created under a volume no node has yet, so it stays put, and the volume is then sent at generation 1. The designated node deletes the orphan, and later the backup DNID deletes the app volume's superseded PVC while the designated node is down. The persistent PVC survives on every node, including the one with no config for it. A checkpoint marks each of these states. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Andrew Durbin <andrewd@zededa.com>
620e434 to
696c3f2
Compare
|
pushed for CI linting issues |
evetest: skipped suites/tests for this PRThis PR is scoped to eve-k volumemgr's PVC garbage collection ( Unrelated whole suites (different subsystem entirely):
Redundant/unrelated individual tests within otherwise-related suites (kept representative coverage instead):
An engineer can comment |
Description
pillar: reclaim orphaned PVCs after a stale generation is swept— thefix.
sweepStaleGenerations(added in #6257) deletes a stale purgegeneration's VMIRS and its pod, but not its PVC. When a purge is issued while
the node is down, the node boots straight into the new generation's config, so
volumemgr never creates a
VolumeStatusfor the old generation and its normaldelete path never runs. The old PVC stays in the cluster and nothing points at
it.
This adds
gcPVCsto volumemgr's GC tick. The safety question is which PVCs itmust keep. The PVC list is cluster-wide, but a controller need not send every
volume to every node of a cluster, and an app-free standalone volume can be
present on some nodes only. A node can therefore list a live PVC that it has no
record of, so "no
VolumeStatusnames it" is not enough to delete it.gcPVCsdeletes a PVC only when all of these hold:VolumeConfigorVolumeStatuson this node names the PVC's owngeneration, which covers a purge in flight and a create still deferred;
IsReplicatedfalse), or is its backup DNIDwhile the designated node is down.
A PVC for a volume this node does not know is never deleted. The cost is that
a volume removed from the config entirely while its node was down keeps its
PVC, which is the safe failure.
A PVC name carries one number, but a volume has two counters. The comparison
uses
GenerationCounter + LocalGenerationCounter, the same sumKey()andGetPVCName()use. The file and ZFS GC (gcVolumes) is unchanged.gcPVCsruns on volumemgr's main loop, so it lists PVCs with a 5s deadline;a missed pass is retried on the next tick.
GetPVCListnow takes its deadlinefrom the caller, and the startup scan keeps the 30s
kubeAPITimeout.DeletePVCgets the same 30s deadline; it had none.evetest: list app-namespace objects and add cluster blank volumes—framework only.
EdgeDevice.KubectlListNamesmoves the PVC listing out oftests/apps.EdgeClusterConfig.AddBlankVolumeadds one standalone volume to selectednodes, can leave nodes out the way a controller may, and can start the volume
at a later generation or under a UUID the test chose.
EdgeCluster.WaitForFreshNodesReadycounts only cluster reports that arriveafter the call. After a power-off, the last cached report still shows the
node Ready, so
WaitUntilNodesAreReadycan return before the node hasbooted. This replaces the upgrade test's own copy of the same wait.
evetest: cover PVC garbage collection, on one node and across a cluster—new coverage, plus a fix to an assertion that could pass without checking
anything.
assertNoOrphanedPVCsasked only that each PVC present was expected. An emptylist satisfies that, and
listPVCNamesreturned an empty list on any kubectlerror, so the assertion passed while k3s was down. It now fails on a kubectl
error and also requires a volume in
CREATED_VOLUMEstate to still have itsPVC.
TestVMAppPurgeAfterPowerCyclere-enables it withtimer.gc.vdiskat its60s floor.
TestClusterPVCGCDeletesOnlyOrphansreplaces the earlier cluster test, whichnever produced a real orphan. On three nodes it sets up:
designated node and no app;
it. The volume is then sent at generation 1, and its designated node deletes
the orphan;
the backup DNID deletes.
Per-node logs show which node deleted each orphan. The persistent PVC survives
on every node throughout, including the node with no config for it. Each state
has a checkpoint:
persistent-volume-exists,orphan-exists,orphan-cleaned-up,persistent-volume-not-cleaned-up,backup-orphan-exists,backup-orphan-cleaned-up, andpersistent-volume-not-cleaned-up-after-outage.PR dependencies
None. #6257 is already merged; this completes the PVC half of that sweep.
How to test and validate this PR
Automated coverage:
Manual check on an EVE-k node:
<volume-uuid>-pvc-1.<volume-uuid>-pvc-0in theeve-kube-appnamespace.This stands for the orphan a purge leaves when the node was down.
timer.gc.vdisk/10, six minutes by default), volumemgrlogs this at info level and the PVC goes away:
gcPVCs: deleting PVC <volume-uuid>-pvc-0, superseded by a newer generation of volume <volume-uuid>Validation status:
TestClusterPVCGCDeletesOnlyOrphanspassed on a 3-node EVE-k amd64cluster. Every node kept both orphans until it was allowed to delete them, and
kept the persistent PVC throughout, including the node with no config for it.
The DNID deleted its orphan once the volume was sent, and the backup DNID
deleted the other within three minutes of the DNID powering off. Both orphans
were bound, and the backup orphan's PV was removed with it. The persistent
PVC survived both deletes, an app purge, and the outage.
TestVMAppPurgeAfterPowerCyclepassed on EVE-k amd64 and on KVM amd64,each within the 5-minute reclaim bound. On EVE-k,
gcPVCsdeleted the purgedgeneration's PVC, and the live PVC stayed.
Changelog notes
Fixed a bug where an EVE-K node kept the old disk of an application purged
while the node was down. The stale PersistentVolumeClaim stayed in the cluster
and consumed storage, although nothing used it. EVE now reclaims it, and never
removes a volume's disk that the node has no record of.
PR Backports
Checklist
And the last but not least:
check them.
Please, check the boxes above after submitting the PR in interactive mode.
🤖 Generated with Claude Code