Skip to content

Commit 297750b

Browse files
committed
fix after review
Signed-off-by: zbb88888 <jmdxjsjgcxy@gmail.com>
1 parent f015763 commit 297750b

File tree

5 files changed

+11
-17
lines changed

5 files changed

+11
-17
lines changed

pkg/controller/ippool.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ func (c *Controller) enqueueUpdateIPPool(oldObj, newObj any) {
5252
newIPPool := newObj.(*kubeovnv1.IPPool)
5353
if !newIPPool.DeletionTimestamp.IsZero() {
5454
klog.V(3).Infof("enqueue delete ippool %s due to deletion timestamp", cache.MetaObjectToName(newIPPool).String())
55-
c.deleteIPPoolQueue.Add(newIPPool.DeepCopy())
55+
c.deleteIPPoolQueue.Add(newIPPool)
5656
return
5757
}
5858
if !slices.Equal(oldIPPool.Spec.Namespaces, newIPPool.Spec.Namespaces) ||

pkg/controller/ovn_eip.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ func (c *Controller) enqueueDelOvnEip(obj any) {
7373

7474
key := cache.MetaObjectToName(eip).String()
7575
klog.Infof("enqueue del ovn eip %s", key)
76-
c.delOvnEipQueue.Add(eip.DeepCopy())
76+
c.delOvnEipQueue.Add(eip)
7777
}
7878

7979
func (c *Controller) handleAddOvnEip(key string) error {
@@ -410,8 +410,7 @@ func (c *Controller) createOrUpdateOvnEipCR(key, subnet, v4ip, v6ip, mac, usageT
410410
}
411411
}
412412
// Trigger subnet status update after CR creation or update
413-
time.Sleep(300 * time.Millisecond)
414-
c.updateSubnetStatusQueue.Add(subnet)
413+
c.updateSubnetStatusQueue.AddAfter(subnet, 300*time.Millisecond)
415414
return nil
416415
}
417416

@@ -603,8 +602,7 @@ func (c *Controller) handleDelOvnEipFinalizer(cachedEip *kubeovnv1.OvnEip) error
603602
// Trigger subnet status update after finalizer is removed
604603
// This ensures subnet status reflects the IP release
605604
// Add delay to ensure API server completes the finalizer removal
606-
time.Sleep(300 * time.Millisecond)
607-
c.updateSubnetStatusQueue.Add(cachedEip.Spec.ExternalSubnet)
605+
c.updateSubnetStatusQueue.AddAfter(cachedEip.Spec.ExternalSubnet, 300*time.Millisecond)
608606
return nil
609607
}
610608

pkg/controller/subnet.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func (c *Controller) enqueueDeleteSubnet(obj any) {
5353
}
5454

5555
klog.V(3).Infof("enqueue delete subnet %s", subnet.Name)
56-
c.deleteSubnetQueue.Add(subnet.DeepCopy())
56+
c.deleteSubnetQueue.Add(subnet)
5757
}
5858

5959
func readyToRemoveFinalizer(subnet *kubeovnv1.Subnet) bool {

pkg/controller/vip.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ func (c *Controller) enqueueDelVirtualIP(obj any) {
6464

6565
key := cache.MetaObjectToName(vip).String()
6666
klog.Infof("enqueue del vip %s", key)
67-
c.delVirtualIPQueue.Add(vip.DeepCopy())
67+
c.delVirtualIPQueue.Add(vip)
6868
}
6969

7070
func (c *Controller) handleAddVirtualIP(key string) error {
@@ -434,8 +434,7 @@ func (c *Controller) createOrUpdateVipCR(key, ns, subnet, v4ip, v6ip, mac string
434434
}
435435
}
436436
// Trigger subnet status update after CR creation or update
437-
time.Sleep(300 * time.Millisecond)
438-
c.updateSubnetStatusQueue.Add(subnet)
437+
c.updateSubnetStatusQueue.AddAfter(subnet, 300*time.Millisecond)
439438
return nil
440439
}
441440

@@ -582,8 +581,7 @@ func (c *Controller) handleDelVipFinalizer(key string) error {
582581
// Trigger subnet status update after finalizer is removed
583582
// This ensures subnet status reflects the IP release
584583
// Add delay to ensure API server completes the finalizer removal
585-
time.Sleep(300 * time.Millisecond)
586-
c.updateSubnetStatusQueue.Add(cachedVip.Spec.Subnet)
584+
c.updateSubnetStatusQueue.AddAfter(cachedVip.Spec.Subnet, 300*time.Millisecond)
587585
return nil
588586
}
589587

pkg/controller/vpc_nat_gw_eip.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ func (c *Controller) enqueueDelIptablesEip(obj any) {
5959

6060
key := cache.MetaObjectToName(eip).String()
6161
klog.Infof("enqueue del iptables eip %s", key)
62-
c.delIptablesEipQueue.Add(eip.DeepCopy())
62+
c.delIptablesEipQueue.Add(eip)
6363
}
6464

6565
func (c *Controller) handleAddIptablesEip(key string) error {
@@ -685,8 +685,7 @@ func (c *Controller) createOrUpdateEipCR(key, v4ip, v6ip, mac, natGwDp, qos, ext
685685
}
686686
}
687687
// Trigger subnet status update after all operations complete
688-
time.Sleep(300 * time.Millisecond)
689-
c.updateSubnetStatusQueue.Add(externalNet)
688+
c.updateSubnetStatusQueue.AddAfter(externalNet, 300*time.Millisecond)
690689
return nil
691690
}
692691

@@ -770,9 +769,8 @@ func (c *Controller) handleDelIptablesEipFinalizer(key string) error {
770769
// Trigger subnet status update after finalizer is removed
771770
// This ensures subnet status reflects the IP release
772771
// Add delay to ensure API server completes the finalizer removal
773-
time.Sleep(300 * time.Millisecond)
774772
externalNetwork := util.GetExternalNetwork(cachedIptablesEip.Spec.ExternalSubnet)
775-
c.updateSubnetStatusQueue.Add(externalNetwork)
773+
c.updateSubnetStatusQueue.AddAfter(externalNetwork, 300*time.Millisecond)
776774
return nil
777775
}
778776

0 commit comments

Comments
 (0)