nomad icon indicating copy to clipboard operation
nomad copied to clipboard

feat(#23388): Add a preferred address family option for network-interface

Open guifran001 opened this issue 1 year ago • 3 comments

As some services might not support IPv6, nomad needs a way to expose service on IPv4 instead of IPv6

see #23388 for more details

This pr adds a ignore-ipv6 option to nomad to ignore IPv6 addresses.

If preferred, I could change to code to add a -preferred-ip-family instead.

guifran001 avatar Jun 19 '24 20:06 guifran001

CLA assistant check
All committers have signed the CLA.

hashicorp-cla-app[bot] avatar Jun 19 '24 20:06 hashicorp-cla-app[bot]

Hi @guifran001, thank you for the PR! We have a near-term priority on evaluating and improving IPv6 in Nomad, so your contribution is timely. :)

If preferred, I could change to code to add a -preferred-ip-family instead.

I do think this is preferable, because some users/environments may actually want to use IPv6, which in some cases is hard to accomplish at the moment.

I'd suggest validating that the user input is one of these two constants: https://github.com/hashicorp/nomad/blob/v1.8.1/nomad/structs/structs.go#L2728-L2729 to be able to error early on bad input before the client agent gets up and running. It looks like you have already found the constant(s), since you check for one here. If the value is an empty string, we should default to the current behavior. Aside from that, I think most of your approach would only need minor tweaking.

Let me know how it goes, and if you'd like any assistance with it!

gulducat avatar Jun 21 '24 17:06 gulducat

Hi @gulducat, Happy to know that my timing is good.

I have refactor to add a preferred-address-family instead of the ignore-ipv6 option and validated the entry with the constants you mentioned.

I have sorted both NetworkResource and NodeNetworkResource, is that OK or it should only apply to NodeNetworkResource ?

Tell me if it makes sense or if you want me to refactor / improve my code.

guifran001 avatar Jun 21 '24 20:06 guifran001

This looks great @guifran001! Just one more bit of bookkeeping that I forgot to mention:

In the repo root, run make cl to create a changelog file, an improvement with a Note like

client: add a preferred_address_family config to prefer ipv4 or ipv6 for service discovery

(or something like that)

Then I'll merge this in, so it can go out with the 1.8.2 release soon!

gulducat avatar Jul 12 '24 14:07 gulducat

I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions. If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

github-actions[bot] avatar Dec 28 '24 02:12 github-actions[bot]