Skip to content

agent:overlay: Add underlayProtocol 'Auto' for automatic underlay selection#43057

Merged
joestringer merged 2 commits intomainfrom
pr/smagnani96/overlay-switch-underlay
Jan 29, 2026
Merged

agent:overlay: Add underlayProtocol 'Auto' for automatic underlay selection#43057
joestringer merged 2 commits intomainfrom
pr/smagnani96/overlay-switch-underlay

Conversation

@smagnani96
Copy link
Copy Markdown
Contributor

@smagnani96 smagnani96 commented Dec 1, 2025

Superseeds #42861.

Please refer to commit messages:

  1. Add new default underlayProtocol: "auto". This will allow Cilium to automatically pick an enabled underlay as protocol (IPv4 first, otherwise IPv6). The change is transparent to all users who do not explicitly define underlayProtocol.
  2. Prohibit setting a disabled underlayProtocol. Prior to this, Cilium did not throw any error, but it was using the wrong TunnelOverhead while computing routeMTU for pods in pkg/mtu.

@smagnani96 smagnani96 requested a review from pchaigno December 1, 2025 12:14
@smagnani96 smagnani96 self-assigned this Dec 1, 2025
@smagnani96 smagnani96 added kind/enhancement This would improve or streamline existing functionality. release-note/misc This PR makes changes that have no direct user impact. area/agent Cilium agent related. feature/ipv6-only Relates to single-stack IPv6 support. labels Dec 1, 2025
@smagnani96 smagnani96 force-pushed the pr/smagnani96/overlay-switch-underlay branch from f4a1c2d to 870d388 Compare December 1, 2025 14:08
@smagnani96
Copy link
Copy Markdown
Contributor Author

/test

@smagnani96 smagnani96 force-pushed the pr/smagnani96/overlay-switch-underlay branch from 870d388 to b2ab794 Compare December 1, 2025 16:52
@smagnani96
Copy link
Copy Markdown
Contributor Author

/test

@smagnani96 smagnani96 marked this pull request as ready for review December 2, 2025 13:57
@smagnani96 smagnani96 requested a review from a team as a code owner December 2, 2025 13:57
@github-actions

This comment was marked as resolved.

@github-actions github-actions bot added the stale The stale bot thinks this issue is old. Add "pinned" label to prevent this from becoming stale. label Jan 2, 2026
@pchaigno pchaigno removed the stale The stale bot thinks this issue is old. Add "pinned" label to prevent this from becoming stale. label Jan 5, 2026
@joestringer joestringer added release-note/bug This PR fixes an issue in a previous release of Cilium. dont-merge/needs-rebase This PR needs to be rebased because it has merge conflicts. and removed release-note/misc This PR makes changes that have no direct user impact. labels Jan 9, 2026
@smagnani96 smagnani96 force-pushed the pr/smagnani96/overlay-switch-underlay branch from b2ab794 to fa10b0e Compare January 9, 2026 16:15
@smagnani96
Copy link
Copy Markdown
Contributor Author

/test

@smagnani96 smagnani96 force-pushed the pr/smagnani96/overlay-switch-underlay branch from fa10b0e to 4489787 Compare January 9, 2026 17:23
@smagnani96 smagnani96 requested review from a team as code owners January 9, 2026 17:23
@smagnani96
Copy link
Copy Markdown
Contributor Author

/test

@smagnani96 smagnani96 removed the dont-merge/needs-rebase This PR needs to be rebased because it has merge conflicts. label Jan 9, 2026
Copy link
Copy Markdown
Member

@pchaigno pchaigno left a comment

Choose a reason for hiding this comment

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

In general, I'm a bit wary of auto flags as it tends to create an unstable environment for users, but in this case, it's only dependent on other config flags, so I think we should be fine.

