siderolabs / talos

Talos Linux is a modern Linux distribution built for Kubernetes.
https://www.talos.dev
Mozilla Public License 2.0
6.89k stars 555 forks source link

feat: prefer longer prefixes in IPv6 only environments as default Nod… #9749

Open trevex opened 3 days ago

trevex commented 3 days ago

Pull Request

What? (description)

Prefers longer prefixes in IPv6 only environments as default address, but keeps current behaviour everywhere else.

Why? (reasoning)

Talos IP preference strategy does not well in IPv6 Single-Stack environments as RA SLAAC addresses will be preferred over DHCPv6. In environments such as KubeVirt with Passt the SLAAC address is not routable by other Pods. If a DHCPv6 address is available it should be preferred.

The current filtering methods do not work as SLAAC and DHCPv6 address can be from the same prefix or in the case of KubeVirt a non-predictable pod IP.

This change only changes the preference in IPv6 only environments by adapting the default NodeAddress accordingly. In the future it might be desirable to do a larger rewrite or even introduce CEL or expr to let the user define filtering and expression functions. As this is my first PR to Talos I kept the changes as minimal as possible.

Fixes https://github.com/siderolabs/talos/issues/9725.

Acceptance

Please use the following checklist:

See make help for a description of the available targets.

Unfortunately make fmt changed lots of *.proto files, so I did not include the changes. make unit-tests did not run (might be a NixOS issue), but running relevant tests with go test passed. make docs did not include relevant updates to the documentation.

trevex commented 3 days ago

This is my first PR for Talos and I am not overly familiar with the codebase, but my assumption is changing the default NodeAddress should fix #9725.