Skip to content

Conversation

@twz123
Copy link
Member

@twz123 twz123 commented May 13, 2025

Description

The networking would be borked in that case, and diagnosing might be hard. Better to be vocal about it, and pointing users to the root cause more quickly.

See:

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

How Has This Been Tested?

  • Manual test
  • Auto test added

Checklist

  • My code follows the style guidelines of this project
  • My commit messages are signed-off
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have checked my code and corrected any misspellings

@twz123 twz123 force-pushed the dual-stack-node-ip-hard-failure branch from e90efa4 to 0468fed Compare May 13, 2025 12:04
@twz123 twz123 marked this pull request as ready for review May 13, 2025 20:31
@twz123 twz123 requested review from a team as code owners May 13, 2025 20:31
@twz123 twz123 requested review from jnummelin and ncopa May 13, 2025 20:31
@ncopa
Copy link
Collaborator

ncopa commented May 14, 2025

I think the lookupNodeName better describes how the IPs are detected. So I think this is more readable:

diff --git a/pkg/component/worker/kubelet.go b/pkg/component/worker/kubelet.go
index 2287c43d5..666db7025 100644
--- a/pkg/component/worker/kubelet.go
+++ b/pkg/component/worker/kubelet.go
@@ -156,6 +156,8 @@ func (k *Kubelet) Start(ctx context.Context) error {
                        // addresses in the private function k8s.io/kubernetes/pkg/kubelet.validateNodeIP
                        // which won't be replicated here.
                        args["--node-ip"] = ipv4.String() + "," + ipv6.String()
+               } else {
+                       return fmt.Errorf("node name IP address lookup didn't return addresses for both families: IPv4: %v, IPv6: %v", ipv4, ipv6)
                }
        }
 

alternatively:

diff --git a/pkg/component/worker/kubelet.go b/pkg/component/worker/kubelet.go
index 2287c43d5..9c934557e 100644
--- a/pkg/component/worker/kubelet.go
+++ b/pkg/component/worker/kubelet.go
@@ -151,7 +151,10 @@ func (k *Kubelet) Start(ctx context.Context) error {
                ipv4, ipv6, err := lookupNodeName(ctx, k.NodeName)
                if err != nil {
                        logrus.WithError(err).Errorf("failed to lookup %q", k.NodeName)
-               } else if ipv4 != nil && ipv6 != nil {
+               } else if ipv4 == nil || ipv6 == nil {
+                       return fmt.Errorf("node name IP address lookup didn't return addresses for both families: IPv4: %v, IPv6: %v", ipv4, ipv6)
+
+               } else {
                        // The kubelet will perform some extra validations on the discovered IP
                        // addresses in the private function k8s.io/kubernetes/pkg/kubelet.validateNodeIP
                        // which won't be replicated here.

But that's just my humble opinion.

@github-actions
Copy link
Contributor

This pull request has merge conflicts that need to be resolved.

@twz123 twz123 marked this pull request as draft May 23, 2025 08:20
@juanluisvaladas juanluisvaladas mentioned this pull request May 23, 2025
17 tasks
@github-actions
Copy link
Contributor

The PR is marked as stale since no activity has been recorded in 30 days

@github-actions github-actions bot added Stale and removed Stale labels Jun 22, 2025
@github-actions
Copy link
Contributor

The PR is marked as stale since no activity has been recorded in 30 days

@github-actions github-actions bot added Stale and removed Stale labels Jul 23, 2025
@github-actions
Copy link
Contributor

The PR is marked as stale since no activity has been recorded in 30 days

@github-actions github-actions bot added Stale and removed Stale labels Aug 24, 2025
@github-actions
Copy link
Contributor

The PR is marked as stale since no activity has been recorded in 30 days

@github-actions github-actions bot added Stale and removed Stale labels Sep 25, 2025
@twz123 twz123 added this to the 1.35 milestone Oct 8, 2025
@twz123 twz123 force-pushed the dual-stack-node-ip-hard-failure branch from 4a77bbf to 98dc784 Compare November 15, 2025 12:05
@twz123 twz123 force-pushed the dual-stack-node-ip-hard-failure branch from 98dc784 to 26845e0 Compare November 15, 2025 12:44
@twz123 twz123 marked this pull request as ready for review November 16, 2025 12:47
@github-actions
Copy link
Contributor

This pull request has merge conflicts that need to be resolved.

The networking would be borked in that case, and diagnosing might be
hard. Better to be vocal about it, and pointing users to the root cause
more quickly.

Signed-off-by: Tom Wieczorek <[email protected]>
@twz123 twz123 force-pushed the dual-stack-node-ip-hard-failure branch from 26845e0 to efac0a7 Compare November 24, 2025 10:26
@twz123 twz123 merged commit 1ae74aa into k0sproject:main Dec 4, 2025
199 of 201 checks passed
@twz123 twz123 deleted the dual-stack-node-ip-hard-failure branch December 4, 2025 14:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants