Backport of Fix IPv6-only CNI interface support into release/1.10.x #26941
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.
Backport
This PR is auto-generated from #26910 to be assessed for backporting due to the inclusion of the label backport/1.10.x.
The below text is copied from the body of the original PR.
Description
Fix a regression introduced in Nomad 1.9.0-beta.1 where CNI bridge networking with IPv6-only interfaces would fail with the error
failed to configure network: no interface with an address.The issue was that while the code correctly populated the
AddressIPv6field for IPv6 addresses, several validation checks only examined theAddressfield (IPv4), causing IPv6-only configurations to be incorrectly rejected. This affected users running IPv6-only infrastructure who were unable to upgrade from Nomad 1.8.x to 1.9.x.This PR updates the validation logic in four locations to check both IPv4 and IPv6 address fields:
cniToAllocNet()- now accepts interfaces with either IPv4 or IPv6 addressesAddressandAddressIPv6before falling backAllocNetworkStatus.IsZero()- includesAddressIPv6in the zero checkTesting & Reproduction steps
Reproduction (without fix):
network { mode = "bridge" }failed to configure network: no interface with an addressTesting:
TestCNI_cniToAllocNet_IPv6Onlythat verifies CNI results with only IPv6 addresses are handled correctlyTestCNI_cniToAllocNet_DualstacktestLinks
Fixes #26905
Related:
Contributor Checklist
changelog entry using the
make clcommand.ensure regressions will be caught.
and job configuration, please update the Nomad website documentation to reflect this. Refer to
the website README for docs guidelines. Please also consider whether the
change requires notes within the upgrade guide.
Reviewer Checklist
Changes to Security Controls
No changes to security controls. This is a bug fix that restores correct validation logic for network interface address checking.
Overview of commits