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.
This commit is contained in:
Aaron U'Ren 2021-07-24 18:27:47 -05:00
parent cafd69dfaf
commit 35d334ca96
2 changed files with 8 additions and 0 deletions

View File

@ -655,6 +655,10 @@ func (nsc *NetworkServicesController) cleanupIpvsFirewall() {
} }
} }
// For some reason, if we go too fast into the ipset logic below it causes the system to think that the above
// iptables rules are still referencing the ipsets below, and we get errors
time.Sleep(1 * time.Second)
// Clear ipsets // Clear ipsets
// There are certain actions like Cleanup() actions that aren't working with full instantiations of the controller // There are certain actions like Cleanup() actions that aren't working with full instantiations of the controller
// and in these instances the mutex may not be present and may not need to be present as they are operating out of a // and in these instances the mutex may not be present and may not need to be present as they are operating out of a

View File

@ -691,6 +691,10 @@ func (nrc *NetworkRoutingController) Cleanup() {
klog.V(1).Infof("Error deleting Pod egress iptables rule: %s", err.Error()) klog.V(1).Infof("Error deleting Pod egress iptables rule: %s", err.Error())
} }
// For some reason, if we go too fast into the ipset logic below it causes the system to think that the above
// iptables rules are still referencing the ipsets below, and we get errors
time.Sleep(1 * time.Second)
// delete all ipsets created by kube-router // delete all ipsets created by kube-router
// There are certain actions like Cleanup() actions that aren't working with full instantiations of the controller // There are certain actions like Cleanup() actions that aren't working with full instantiations of the controller
// and in these instances the mutex may not be present and may not need to be present as they are operating out of a // and in these instances the mutex may not be present and may not need to be present as they are operating out of a