Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
56a717ef
Commit
56a717ef
authored
Jul 01, 2018
by
Hong Zhiguo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix missing protocol match in ipvs mode
parent
e49e3baa
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
35 deletions
+20
-35
proxier.go
pkg/proxy/ipvs/proxier.go
+20
-35
No files found.
pkg/proxy/ipvs/proxier.go
View file @
56a717ef
...
@@ -136,19 +136,22 @@ var ipsetInfo = []struct {
...
@@ -136,19 +136,22 @@ var ipsetInfo = []struct {
// example: iptables -t nat -A KUBE-SERVICES -m set --match-set KUBE-NODE-PORT-TCP dst -j KUBE-NODE-PORT
// example: iptables -t nat -A KUBE-SERVICES -m set --match-set KUBE-NODE-PORT-TCP dst -j KUBE-NODE-PORT
// ipsets with other match rules will be created Individually.
// ipsets with other match rules will be created Individually.
var
ipsetWithIptablesChain
=
[]
struct
{
var
ipsetWithIptablesChain
=
[]
struct
{
name
string
name
string
from
string
from
string
to
string
to
string
matchType
string
matchType
string
protocolMatch
string
}{
}{
{
kubeLoopBackIPSet
,
string
(
kubePostroutingChain
),
"MASQUERADE"
,
"dst,dst,src"
},
{
kubeLoopBackIPSet
,
string
(
kubePostroutingChain
),
"MASQUERADE"
,
"dst,dst,src"
,
""
},
{
kubeLoadBalancerSet
,
string
(
kubeServicesChain
),
string
(
KubeLoadBalancerChain
),
"dst,dst"
},
{
kubeLoadBalancerSet
,
string
(
kubeServicesChain
),
string
(
KubeLoadBalancerChain
),
"dst,dst"
,
""
},
{
kubeLoadbalancerFWSet
,
string
(
KubeLoadBalancerChain
),
string
(
KubeFireWallChain
),
"dst,dst"
},
{
kubeLoadbalancerFWSet
,
string
(
KubeLoadBalancerChain
),
string
(
KubeFireWallChain
),
"dst,dst"
,
""
},
{
kubeLoadBalancerSourceCIDRSet
,
string
(
KubeFireWallChain
),
"RETURN"
,
"dst,dst,src"
},
{
kubeLoadBalancerSourceCIDRSet
,
string
(
KubeFireWallChain
),
"RETURN"
,
"dst,dst,src"
,
""
},
{
kubeLoadBalancerSourceIPSet
,
string
(
KubeFireWallChain
),
"RETURN"
,
"dst,dst,src"
},
{
kubeLoadBalancerSourceIPSet
,
string
(
KubeFireWallChain
),
"RETURN"
,
"dst,dst,src"
,
""
},
{
kubeLoadBalancerLocalSet
,
string
(
KubeLoadBalancerChain
),
"RETURN"
,
"dst,dst"
},
{
kubeLoadBalancerLocalSet
,
string
(
KubeLoadBalancerChain
),
"RETURN"
,
"dst,dst"
,
""
},
{
kubeNodePortSetTCP
,
string
(
kubeServicesChain
),
string
(
KubeNodePortChain
),
"dst"
},
{
kubeNodePortSetTCP
,
string
(
kubeServicesChain
),
string
(
KubeNodePortChain
),
"dst"
,
"tcp"
},
{
kubeNodePortLocalSetTCP
,
string
(
KubeNodePortChain
),
"RETURN"
,
"dst"
},
{
kubeNodePortLocalSetTCP
,
string
(
KubeNodePortChain
),
"RETURN"
,
"dst"
,
"tcp"
},
{
kubeNodePortSetUDP
,
string
(
kubeServicesChain
),
string
(
KubeNodePortChain
),
"dst"
,
"udp"
},
{
kubeNodePortLocalSetUDP
,
string
(
KubeNodePortChain
),
"RETURN"
,
"dst"
,
"udp"
},
}
}
var
ipvsModules
=
[]
string
{
var
ipvsModules
=
[]
string
{
...
@@ -1204,8 +1207,11 @@ func (proxier *Proxier) writeIptablesRules() {
...
@@ -1204,8 +1207,11 @@ func (proxier *Proxier) writeIptablesRules() {
for
_
,
set
:=
range
ipsetWithIptablesChain
{
for
_
,
set
:=
range
ipsetWithIptablesChain
{
if
_
,
find
:=
proxier
.
ipsetList
[
set
.
name
];
find
&&
!
proxier
.
ipsetList
[
set
.
name
]
.
isEmpty
()
{
if
_
,
find
:=
proxier
.
ipsetList
[
set
.
name
];
find
&&
!
proxier
.
ipsetList
[
set
.
name
]
.
isEmpty
()
{
args
=
append
(
args
[
:
0
],
args
=
append
(
args
[
:
0
],
"-A"
,
set
.
from
)
"-A"
,
set
.
from
,
if
set
.
protocolMatch
!=
""
{
args
=
append
(
args
,
"-p"
,
set
.
protocolMatch
)
}
args
=
append
(
args
,
"-m"
,
"comment"
,
"--comment"
,
proxier
.
ipsetList
[
set
.
name
]
.
getComment
(),
"-m"
,
"comment"
,
"--comment"
,
proxier
.
ipsetList
[
set
.
name
]
.
getComment
(),
"-m"
,
"set"
,
"--match-set"
,
set
.
name
,
"-m"
,
"set"
,
"--match-set"
,
set
.
name
,
set
.
matchType
,
set
.
matchType
,
...
@@ -1264,27 +1270,6 @@ func (proxier *Proxier) writeIptablesRules() {
...
@@ -1264,27 +1270,6 @@ func (proxier *Proxier) writeIptablesRules() {
writeLine
(
proxier
.
natRules
,
append
(
dstLocalOnlyArgs
,
"-j"
,
"ACCEPT"
)
...
)
writeLine
(
proxier
.
natRules
,
append
(
dstLocalOnlyArgs
,
"-j"
,
"ACCEPT"
)
...
)
}
}
if
!
proxier
.
ipsetList
[
kubeNodePortSetUDP
]
.
isEmpty
()
{
// accept for nodeports w/ externaltrafficpolicy=local
args
=
append
(
args
[
:
0
],
"-A"
,
string
(
kubeServicesChain
),
"-m"
,
"udp"
,
"-p"
,
"udp"
,
"-m"
,
"comment"
,
"--comment"
,
proxier
.
ipsetList
[
kubeNodePortSetUDP
]
.
getComment
(),
"-m"
,
"set"
,
"--match-set"
,
kubeNodePortSetUDP
,
"dst"
,
)
writeLine
(
proxier
.
natRules
,
append
(
args
,
"-j"
,
string
(
KubeNodePortChain
))
...
)
if
!
proxier
.
ipsetList
[
kubeNodePortLocalSetUDP
]
.
isEmpty
()
{
args
=
append
(
args
[
:
0
],
"-A"
,
string
(
KubeNodePortChain
),
"-m"
,
"comment"
,
"--comment"
,
proxier
.
ipsetList
[
kubeNodePortLocalSetUDP
]
.
getComment
(),
"-m"
,
"set"
,
"--match-set"
,
kubeNodePortLocalSetUDP
,
"dst"
,
)
writeLine
(
proxier
.
natRules
,
append
(
args
,
"-j"
,
"ACCEPT"
)
...
)
}
}
// mark masq for KUBE-NODE-PORT
// mark masq for KUBE-NODE-PORT
writeLine
(
proxier
.
natRules
,
[]
string
{
writeLine
(
proxier
.
natRules
,
[]
string
{
"-A"
,
string
(
KubeNodePortChain
),
"-A"
,
string
(
KubeNodePortChain
),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment