Repository navigation
eve-k: let a healthy peer act for a downed node's designated app (backup DNID) - #6505
Conversation
4f2e524 to
64a45a2
Compare
64a45a2 to
6032e5e
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #6505 +/- ##
==========================================
+ Coverage 26.36% 26.82% +0.45%
==========================================
Files 516 529 +13
Lines 95230 97480 +2250
==========================================
+ Hits 25108 26145 +1037
- Misses 68168 69177 +1009
- Partials 1954 2158 +204 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
6032e5e to
7910f48
Compare
d4c2531 to
398f3f1
Compare
| } | ||
| if !onMe && !scheduledOnNone { | ||
| // Not scheduled on me, but is scheduled elsewhere. | ||
| if !onMe && !scheduledOnNone && elsewhereReady { |
There was a problem hiding this comment.
this 'elsewhereReady' can be false due to temp glitch accessing the apiserver, then it should skip this block and move to delete?
| // does not silently drop the app's last state (e.g. HALTED) on the | ||
| // floor once Kubernetes clears ScheduledOnThisNode. | ||
| if config := lookupAppInstanceConfig(ctx, key, true); config != nil { | ||
| canReport = isCurrentlyBackupDNIDForApp(ctx, *config) |
There was a problem hiding this comment.
and for each app status, we are going to eventually calling api-server to access? seems expensive
| // giving up a lease during a baseos update is not what a temporary | ||
| // failure asks for. | ||
| log.Noticef("handleControllerStatusChange: temporary failure, " + | ||
| "elections left running") |
There was a problem hiding this comment.
do we need to stop the election timer in this case?
There was a problem hiding this comment.
Good catch, yes. TemporaryFail is only set while the new image is on trial
(in_progress partition, post-reboot), and zedagent arms ConfigGetFail before
every request -- so Fail -> TemporaryFail is the normal sequence there, and
the stop armed by that Fail survives this branch and fires ~90s later,
dropping the lease mid-validation. Will add cancelElectionStop() here, plus a
regression test; the existing one only covers Success -> TemporaryFail, where
no timer was armed.
|
I think we normally have zedkube to monitor all the cluster, volumemgr and domainmgr do the creating objects in the cluster. This PR also does 'zedmanager' to query the cluster for if the DNID node is up or down, and some other api-server access. |
|
Found a missing step in the test for proper purge coverage, fixing now. Will address review comments soon |
398f3f1 to
2f3b142
Compare
Delete's "not scheduled on me, but is scheduled elsewhere" skip assumed elsewhere always means a live pillar instance will handle its own teardown. That breaks deleting a Required-affinity app while its designated node is down: the VMIRS/pod object persists in Kubernetes (a dead node's bindings don't vanish), so scheduledOnNone reads false, the skip fires, and nothing ever issues the real delete -- the object sits there, permanently retried by Kubernetes' own ReplicaSet controller, since the designated node, once it reboots, has no config left telling it the app was deleted either. Add elsewhereReady, threaded through scheduledOnMe and its VMI/pod implementations, backed by a new kubeapi.IsNodeReady (reusing backupdnid.go's existing node-Get and Ready-condition helpers). Delete now only defers to elsewhere when that node is actually able to act; otherwise it does the delete itself. Info() and Stop() discard the new value -- their existing scheduledOnNone-based behavior is unchanged. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Signed-off-by: Andrew Durbin <andrewd@zededa.com>
Only rewrite a VMIRS's affinity back to this (DNID) node once the node currently named in it is confirmed gone from the cluster, not merely unreachable. A temporarily-down peer keeps its Node object, so this no longer fires the instant it reconnects, only once it's actually been replaced. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Signed-off-by: Andrew Durbin <andrewd@zededa.com>
Creation always baked the creating node's own name into a new VMI or pod's affinity, never the app's actual designated node. During a backup-DNID failover the backup node runs the creation locally, so it stamped its own name -- meaning the live object's affinity never named the true home to begin with, no matter what zedkube's reconciler later did to the VMIRS template. Resolve AppInstanceConfig's DesignatedNodeUUID (now carried through DomainConfig) to its current node name and use that for the affinity, falling back to the local node if there's no UUID to resolve or the lookup fails. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Signed-off-by: Andrew Durbin <andrewd@zededa.com>
A replicated volume's own doUpdateVol short-circuit (status.IsReplicated -> CREATED_VOLUME, no real creation work) fires for every volume on a node that isn't its app's designated node -- confirmed live: a purge on a backup node left its new volume's PVC never even requested, so the VMI sat Pending on FailedPvcNotFound forever. The volume-generation policy driving the purge made no difference; the check is a static designated-node identity compare, unrelated to the volume's UUID or replica history. Bypass it once this node is confirmed eligible to act as backup DNID for that volume (holds the eve-app-op lease, the designated node has been unhealthy past the configured threshold, and the app is not Required-affinity) -- the same decision zedmanager already makes for app activation, reused here via kubeapi.IsCurrentlyBackupDNID. Needs its own DesignatedNodeUUID/AffinityType on VolumeConfig (cross-referenced from the owning app's VolumeRefList in parseVolumeConfig, mirroring the existing IsNativeContainer walk), since IsReplicated only ever encoded "not me", never "who". And needs its own re-drive: backup DNID changes nothing in the volume's own config, so nothing else notices a volume newly eligible for takeover -- added to volumemgr's existing gc-ticker batch of re-drive passes, alongside a new eve-app-op lease subscription mirroring zedmanager's. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Signed-off-by: Andrew Durbin <andrewd@zededa.com>
An image-backed volume's content tree hits the same designated-node identity gate (IsLocal) as the volume itself and parks at LOADED with zero blobs, so doUpdateVol waits forever on casClient.GetImageHash -- keyed by the content tree's own UUID, which nothing dedupes across apps referencing identical content, so a sibling's download never helps. doUpdateContentTree never revisits an already-LOADED status, so this re-drives via the same delete-and-recreate path handleContentTreeModify already uses for a real DNID reassignment, passing the recreate a locally-overridden copy (IsLocal forced true). ContentTreeConfig gets its own DesignatedNodeUUID (carried directly on the wire, unlike volumes). Affinity is read off whichever volume(s) reference the content tree instead, since it has none of its own. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Signed-off-by: Andrew Durbin <andrewd@zededa.com>
…ache isCurrentlyBackupDNIDWithClient did a live Nodes().Get() on every call, once per app in zedmanager and once per volume and content tree in volumemgr on every relevant pass -- flagged as expensive in review. zedkube now republishes every node's Ready status and its last transition time, keyed by device UUID, on every node's own appStatusTimer tick rather than only on the stats-lease holder. kubeapi.IsCurrentlyBackupDNID takes a NodeHealthLookup function instead of building a client itself; zedmanager and volumemgr each subscribe to the new publication and implement the lookup against their own local cache. The eligibility logic itself is unchanged: not-found, a zero/future transition time, and the ready/threshold checks all carry over exactly. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Signed-off-by: Andrew Durbin <andrewd@zededa.com>
doInstall deliberately skips its "volumes have reached CREATED_VOLUME" gate while a purge is in BringDown, because that phase is tearing the old domain down rather than standing a new one up. doUpdate then fell through to doActivate anyway, bringing the app up on volumes that are still being recreated -- a PVC binds and attaches from the moment it exists, so a domain can boot on one with nothing written into it. updateAIStatusUUID already routes BringDown to removeAIStatus and never reaches doUpdate, but its other callers do. Give all of them the same answer, in doUpdate itself. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Signed-off-by: Andrew Durbin <andrewd@zededa.com>
HandleCreated reported every CSI volume created as soon as the create worker returned, and that report is what lets a volume reach CREATED_VOLUME -- the state zedmanager gates app activation on. A PVC binds and attaches whether or not CDI ever wrote the image into it, so a volume whose upload did not finish would hand an app an empty disk to boot from. Confirm the upload actually completed for a volume that carries content, and report an error rather than success when it did not, or when it cannot be confirmed. A volume with no ReferenceName took the CreatePVC path and has no content to confirm. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Signed-off-by: Andrew Durbin <andrewd@zededa.com>
a5a3623 to
466cb1d
Compare
|
rebased to resolve yetus, still need to review comments |
WaitUntilAppIsRunning reflects only what the controller reports, and a domain reports RUNNING once its process starts -- which says nothing about whether the guest found anything to boot. TestDNIDandBackupDNID stopped there, so an app brought up on a volume with no content in it still read as a pass. Start a BusyBox HTTP server in each VM through cloud-init and poll it after every RUNNING wait, including both backup-DNID activations and the failback. The local network instance is NAT'd, so each app forwards a port on whichever node currently hosts it, and the check resolves that node before polling. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Signed-off-by: Andrew Durbin <andrewd@zededa.com>
Alpine keeps the httpd applet in busybox-extras rather than core BusyBox, so the readiness server never started: the guest booted and took a DHCP lease, the port-forward DNAT was programmed correctly, and port 80 inside the guest simply refused. cloud-init is itself written in Python, so an image that honors this user data at all carries a python3 to serve with, and nothing needs installing. A server that fails to come up now says so on the console, which EVE captures, instead of surfacing only as a readiness timeout. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Signed-off-by: Andrew Durbin <andrewd@zededa.com>
runcmd is per-instance: cloud-init records that it ran and skips it on every later boot of the same instance. The readiness gate has to answer on boots the test drives after the first one -- a deactivate/activate pair and a failback both restart the same instance off the same disk, so the server was simply absent there. Only a purge happened to work, and only because it recreates the volume from the base image and wipes cloud-init's state with it. bootcmd runs on every boot. It runs before networking is configured, but the server binds 0.0.0.0 and accepts once an address arrives. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Signed-off-by: Andrew Durbin <andrewd@zededa.com>
Every other point the test brings vm2 up gates on the guest answering, but the purge did not -- it stopped at the controller reporting RUNNING. That is the one step least able to afford it: the purge builds the volume again from scratch, on a backup node, with the designated node down, so it is the narrowest path there is for an app to come up on a disk whose content never landed. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Signed-off-by: Andrew Durbin <andrewd@zededa.com>
ConfigGetTemporaryFail is set only while the new image is on trial, after the reboot into it, and this branch means to keep contending through that window. It did not cancel a stop already armed, though: zedagent arms ConfigGetFail before every request, so Fail -> TemporaryFail is the ordinary sequence there, and scheduleElectionStopAfter is a no-op while a timer exists. The armed stop fired ninety seconds in and released the lease mid-validation, the outcome the branch exists to prevent. The existing test only covered Success -> TemporaryFail, where nothing was armed, so the gap went unnoticed. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Signed-off-by: Andrew Durbin <andrewd@zededa.com>
|
466cb1d to
017a0d5
Compare
Description
EVE-K restricts each cluster app instance's operations -- activate,
deactivate, purge, delete -- to its Designated Node ID (DNID): only that
node's own zedmanager is allowed to act on the app's config. That's a
pillar-level restriction, not a Kubernetes scheduling one -- a
Preferred-affinity workload could already be scheduled onto any node inthe cluster. So until now, if the DNID node went down, nothing could drive
that app's lifecycle at all, even though the workload itself was free to
run elsewhere.
This PR lets a healthy peer act on a
Preferred-affinity app in itsdesignated node's place once that node has been unhealthy for longer than
cluster.dnid.backupnode.threshold(default 10 minutes, configurable). Onenode is elected via a new
eve-app-opKubernetes lease to avoid two peersracing to activate the same app;
kubeapi.IsCurrentlyBackupDNIDcombinesthat election with a live health read of the designated node before any
node acts. The app moves back to its real designated node automatically once
that node recovers (see "How to test" below for the config this requires).
Required-affinity apps are excluded throughout: Kubernetes itself refusesto schedule one anywhere but its designated node, so nothing here changes
for them.
Along the way, two related gaps in existing behavior are fixed, since the
new backup-DNID path exercises them directly:
hypervisor.Deleteskipped a domain that Kubernetes had alreadyrescheduled elsewhere without checking whether that other node was
actually healthy, which could wedge a delete against a node that was
itself down.
own name, never the app's actual designated node. During a backup
activation that meant the live object's affinity never named the true
home to begin with, so failback silently never reached the running
workload even after
zedkube's reconciler corrected the ReplicaSettemplate. Affinity is now resolved from the app's real designated node
(falling back to the local node if that can't be resolved), so the
descheduler's existing template-vs-affinity mismatch detection can
actually find and move it back.
Known gap, deliberately not fixed here: a
Required-affinity appdeleted while its designated node has never been reachable (so no node ever
holds the in-memory domain state needed to delete its Kubernetes
ReplicaSet) still leaks that ReplicaSet, endlessly retried by Kubernetes'
own controller.
TestDNIDandBackupDNIDusesPreferredaffinity for theapp it deletes specifically to avoid this; it's tracked separately, not
exercised by this PR.
PR dependencies
A number of PRs have been identified through the work towards getting this new test passing:
How to test and validate this PR
Covered by
TestDNIDandBackupDNID, an evetest test requiring a three-nodecluster environment and internet access (the apps boot a real Alpine image
from
dl-cdn.alpinelinux.org). The test:Preferred-affinity apps (vm1, vm2) and one more (vm3) onseparate designated nodes, and confirms
kubernetes.vmi.deschedule.eventsaccepts
boot(required for failback -- see below).confirms it actually runs there, not merely reports configured there.
is still down, confirming each operation lands on the backup node.
Preferredaffinity, already running on a backup node) andconfirms both its app info and volume info converge to
INVALID.onto it automatically.
Run it with:
To step through and inspect each stage individually rather than running to
completion or failure, pause at every checkpoint in turn:
then, per checkpoint (see the test source for the full ordered list):
Config prerequisites the test sets itself, but worth calling out for
manual validation too:
kubernetes.vmi.deschedule.events=boot-- without it, failback neverhappens; an app that moved to another node just keeps running there.
cluster.dnid.backupnode.threshold-- defaults to 600s (10 minutes,min 60s, max 86400s); lower it for a faster manual test cycle. The
effective delay adds the Kubernetes node-monitor grace period on top and
is floored at the
eve-app-oplease duration regardless.Changelog notes
EVE-K clusters: when an app instance's designated node has been unhealthy
for longer than
cluster.dnid.backupnode.threshold(default 10 minutes),another cluster node can now activate, deactivate, purge, or delete that
app on its behalf, and the app automatically moves back once its
designated node recovers (requires
kubernetes.vmi.deschedule.eventstoinclude
boot). Applies only to apps configured withPreferrednodeaffinity; apps configured with
Requiredaffinity are unaffected andcontinue to wait for their designated node to come back.
PR Backports
Checklist
And the last but not least:
check them.
Please, check the boxes above after submitting the PR in interactive mode.