@@ -2,6 +2,7 @@ package node_controller
22
33import (
44 "context"
5+ nativeerrors "errors"
56 "fmt"
67 "sort"
78 "time"
@@ -271,6 +272,10 @@ func (c *Controller) processNextWorkItem(ctx context.Context) bool {
271272 // Foo resource to be synced.
272273 if err := c .syncHandler (ctx , key ); err != nil {
273274 // Put the item back on the workqueue to handle any transient errors.
275+ if nativeerrors .Is (err , types .ErrNoIPRanges ) {
276+ logger .Info (fmt .Sprintf ("Ignoring net-attach-def with no IP ranges '%s': %s" , key , err .Error ()))
277+ return nil // Don't requeue
278+ }
274279 c .workqueue .AddRateLimited (key )
275280 return fmt .Errorf ("error syncing '%s': %s, requeuing" , key , err .Error ())
276281 }
@@ -505,6 +510,11 @@ func (c *Controller) checkForMultiNadMismatch(name, namespace string) error {
505510 return err
506511 }
507512
513+ // We need a valid IPAM configuration for comparison.
514+ if len (ipamConf .IPRanges ) == 0 {
515+ return fmt .Errorf ("%w: %s/%s" , types .ErrNoIPRanges , namespace , name )
516+ }
517+
508518 nadList , err := c .nadLister .List (labels .Everything ())
509519 if err != nil {
510520 return err
@@ -514,6 +524,11 @@ func (c *Controller) checkForMultiNadMismatch(name, namespace string) error {
514524 if err != nil {
515525 return err
516526 }
527+
528+ if len (additionalIpamConf .IPRanges ) == 0 {
529+ continue // skip this net-attach-def, it has no ranges
530+ }
531+
517532 if ! checkIpamConfMatch (ipamConf , additionalIpamConf ) {
518533 return fmt .Errorf ("found IPAM conf mismatch for network-attachment-definitions with same network name" )
519534 }
0 commit comments