Add netns lookup for missing IPv6 addresses for select plugins #27118
+297
−11
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.
Description
This is an attempted resolution for the issue reported in #27108 with missing IPv6 address entries for CNI plugins that don't specifically return the IPv6 address as part of the initial CNI result. In a macvlan+dhcp chain the DHCP plugin emits only the IPv4 lease. The IPv6 addresses inside the allocation’s namespace are being configured later by kernel SLAAC/DHCPv6 and never appear in res.Interfaces, so netStatus.AddressIPv6 is left empty. This breaks upstream service registration when using
address_mode = alloc_ipv6since the referenced fields are empty.For plugins where this issue is known(any relying on kernel addressing for IPv6), we briefly enter the network namespace to retrieve the network address instead of relying solely on the CNI result. There is likely a more elegant approach here, but this fix confirmed this was the issue I was running into with missing service registration addresses. This likely also applies to ipvlan, but I still need to validate. I opted to only perform the additional lookup when we determine that a known plugin is being used to avoid the lookup churn on most cases where bridge networking or standard IPv4 networking is being used and there isn't an IPv6 address to find, but curious if there is a more elegant approach here.
Testing & Reproduction steps
Links
Attemps to resolve #27108
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
backporting document.
in the majority of situations. The main exceptions are long-lived feature branches or merges where
history should be preserved.
within the public repository.
Changes to Security Controls
Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain.