Skip to content

[17.0-stable] zedrouter: ignore portmaps on Switch NIs in the overlap check - #6797

Merged
rene merged 1 commit into
lf-edge:17.0-stablefrom
rene:fix/ev-2923-2926-failover-17.0
Oct 20, 2026
Merged

rene merged 1 commit into
lf-edge:17.0-stablefrom
rene:fix/ev-2923-2926-failover-17.0

Conversation

@rene

@rene rene commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Description

Backport of #6796 (zedrouter commit only)

Jira: EV-2926

Clean cherry-pick -x of the master commit:

  • zedrouter: ignore portmaps on Switch NIs in the overlap check

The two zedkube commits of #6796 ("gate the VMIRS replica reset on the
eve-app-op lease" and "start a failover only when a pod is terminating",
EV-2923) depend on the backup-DNID series (#6505), which is not on
17.0-stable yet. They will be backported as clean cherry-picks once that
series is backported.

How to test and validate this PR

On a 3-node eve-k cluster:

  1. Create a Switch NI. Deploy two VM apps attached to it, each with the same
    portmap ACL (e.g. tcp lport 7022 -> 22), on two different nodes (A and B).
  2. Power off node A.
  3. Watch kubectl -n eve-kube-app get vmi,pods -o wide from a surviving node.

Expected: if the app lands on node B, its network is activated and the VMI
reaches Running. There is no overlapping portmaps error in
/run/zedrouter/AppNetworkStatus/<app-uuid>.json and no failed to find adapter with MAC errors.

Unit tests: TestPortMapOverlapIgnoredOnSwitchNI (zedrouter).

Changelog notes

  • Fixed apps on a Switch network instance being rejected with an "overlapping
    portmaps" error when another app on it uses the same portmap. This blocked VM
    failover onto a node already running such an app.

Checklist

  • I've provided a proper description
  • I've added the proper documentation
  • I've tested my PR on amd64 device
  • I've tested my PR on arm64 device
  • I've written the test verification instructions
  • I've set the proper labels to this PR
  • I've added a reference link to the original PR
  • PR's title follows the template
  • I've checked the boxes above, or I've provided a good reason why I didn't
    check them.

Not yet tested on a device.

🤖 Generated with Claude Code

@rene

rene commented Oct 15, 2026

Copy link
Copy Markdown
Contributor Author

Converted to draft while #6796 is not merged.

@codecov

codecov Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 53.84615% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 23.09%. Comparing base (4749201) to head (7f8c46b).
⚠️ Report is 39 commits behind head on 17.0-stable.

Files with missing lines Patch % Lines
pkg/pillar/cmd/zedkube/leaderelect.go 0.00% 3 Missing ⚠️
pkg/pillar/cmd/zedrouter/validation.go 77.77% 1 Missing and 1 partial ⚠️
pkg/pillar/cmd/zedkube/failover.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@               Coverage Diff               @@
##           17.0-stable    #6797      +/-   ##
===============================================
+ Coverage        22.66%   23.09%   +0.43%     
===============================================
  Files              512      522      +10     
  Lines            94634    96341    +1707     
===============================================
+ Hits             21449    22253     +804     
- Misses           71358    72072     +714     
- Partials          1827     2016     +189     

☔ 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.

validateAppNetworkConfig() rejects an app whose portmap ACLs overlap
with those of another activated app on the same network instance (or
on one sharing its port label). Portmaps are only implemented for Local
NIs, where they become DNAT rules on the uplink address. A Switch NI
does no NAT: every app interface has its own address on the external
network and nireconciler never installs portmap rules for it, so two
apps using the same lport there cannot conflict.

The false positive is harmless on a single node, where the controller
lets the user deploy both apps anyway and only the second one fails.
On an eve-k cluster it breaks failover. Two VM apps with the same
portmap on a Switch NI run fine on different nodes, but when one of
them fails over to the node running the other, zedrouter rejects its
AppNetworkConfig in handleAppNetworkCreate() before allocating the app
number, choosing the MAC generator or activating the network. The
adapters are left without a MAC, so every multus ConnectPodAtL2 call
for the new virt-launcher pod fails with "failed to find adapter with
MAC ...", and the VM never starts on the failover node.

Skip adapters on Switch NIs in checkForPortMapOverlap(), both for
duplicates within an adapter and across apps. An NI whose config is
not known is still checked, as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Renê de Souza Pinto <rene@renesp.com.br>
(cherry picked from commit 6a6a98a)
@rene
rene force-pushed the fix/ev-2923-2926-failover-17.0 branch from 9754342 to d874f87 Compare October 18, 2026 11:33
@rene
rene marked this pull request as ready for review October 18, 2026 11:33
@rene
rene force-pushed the fix/ev-2923-2926-failover-17.0 branch from d874f87 to 7f8c46b Compare October 18, 2026 11:36

@eriknordmark eriknordmark 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

Comment thread pkg/pillar/cmd/zedkube/leaderelect.go Outdated
LeaseDuration: 300 * time.Second,
RenewDeadline: 180 * time.Second,
RetryPeriod: 15 * time.Second,
LeaseDuration: 60 * time.Second,

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.

I don't know if it is a good idea to use different intervals for this stats leader election between master (18.0) and 17.0
And after all, @andrewd-zededa is about to backport the backup-DNID work, so then you could do a clean cherry-pick.
Maybe it is better to backport the zedrouter patches for now only.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Agreed. Diverging the stats lease timings from master only to undo them when the backup-DNID series lands isn't worth it. I've reduced this PR to the zedrouter commit (EV-2926). I'll backport the two zedkube commits (gate the VMIRS replica reset on the eve-app-op lease + start a failover only when a pod is terminating) as clean cherry-picks once @andrewd-zededa's backup-DNID backport is merged.

@rene
rene force-pushed the fix/ev-2923-2926-failover-17.0 branch from 7f8c46b to a67e4e6 Compare October 19, 2026 10:14
@rene rene changed the title [17.0-stable] eve-k: fix VM failover held back by the stats lease and a false portmap overlap [17.0-stable] zedrouter: ignore portmaps on Switch NIs in the overlap check Oct 19, 2026
@rene
rene merged commit c3fc3f1 into lf-edge:17.0-stable Oct 20, 2026
62 of 68 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.

3 participants