@smagnani96 smagnani96 force-pushed the pr/smagnani96/overlay-switch-underlay branch from bbe0639 to e1deef6 Compare January 28, 2026 16:44
@smagnani96 smagnani96 requested review from a team as code owners January 28, 2026 16:44
@smagnani96 smagnani96 requested review from gandro and thorn3r January 28, 2026 16:44
@smagnani96 smagnani96 force-pushed the pr/smagnani96/overlay-switch-underlay branch from e1deef6 to 539fd5d Compare January 28, 2026 16:47
@smagnani96 smagnani96 requested a review from a team as a code owner January 28, 2026 16:47
@smagnani96 smagnani96 requested a review from qmonnet January 28, 2026 16:47
@smagnani96 smagnani96 force-pushed the pr/smagnani96/overlay-switch-underlay branch from 539fd5d to e01bf8c Compare January 28, 2026 16:50
@smagnani96
Copy link
Copy Markdown
Contributor Author

Had to force-push again to pick up Helm and Doc-related changes I forgot to push before 😞

Copy link
Copy Markdown
Member

@qmonnet qmonnet left a comment

Choose a reason for hiding this comment

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

Ack for doc change, thanks!

This commit introduces a new `underlayProtocol: "auto"` option in the
tunnel configuration, and this will be from this commit onwards the
default option unless specified otherwise.
With this option, the system will automatically detect and select the
appropriate underlay protocol (IPv4 or IPv6) based on the daemon config,
specifically the EnableIPv4 and EnableIPv6 settings. If both IPv4 and IPv6
are enabled, IPv4 will be preferred as we were already doing.

Prior to this, we were assuming IPv4 underlay unless explicitly specified otherwise,
also in case of tunneling disabled. However, that leads to MTU miscalculations
in pkg/mtu in case of IPv6-only clusters with tunneling disabled. The resulting
MTU computed would account for an IPv4 underlay overhead, while it should've
considered the IPv6 overhead. Simply prohibiting the user from specifying
a disabled underlay protocol (e.g., underlayProtocol: "ipv4" in an IPv6-only cluster)
was not the best option, given it would require all users to update their
Cilium config, including those running legit IPv6-only native clusters.

This commit fixes this behavior transparently to all users that were not
manually/explicitly setting the underlayProtocol option during installation.

This commit does not fix the case in which a disabled underlayProtocol is
specified (e.g., underlayProtocol: "ipv4" in an IPv6-only cluster). That will
be addressed in a follow-up commit.

This commit updates helm chart, agent default underlayProtocol, and
documentation accordingly.

Signed-off-by: Simone Magnani <simone.magnani@isovalent.com>
Prior to this commit, it was still possible to specify a disabled
underlayProtocol in the Cilium config. With this, we explicitly error out
and inform the user that they cannot provide a disabled underlayProtocol.
This makes the configuration more explicit and avoids confusion.

An example is in IPv6-only clusters with IPSec enabled and tunnel underlay
left to IPv4 (disabled by agent config). In this case, we would compute
pods routeMTU accounting for IPv4 tunnel overhead (50B) rather than IPv6
(70B), which is incorrect. That led to connectivity issues and fragmentation.

See #23917.

Signed-off-by: Simone Magnani <simone.magnani@isovalent.com>
@smagnani96 smagnani96 force-pushed the pr/smagnani96/overlay-switch-underlay branch from e01bf8c to 4191e42 Compare January 28, 2026 21:07
@joestringer joestringer enabled auto-merge January 28, 2026 22:01
@smagnani96
Copy link
Copy Markdown
Contributor Author

/test

@qmonnet qmonnet removed the request for review from thorn3r January 29, 2026 10:14
@joestringer joestringer added this pull request to the merge queue Jan 29, 2026
@maintainer-s-little-helper maintainer-s-little-helper bot added ready-to-merge This PR has passed all tests and received consensus from code owners to merge. labels Jan 29, 2026
Merged via the queue into main with commit 6e3657e Jan 29, 2026
564 of 571 checks passed
@joestringer joestringer deleted the pr/smagnani96/overlay-switch-underlay branch January 29, 2026 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/agent Cilium agent related. feature/ipv6-only Relates to single-stack IPv6 support. kind/enhancement This would improve or streamline existing functionality. ready-to-merge This PR has passed all tests and received consensus from code owners to merge. release-note/bug This PR fixes an issue in a previous release of Cilium.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants