@@ -311,31 +311,17 @@ func (ca *cloudCIDRAllocator) updateCIDRAllocation(nodeName string) error {
311
311
312
312
cidrStrings := make ([]string , 0 )
313
313
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 ) {
321
315
nodeutil .RecordNodeStatusChange (ca .recorder , node , "CIDRNotAvailable" )
322
316
return fmt .Errorf ("failed to allocate cidr: Node %v has no ranges from which CIDRs can be allocated" , node .Name )
323
317
}
324
318
325
319
// sets the v1.NodeNetworkUnavailable condition to False
326
320
ca .setNetworkCondition (node )
327
321
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 )
339
325
ipv6Addr := ca .cloud .GetIPV6Address (instance .NetworkInterfaces [0 ])
340
326
if ipv6Addr != nil {
341
327
cidrStrings = append (cidrStrings , ipv6Addr .String ())
0 commit comments