Unverified Commit c02f63d2 authored by Kubernetes Prow Robot's avatar Kubernetes Prow Robot Committed by GitHub

Merge pull request #74874 from nikopen/automated-cherry-pick-of-#70616-upstream-release-1.13

Automated cherry pick of #70616: flush iptable chains first and then remove them
parents 4ad5ca43 ee34e508
...@@ -566,7 +566,7 @@ func cleanupIptablesLeftovers(ipt utiliptables.Interface) (encounteredError bool ...@@ -566,7 +566,7 @@ func cleanupIptablesLeftovers(ipt utiliptables.Interface) (encounteredError bool
} }
} }
// Flush and remove all of our chains. // Flush and remove all of our chains. Flushing all chains before removing them also removes all links between chains first.
for _, ch := range iptablesChains { for _, ch := range iptablesChains {
if err := ipt.FlushChain(ch.table, ch.chain); err != nil { if err := ipt.FlushChain(ch.table, ch.chain); err != nil {
if !utiliptables.IsNotFoundError(err) { if !utiliptables.IsNotFoundError(err) {
...@@ -574,6 +574,10 @@ func cleanupIptablesLeftovers(ipt utiliptables.Interface) (encounteredError bool ...@@ -574,6 +574,10 @@ func cleanupIptablesLeftovers(ipt utiliptables.Interface) (encounteredError bool
encounteredError = true encounteredError = true
} }
} }
}
// Remove all of our chains.
for _, ch := range iptablesChains {
if err := ipt.DeleteChain(ch.table, ch.chain); err != nil { if err := ipt.DeleteChain(ch.table, ch.chain); err != nil {
if !utiliptables.IsNotFoundError(err) { if !utiliptables.IsNotFoundError(err) {
klog.Errorf("Error removing iptables rules in ipvs proxier: %v", err) klog.Errorf("Error removing iptables rules in ipvs proxier: %v", err)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment