mirror of https://github.com/k3s-io/k3s
Merge pull request #70616 from teemow/teemow-proxy-flush-iptables-first
flush iptable chains first and then remove thempull/564/head
commit
ae88c2d7b4
|
@ -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
|
||||||
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)
|
||||||
|
|
Loading…
Reference in New Issue