Skip to content

[17.0-stable] kube: resync stale state on cluster DNID reassignment - #6817

Merged
eriknordmark merged 3 commits into
lf-edge:17.0-stablefrom
naiming-zededa:pr6138-17.0-stable
Oct 17, 2026
Merged

eriknordmark merged 3 commits into
lf-edge:17.0-stablefrom
naiming-zededa:pr6138-17.0-stable

Conversation

@naiming-zededa

Copy link
Copy Markdown
Contributor

Description

Backport of #6138

Cherry-picks a5e46a6 ("kube: resync stale state on cluster DNID reassignment") with -x. The pick applies cleanly and is not edited.

It needs two test-only fixup commits. 17.0-stable already has backports of #6197 (#6487) and #6240 (#6488), and both build on #6138 on master. #6138 was never backported, so those backports were adapted to work without it:

After the fixups, both test files are identical to master.

This is one of four pillar prerequisites for the 17.0-stable backport of #6505 (backup DNID).

How to test and validate this PR

Same as #6138: with the ENC running on three nodes, place an app with its DNID on one node, then run "replace node" on that node. Check that the app, volume instance and content tree move to the new DNID node, and that the VMI's node affinity is updated.

Build checks: make pillar-vet with HV=k (go vet -tags k ./...) and make pillar-fmt-check pass.

Changelog notes

kube: resync stale state on cluster DNID reassignment

Checklist

  • I've provided a proper description
  • I've added a reference link to the original PR
  • PR's title follows the template

🤖 Generated with Claude Code

naiming-zededa and others added 3 commits October 15, 2026 16:06
A "replace-node" operation reassigns an app's cluster Designated Node
ID (DNID) to a different node, but several agents were only acting on
the reassignment at creation time and never revisiting already-existing
status:

- volumemgr: a content tree becoming local (IsLocal flip) never
  re-entered the download pipeline, and IsLocal/IsReplicated changes on
  existing ContentTree/Volume status were never resynced from config.
  handleVolumeModify only re-drives doUpdateVol when IsReplicated
  actually transitions, so unrelated modifies (e.g. refcount bumps)
  don't re-run the volume state machine.
- zedmanager: AppInstanceStatus.IsDesignatedNodeID stayed frozen,
  which could leave no node reporting status to the controller across
  the reassignment window.
- zedkube: a VMIRS's node affinity is set once at creation and was
  never corrected afterward, so it could keep pointing at a stale
  node. Add a periodic reconciler, gated on "am I the DNID node" (not
  "am I currently running the app") so a temporary failover doesn't
  get its affinity rewritten.

Exports hypervisor.SetKubeAffinity so zedkube's reconciler builds the
same affinity used at creation time instead of duplicating the logic.

Signed-off-by: naiming-zededa <naiming@zededa.com>
(cherry picked from commit a5e46a6)
Completes the backport of a5e46a6 ("kube: resync stale state on
cluster DNID reassignment") to 17.0-stable.

On master, stuckmount_test.go (41756b7) reuses the testNodeName
constant declared in vmirsaffinity_test.go by a5e46a6. Because
a5e46a6 had not been backported, the 17.0 backport of that test
(60c8daf, lf-edge#6487) declared its own copy. With a5e46a6 now picked,
the two declarations collide; drop the 17.0-only one so the file
matches master.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: naiming-zededa <naiming@zededa.com>
Completes the backport of a5e46a6 ("kube: resync stale state on
cluster DNID reassignment") to 17.0-stable.

On master, cf85242 ("volumemgr: publish readiness during the wait")
changed initStatusCtx to return *volumemgrContext and converted
initVolumeModifyCtx, the test helper added by a5e46a6, to match. Its
17.0 backport (943820f, lf-edge#6488) skipped that conversion because the
helper was not on 17.0 yet. Apply it here so the file matches master.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: naiming-zededa <naiming@zededa.com>
@codecov

codecov Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 44.00000% with 42 lines in your changes missing coverage. Please review.
✅ Project coverage is 23.13%. Comparing base (41751c2) to head (f7bab36).
⚠️ Report is 9 commits behind head on 17.0-stable.

Files with missing lines Patch % Lines
pkg/pillar/cmd/zedkube/vmirsaffinity.go 47.05% 25 Missing and 2 partials ⚠️
pkg/pillar/cmd/volumemgr/handlecontent.go 0.00% 7 Missing ⚠️
pkg/pillar/cmd/zedmanager/zedmanager.go 0.00% 4 Missing ⚠️
pkg/pillar/cmd/volumemgr/handlevolume.go 77.77% 1 Missing and 1 partial ⚠️
pkg/pillar/cmd/zedkube/zedkube.go 0.00% 1 Missing ⚠️
pkg/pillar/hypervisor/kubevirt.go 66.66% 1 Missing ⚠️
Additional details and impacted files
@@               Coverage Diff               @@
##           17.0-stable    #6817      +/-   ##
===============================================
+ Coverage        22.68%   23.13%   +0.44%     
===============================================
  Files              512      523      +11     
  Lines            94635    96482    +1847     
===============================================
+ Hits             21466    22317     +851     
- Misses           71342    72131     +789     
- Partials          1827     2034     +207     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@andrewd-zededa andrewd-zededa left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. The pick matches a5e46a6 and both fixups match the backport plan; the two test files are identical to master.

@eriknordmark
eriknordmark merged commit 4d1ef06 into lf-edge:17.0-stable Oct 17, 2026
63 of 69 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants