Skip to content

Commit 0fe403b

Browse files
committed
Revert "cloudAllocator ipv6 only ipam"
This reverts commit ce1a81a.
1 parent 3268674 commit 0fe403b

File tree

2 files changed

+4
-57
lines changed

2 files changed

+4
-57
lines changed

pkg/controller/nodeipam/ipam/cloud_cidr_allocator.go

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -311,31 +311,17 @@ func (ca *cloudCIDRAllocator) updateCIDRAllocation(nodeName string) error {
311311

312312
cidrStrings := make([]string, 0)
313313

314-
// if there are no interfaces or there is 1 interface
315-
// but does not have IP alias or IPv6 ranges no CIDR
316-
// can be allocated
317-
if len(instance.NetworkInterfaces) == 0 ||
318-
(len(instance.NetworkInterfaces) == 1 &&
319-
len(instance.NetworkInterfaces[0].AliasIpRanges) == 0 &&
320-
ca.cloud.GetIPV6Address(instance.NetworkInterfaces[0]) == nil) {
314+
if len(instance.NetworkInterfaces) == 0 || (len(instance.NetworkInterfaces) == 1 && len(instance.NetworkInterfaces[0].AliasIpRanges) == 0) {
321315
nodeutil.RecordNodeStatusChange(ca.recorder, node, "CIDRNotAvailable")
322316
return fmt.Errorf("failed to allocate cidr: Node %v has no ranges from which CIDRs can be allocated", node.Name)
323317
}
324318

325319
// sets the v1.NodeNetworkUnavailable condition to False
326320
ca.setNetworkCondition(node)
327321

328-
// nodes in clusters WITHOUT multi-networking are expected to have
329-
// only 1 network-interface and 1 alias IPv4 range or/and 1 IPv6 address
330-
// multi-network cluster may have 1 interface with multiple alias
331-
if len(instance.NetworkInterfaces) == 1 &&
332-
(len(instance.NetworkInterfaces[0].AliasIpRanges) == 1 ||
333-
ca.cloud.GetIPV6Address(instance.NetworkInterfaces[0]) != nil) {
334-
// with 1 alias IPv4 range on single IPv4 or dual stack clusters
335-
if len(instance.NetworkInterfaces[0].AliasIpRanges) == 1 {
336-
cidrStrings = append(cidrStrings, instance.NetworkInterfaces[0].AliasIpRanges[0].IpCidrRange)
337-
}
338-
// with 1 IPv6 range on single IPv6 or dual stack cluster
322+
// nodes in clusters WITHOUT multi-networking are expected to have only 1 network-interface with 1 alias IP range.
323+
if len(instance.NetworkInterfaces) == 1 && len(instance.NetworkInterfaces[0].AliasIpRanges) == 1 {
324+
cidrStrings = append(cidrStrings, instance.NetworkInterfaces[0].AliasIpRanges[0].IpCidrRange)
339325
ipv6Addr := ca.cloud.GetIPV6Address(instance.NetworkInterfaces[0])
340326
if ipv6Addr != nil {
341327
cidrStrings = append(cidrStrings, ipv6Addr.String())

pkg/controller/nodeipam/ipam/cloud_cidr_allocator_test.go

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -282,45 +282,6 @@ func TestUpdateCIDRAllocation(t *testing.T) {
282282
},
283283
expectedUpdate: true,
284284
},
285-
{
286-
name: "ipv6 single stack",
287-
fakeNodeHandler: &testutil.FakeNodeHandler{
288-
Existing: []*v1.Node{
289-
{
290-
ObjectMeta: metav1.ObjectMeta{
291-
Name: "test",
292-
},
293-
Spec: v1.NodeSpec{
294-
ProviderID: "gce://test-project/us-central1-b/test",
295-
},
296-
},
297-
},
298-
Clientset: fake.NewSimpleClientset(),
299-
},
300-
gceInstance: []*compute.Instance{
301-
{
302-
Name: "test",
303-
NetworkInterfaces: []*compute.NetworkInterface{
304-
{
305-
Ipv6Address: "2001:db9::110",
306-
},
307-
},
308-
},
309-
},
310-
nodeChanges: func(node *v1.Node) {
311-
node.Spec.PodCIDR = "2001:db9::/112"
312-
node.Spec.PodCIDRs = []string{"2001:db9::/112"}
313-
node.Status.Conditions = []v1.NodeCondition{
314-
{
315-
Type: "NetworkUnavailable",
316-
Status: "False",
317-
Reason: "RouteCreated",
318-
Message: "NodeController create implicit route",
319-
},
320-
}
321-
},
322-
expectedUpdate: true,
323-
},
324285
{
325286
name: "want error - incorrect cidr",
326287
fakeNodeHandler: &testutil.FakeNodeHandler{

0 commit comments

Comments
 (0)