Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions daemon/k8s/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,16 @@ func WaitForNodeInformation(ctx context.Context, log logrus.FieldLogger, localNo
logfields.K8sNodeIP: k8sNodeIP,
}).Info("Received own node information from API server")

// If the host does not have an IPv6 address, return an error
if option.Config.EnableIPv6 && nodeIP6 == nil {
log.WithFields(logrus.Fields{
logfields.NodeName: n.Name,
logfields.IPAddr + ".ipv4": nodeIP4,
logfields.IPAddr + ".ipv6": nodeIP6,
}).Error("No IPv6 support on node as ipv6 address is nil")
Copy link

Copilot AI Jan 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error message 'No IPv6 support on node as ipv6 address is nil' is technically inaccurate. The node may support IPv6, but simply doesn't have an IPv6 address configured. Consider changing to 'IPv6 is enabled but node does not have an IPv6 address configured' for clarity.

Copilot uses AI. Check for mistakes.
return fmt.Errorf("node %s does not have an IPv6 address", n.Name)
Comment on lines +131 to +138
Copy link

Copilot AI Jan 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The IPv6 validation occurs after logging 'Received own node information from API server' (line 129), but before calling useNodeCIDR(n) (line 141). However, useNodeCIDR already handles the case where IPv6 is enabled but the IPv6 CIDR is nil by checking n.IPv6AllocCIDR != nil. This early error return prevents legitimate scenarios where a node might not have an IPv6 address assigned yet but could receive one later. Consider whether this strict validation is necessary or if the existing nil checks in useNodeCIDR are sufficient.

Suggested change
// If the host does not have an IPv6 address, return an error
if option.Config.EnableIPv6 && nodeIP6 == nil {
log.WithFields(logrus.Fields{
logfields.NodeName: n.Name,
logfields.IPAddr + ".ipv4": nodeIP4,
logfields.IPAddr + ".ipv6": nodeIP6,
}).Error("No IPv6 support on node as ipv6 address is nil")
return fmt.Errorf("node %s does not have an IPv6 address", n.Name)
// If the host does not have an IPv6 address, log a warning but continue;
// useNodeCIDR() will enforce any required IPv6 PodCIDR constraints.
if option.Config.EnableIPv6 && nodeIP6 == nil {
log.WithFields(logrus.Fields{
logfields.NodeName: n.Name,
logfields.IPAddr + ".ipv4": nodeIP4,
logfields.IPAddr + ".ipv6": nodeIP6,
}).Warning("IPv6 is enabled but node IPv6 address is currently nil; proceeding and relying on CIDR-based checks")

Copilot uses AI. Check for mistakes.
}

useNodeCIDR(n)
} else {
// if node resource could not be received, fail if
Expand Down