Merge pull request #70616 from teemow/teemow-proxy-flush-iptables-first

flush iptable chains first and then remove them
This commit is contained in:
Kubernetes Prow Robot
2018-12-20 08:53:47 -08:00
committed by GitHub

View File

@@ -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 {
if err := ipt.FlushChain(ch.table, ch.chain); err != nil {
if !utiliptables.IsNotFoundError(err) {
@@ -574,6 +574,10 @@ func cleanupIptablesLeftovers(ipt utiliptables.Interface) (encounteredError bool
encounteredError = true
}
}
}
// Remove all of our chains.
for _, ch := range iptablesChains {
if err := ipt.DeleteChain(ch.table, ch.chain); err != nil {
if !utiliptables.IsNotFoundError(err) {
klog.Errorf("Error removing iptables rules in ipvs proxier: %v", err)