Skip to content

Comments

fix: Adding ipv6 check on the node init function#10

Open
MitchLewis930 wants to merge 1 commit intopr_050_beforefrom
pr_050_after
Open

fix: Adding ipv6 check on the node init function#10
MitchLewis930 wants to merge 1 commit intopr_050_beforefrom
pr_050_after

Conversation

@MitchLewis930
Copy link

PR_050

Cilium pods on a single stack cluster were failing when ipv6 was enabled.
The change would make sure that if the underlying node does not have ipv6
configuration enabled it would fail even if KPR is disabled.Earlier, if KPR
is enabled, the node would not see a fatal error.

Signed-off-by: Vipul Singh <singhvipul@microsoft.com>
@MitchLewis930 MitchLewis930 requested a review from Copilot January 31, 2026 01:15
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds validation to ensure that nodes have IPv6 addresses configured when IPv6 is enabled in the cluster configuration.

Changes:

  • Adds an early validation check for IPv6 address presence when IPv6 is enabled
  • Returns an error with detailed logging if a node lacks an IPv6 address despite IPv6 being enabled

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +131 to +138
// 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)
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.
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants