diff --git a/pkg/registry/core/service/ipallocator/cidrallocator.go b/pkg/registry/core/service/ipallocator/cidrallocator.go index 0a86cd6ebf4..1d02e86f59e 100644 --- a/pkg/registry/core/service/ipallocator/cidrallocator.go +++ b/pkg/registry/core/service/ipallocator/cidrallocator.go @@ -131,9 +131,9 @@ func newMetaAllocator(client networkingv1alpha1client.NetworkingV1alpha1Interfac } _, _ = serviceCIDRInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{ - AddFunc: c.enqueServiceCIDR, + AddFunc: c.enqueueServiceCIDR, UpdateFunc: func(old, new interface{}) { - c.enqueServiceCIDR(new) + c.enqueueServiceCIDR(new) }, // Process the deletion directly in the handler to be able to use the object fields // without having to cache them. ServiceCIDRs are protected by finalizers @@ -144,7 +144,7 @@ func newMetaAllocator(client networkingv1alpha1client.NetworkingV1alpha1Interfac return c } -func (c *MetaAllocator) enqueServiceCIDR(obj interface{}) { +func (c *MetaAllocator) enqueueServiceCIDR(obj interface{}) { key, err := cache.MetaNamespaceKeyFunc(obj) if err == nil { c.queue.Add(key) diff --git a/pkg/registry/core/service/ipallocator/cidrallocator_test.go b/pkg/registry/core/service/ipallocator/cidrallocator_test.go index c82459a4d1e..c37c6cb5c98 100644 --- a/pkg/registry/core/service/ipallocator/cidrallocator_test.go +++ b/pkg/registry/core/service/ipallocator/cidrallocator_test.go @@ -116,7 +116,7 @@ func TestCIDRAllocateMultiple(t *testing.T) { if err != nil { t.Fatal(err) } - r.enqueServiceCIDR(cidr) + r.enqueueServiceCIDR(cidr) // wait for the cidr to be processed and set the informer synced err = wait.PollUntilContextTimeout(context.Background(), 100*time.Millisecond, 5*time.Second, true, func(ctx context.Context) (bool, error) { allocator, err := r.getAllocator(netutils.ParseIPSloppy("192.168.0.1"), true) @@ -155,7 +155,7 @@ func TestCIDRAllocateMultiple(t *testing.T) { if err != nil { t.Fatal(err) } - r.enqueServiceCIDR(cidr2) + r.enqueueServiceCIDR(cidr2) // wait for the cidr to be processed err = wait.PollUntilContextTimeout(context.Background(), 100*time.Millisecond, 5*time.Second, true, func(ctx context.Context) (bool, error) { allocator, err := r.getAllocator(netutils.ParseIPSloppy("10.0.0.11"), true) @@ -214,7 +214,7 @@ func TestCIDRAllocateShadow(t *testing.T) { if err != nil { t.Fatal(err) } - r.enqueServiceCIDR(cidr) + r.enqueueServiceCIDR(cidr) // wait for the cidr to be processed and set the informer synced err = wait.PollUntilContextTimeout(context.Background(), 100*time.Millisecond, 5*time.Second, true, func(ctx context.Context) (bool, error) { allocator, err := r.getAllocator(netutils.ParseIPSloppy("192.168.1.1"), true) @@ -242,7 +242,7 @@ func TestCIDRAllocateShadow(t *testing.T) { if err != nil { t.Fatal(err) } - r.enqueServiceCIDR(cidr2) + r.enqueueServiceCIDR(cidr2) // wait for the cidr to be processed err = wait.PollUntilContextTimeout(context.Background(), 100*time.Millisecond, 5*time.Second, true, func(ctx context.Context) (bool, error) { allocator, err := r.getAllocator(netutils.ParseIPSloppy("192.168.0.1"), true) @@ -287,7 +287,7 @@ func TestCIDRAllocateGrow(t *testing.T) { if err != nil { t.Fatal(err) } - r.enqueServiceCIDR(cidr) + r.enqueueServiceCIDR(cidr) // wait for the cidr to be processed err = wait.PollUntilContextTimeout(context.Background(), 100*time.Millisecond, 5*time.Second, true, func(ctx context.Context) (bool, error) { allocator, err := r.getAllocator(netutils.ParseIPSloppy("192.168.0.1"), true) @@ -325,7 +325,7 @@ func TestCIDRAllocateGrow(t *testing.T) { if err != nil { t.Fatal(err) } - r.enqueServiceCIDR(cidr2) + r.enqueueServiceCIDR(cidr2) // wait for the cidr to be processed err = wait.PollUntilContextTimeout(context.Background(), 100*time.Millisecond, 5*time.Second, true, func(ctx context.Context) (bool, error) { allocator, err := r.getAllocator(netutils.ParseIPSloppy("192.168.0.253"), true) @@ -379,7 +379,7 @@ func TestCIDRAllocateShrink(t *testing.T) { if err != nil { t.Fatal(err) } - r.enqueServiceCIDR(cidr) + r.enqueueServiceCIDR(cidr) // wait for the cidr to be processed err = wait.PollUntilContextTimeout(context.Background(), 100*time.Millisecond, 5*time.Second, true, func(ctx context.Context) (bool, error) { allocator, err := r.getAllocator(netutils.ParseIPSloppy("192.168.0.1"), true) @@ -425,7 +425,7 @@ func TestCIDRAllocateShrink(t *testing.T) { if err != nil { t.Fatal(err) } - r.enqueServiceCIDR(cidr2) + r.enqueueServiceCIDR(cidr2) err = r.client.ServiceCIDRs().Delete(context.Background(), cidr.Name, metav1.DeleteOptions{}) if err != nil { t.Fatal(err) @@ -493,7 +493,7 @@ func TestCIDRAllocateDualWrite(t *testing.T) { if err != nil { t.Fatal(err) } - r.enqueServiceCIDR(cidr) + r.enqueueServiceCIDR(cidr) // wait for the cidr to be processed and set the informer synced err = wait.PollUntilContextTimeout(context.Background(), 100*time.Millisecond, 5*time.Second, true, func(ctx context.Context) (bool, error) { allocator, err := r.getAllocator(netutils.ParseIPSloppy("192.168.0.1"), true) @@ -563,7 +563,7 @@ func TestCIDRAllocateDualWriteCollision(t *testing.T) { if err != nil { t.Fatal(err) } - r.enqueServiceCIDR(cidr) + r.enqueueServiceCIDR(cidr) // wait for the cidr to be processed and set the informer synced err = wait.PollUntilContextTimeout(context.Background(), 100*time.Millisecond, 5*time.Second, true, func(ctx context.Context) (bool, error) { allocator, err := r.getAllocator(netutils.ParseIPSloppy("192.168.0.1"), true)