Skip to content

Commit

Permalink
Merge pull request #1890 from rbrtbnfgl/podcidrcheck
Browse files Browse the repository at this point in the history
Added additional check for n.spec.podCIDRs
  • Loading branch information
thomasferrandiz authored Mar 1, 2024
2 parents bbe829e + 6794631 commit ee53746
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/subnet/kube/kube.go
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,9 @@ func (ksm *kubeSubnetManager) nodeToLease(n v1.Node) (l lease.Lease, err error)
default:
return l, fmt.Errorf("node %q pod cidrs should be IPv4/IPv6 only or dualstack", ksm.nodeName)
}
if cidr == nil {
return l, fmt.Errorf("Missing IPv4 address on n.Spec.PodCIDRs")
}
l.Subnet = ip.FromIPNet(cidr)
l.EnableIPv4 = ksm.enableIPv4
}
Expand Down Expand Up @@ -526,6 +529,9 @@ func (ksm *kubeSubnetManager) nodeToLease(n v1.Node) (l lease.Lease, err error)
default:
return l, fmt.Errorf("node %q pod cidrs should be IPv4/IPv6 only or dualstack", ksm.nodeName)
}
if ipv6Cidr == nil {
return l, fmt.Errorf("Missing IPv6 address on n.Spec.PodCIDRs")
}
l.IPv6Subnet = ip.FromIP6Net(ipv6Cidr)
l.EnableIPv6 = ksm.enableIPv6
}
Expand Down

0 comments on commit ee53746

Please sign in to comment.