ipam: fix inconsistent behavior for same-prefix routes between IPv4 and IPv6#1261
Open
yushoyamaguchi wants to merge 1 commit into
Open
Conversation
Previously, routes were added one by one without grouping. When multiple routes shared the same prefix, IPv4 inserted them as separate entries while IPv6 kernel behavior implicitly merged them into ECMP. This caused the same config to behave differently depending on the address family. To fix the inconsistency, group same-prefix routes in the plugin and apply them as a single ECMP route, aligning IPv4 behavior with IPv6. Signed-off-by: Yusho Yamaguchi <ys-yamaguchi@kddi.com>
Contributor
Author
|
cc @s1061123 |
Contributor
Author
|
This inconsistency has been causing confusion in our operation of production environment, so I am submitting this as a bug fix rather than a feature change. |
s1061123
requested changes
May 24, 2026
Contributor
s1061123
left a comment
There was a problem hiding this comment.
/hold
As mentioned in #1249, this code changes IPAM behavior completely and it causes its regression (i.e. this bugfix causes bigger bugs) and current valid configuration is deprecated. In addition, CNI spec does not specify how CNI result object shows ECMP path as well.
It should be held until we conclude its design discussion, in #1249.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
When multiple routes have the same prefix, IPv4 inserted them as separate entries while IPv6 kernel behavior implicitly merged them into ECMP.
This caused the same config to behave differently depending on the address family.
This patch absorbs the kernel behavior difference on the
pluginsside to ensure consistent ECMP behavior regardless of address family.Related issue/PR
#615
#1249
Current behavior
IPv4
When we write as below in cni's json,
Pod's FIB is below
IPv6
When we write as below in cni's json,
Pod's FIB is below
Implementation
Group routes with the same destination prefix, table, scope, and priority, then apply them as a single ECMP route via
RouteAddEcmpwith MultiPath.