kube-proxy: rename internal field for clarity

This commit is contained in:
Tim Hockin 2019-01-03 10:23:20 -08:00
parent bfa5876311
commit b3c2888e71

View File

@ -359,7 +359,7 @@ func NewProxier(ipt utiliptables.Interface,
type iptablesJumpChain struct { type iptablesJumpChain struct {
table utiliptables.Table table utiliptables.Table
chain utiliptables.Chain dstChain utiliptables.Chain
sourceChain utiliptables.Chain sourceChain utiliptables.Chain
comment string comment string
extraArgs []string extraArgs []string
@ -388,7 +388,7 @@ func CleanupLeftovers(ipt utiliptables.Interface) (encounteredError bool) {
for _, chain := range append(iptablesJumpChains, iptablesCleanupOnlyChains...) { for _, chain := range append(iptablesJumpChains, iptablesCleanupOnlyChains...) {
args := append(chain.extraArgs, args := append(chain.extraArgs,
"-m", "comment", "--comment", chain.comment, "-m", "comment", "--comment", chain.comment,
"-j", string(chain.chain), "-j", string(chain.dstChain),
) )
if err := ipt.DeleteRule(chain.table, chain.sourceChain, args...); err != nil { if err := ipt.DeleteRule(chain.table, chain.sourceChain, args...); err != nil {
if !utiliptables.IsNotFoundError(err) { if !utiliptables.IsNotFoundError(err) {
@ -671,16 +671,16 @@ func (proxier *Proxier) syncProxyRules() {
// Create and link the kube chains. // Create and link the kube chains.
for _, chain := range iptablesJumpChains { for _, chain := range iptablesJumpChains {
if _, err := proxier.iptables.EnsureChain(chain.table, chain.chain); err != nil { 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) klog.Errorf("Failed to ensure that %s chain %s exists: %v", chain.table, kubeServicesChain, err)
return return
} }
args := append(chain.extraArgs, args := append(chain.extraArgs,
"-m", "comment", "--comment", chain.comment, "-m", "comment", "--comment", chain.comment,
"-j", string(chain.chain), "-j", string(chain.dstChain),
) )
if _, err := proxier.iptables.EnsureRule(utiliptables.Prepend, chain.table, chain.sourceChain, args...); err != nil { 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.chain, err) klog.Errorf("Failed to ensure that %s chain %s jumps to %s: %v", chain.table, chain.sourceChain, chain.dstChain, err)
return return
} }
} }