mirror of https://github.com/k3s-io/k3s
kube-proxy: rename vars for clarity, fix err str
parent
b3c2888e71
commit
2106447d21
|
@ -385,12 +385,12 @@ var iptablesCleanupOnlyChains = []iptablesJumpChain{
|
|||
// It returns true if an error was encountered. Errors are logged.
|
||||
func CleanupLeftovers(ipt utiliptables.Interface) (encounteredError bool) {
|
||||
// Unlink our chains
|
||||
for _, chain := range append(iptablesJumpChains, iptablesCleanupOnlyChains...) {
|
||||
args := append(chain.extraArgs,
|
||||
"-m", "comment", "--comment", chain.comment,
|
||||
"-j", string(chain.dstChain),
|
||||
for _, jump := range append(iptablesJumpChains, iptablesCleanupOnlyChains...) {
|
||||
args := append(jump.extraArgs,
|
||||
"-m", "comment", "--comment", jump.comment,
|
||||
"-j", string(jump.dstChain),
|
||||
)
|
||||
if err := ipt.DeleteRule(chain.table, chain.sourceChain, args...); err != nil {
|
||||
if err := ipt.DeleteRule(jump.table, jump.sourceChain, args...); err != nil {
|
||||
if !utiliptables.IsNotFoundError(err) {
|
||||
klog.Errorf("Error removing pure-iptables proxy rule: %v", err)
|
||||
encounteredError = true
|
||||
|
@ -670,17 +670,17 @@ func (proxier *Proxier) syncProxyRules() {
|
|||
klog.V(3).Info("Syncing iptables rules")
|
||||
|
||||
// Create and link the kube chains.
|
||||
for _, chain := range iptablesJumpChains {
|
||||
if _, err := proxier.iptables.EnsureChain(chain.table, chain.dstChain); err != nil {
|
||||
klog.Errorf("Failed to ensure that %s chain %s exists: %v", chain.table, kubeServicesChain, err)
|
||||
for _, jump := range iptablesJumpChains {
|
||||
if _, err := proxier.iptables.EnsureChain(jump.table, jump.dstChain); err != nil {
|
||||
klog.Errorf("Failed to ensure that %s chain %s exists: %v", jump.table, jump.dstChain, err)
|
||||
return
|
||||
}
|
||||
args := append(chain.extraArgs,
|
||||
"-m", "comment", "--comment", chain.comment,
|
||||
"-j", string(chain.dstChain),
|
||||
args := append(jump.extraArgs,
|
||||
"-m", "comment", "--comment", jump.comment,
|
||||
"-j", string(jump.dstChain),
|
||||
)
|
||||
if _, err := proxier.iptables.EnsureRule(utiliptables.Prepend, chain.table, chain.sourceChain, args...); err != nil {
|
||||
klog.Errorf("Failed to ensure that %s chain %s jumps to %s: %v", chain.table, chain.sourceChain, chain.dstChain, err)
|
||||
if _, err := proxier.iptables.EnsureRule(utiliptables.Prepend, jump.table, jump.sourceChain, args...); err != nil {
|
||||
klog.Errorf("Failed to ensure that %s chain %s jumps to %s: %v", jump.table, jump.sourceChain, jump.dstChain, err)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue