Skip to content

Commit 35d334c

Browse files
committed
fix: add sleeps between iptables and ipset cleanup
I found that without taking a brief pause between iptables cleanup and ipset deletion, sometimes the system still thought that there were iptables references to the ipsets and would error instead of cleaning the ipsets.
1 parent cafd69d commit 35d334c

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

pkg/controllers/proxy/network_services_controller.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -655,6 +655,10 @@ func (nsc *NetworkServicesController) cleanupIpvsFirewall() {
655655
}
656656
}
657657

658+
// For some reason, if we go too fast into the ipset logic below it causes the system to think that the above
659+
// iptables rules are still referencing the ipsets below, and we get errors
660+
time.Sleep(1 * time.Second)
661+
658662
// Clear ipsets
659663
// There are certain actions like Cleanup() actions that aren't working with full instantiations of the controller
660664
// and in these instances the mutex may not be present and may not need to be present as they are operating out of a

pkg/controllers/routing/network_routes_controller.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -691,6 +691,10 @@ func (nrc *NetworkRoutingController) Cleanup() {
691691
klog.V(1).Infof("Error deleting Pod egress iptables rule: %s", err.Error())
692692
}
693693

694+
// For some reason, if we go too fast into the ipset logic below it causes the system to think that the above
695+
// iptables rules are still referencing the ipsets below, and we get errors
696+
time.Sleep(1 * time.Second)
697+
694698
// delete all ipsets created by kube-router
695699
// There are certain actions like Cleanup() actions that aren't working with full instantiations of the controller
696700
// and in these instances the mutex may not be present and may not need to be present as they are operating out of a

0 commit comments

Comments
 (0)