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