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
e90de22a
Commit
e90de22a
authored
Apr 17, 2018
by
Lion-Wei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix ipvs fw
parent
28a19562
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
11 deletions
+26
-11
ipset.go
pkg/proxy/ipvs/ipset.go
+5
-2
proxier.go
pkg/proxy/ipvs/proxier.go
+0
-0
proxier_test.go
pkg/proxy/ipvs/proxier_test.go
+21
-9
No files found.
pkg/proxy/ipvs/ipset.go
View file @
e90de22a
...
...
@@ -40,8 +40,11 @@ const (
// KubeLoadBalancerSet is used to store service load balancer ingress ip + port, it is the service lb portal.
KubeLoadBalancerSet
=
"KUBE-LOAD-BALANCER"
// KubeLoadBalancerIngressLocalSet is used to store service load balancer ingress ip + port with externalTrafficPolicy=local.
KubeLoadBalancerIngressLocalSet
=
"KUBE-LB-INGRESS-LOCAL"
// KubeLoadBalancerLocalSet is used to store service load balancer ingress ip + port with externalTrafficPolicy=local.
KubeLoadBalancerLocalSet
=
"KUBE-LOAD-BALANCER-LOCAL"
// KubeLoadbalancerFWSet is used to store service load balancer ingress ip + port for load balancer with sourceRange.
KubeLoadbalancerFWSet
=
"KUBE-LOAD-BALANCER-FW"
// KubeLoadBalancerSourceIPSet is used to store service load balancer ingress ip + port + source IP for packet filter purpose.
KubeLoadBalancerSourceIPSet
=
"KUBE-LOAD-BALANCER-SOURCE-IP"
...
...
pkg/proxy/ipvs/proxier.go
View file @
e90de22a
This diff is collapsed.
Click to expand it.
pkg/proxy/ipvs/proxier_test.go
View file @
e90de22a
...
...
@@ -145,8 +145,9 @@ func NewFakeProxier(ipt utiliptables.Interface, ipvs utilipvs.Interface, ipset u
loopbackSet
:
NewIPSet
(
ipset
,
KubeLoopBackIPSet
,
utilipset
.
HashIPPortIP
,
false
),
clusterIPSet
:
NewIPSet
(
ipset
,
KubeClusterIPSet
,
utilipset
.
HashIPPort
,
false
),
externalIPSet
:
NewIPSet
(
ipset
,
KubeExternalIPSet
,
utilipset
.
HashIPPort
,
false
),
lbIngressSet
:
NewIPSet
(
ipset
,
KubeLoadBalancerSet
,
utilipset
.
HashIPPort
,
false
),
lbIngressLocalSet
:
NewIPSet
(
ipset
,
KubeLoadBalancerIngressLocalSet
,
utilipset
.
HashIPPort
,
false
),
lbSet
:
NewIPSet
(
ipset
,
KubeLoadBalancerSet
,
utilipset
.
HashIPPort
,
false
),
lbFWSet
:
NewIPSet
(
ipset
,
KubeLoadbalancerFWSet
,
utilipset
.
HashIPPort
,
false
),
lbLocalSet
:
NewIPSet
(
ipset
,
KubeLoadBalancerLocalSet
,
utilipset
.
HashIPPort
,
false
),
lbWhiteListIPSet
:
NewIPSet
(
ipset
,
KubeLoadBalancerSourceIPSet
,
utilipset
.
HashIPPortIP
,
false
),
lbWhiteListCIDRSet
:
NewIPSet
(
ipset
,
KubeLoadBalancerSourceCIDRSet
,
utilipset
.
HashIPPortNet
,
false
),
nodePortSetTCP
:
NewIPSet
(
ipset
,
KubeNodePortSetTCP
,
utilipset
.
BitmapPort
,
false
),
...
...
@@ -957,6 +958,12 @@ func TestLoadBalanceSourceRanges(t *testing.T) {
Protocol
:
strings
.
ToLower
(
string
(
api
.
ProtocolTCP
)),
SetType
:
utilipset
.
HashIPPort
,
}},
KubeLoadbalancerFWSet
:
{{
IP
:
svcLBIP
,
Port
:
svcPort
,
Protocol
:
strings
.
ToLower
(
string
(
api
.
ProtocolTCP
)),
SetType
:
utilipset
.
HashIPPort
,
}},
KubeLoadBalancerSourceCIDRSet
:
{{
IP
:
svcLBIP
,
Port
:
svcPort
,
...
...
@@ -970,10 +977,15 @@ func TestLoadBalanceSourceRanges(t *testing.T) {
// Check iptables chain and rules
epIpt
:=
netlinktest
.
ExpectedIptablesChain
{
string
(
kubeServicesChain
)
:
{{
JumpChain
:
string
(
KubeFireWallChain
),
MatchSet
:
KubeLoadBalancerSet
,
JumpChain
:
string
(
KubeLoadBalancerChain
),
MatchSet
:
KubeLoadBalancerSet
,
}},
string
(
KubeLoadBalancerChain
)
:
{{
JumpChain
:
string
(
KubeFireWallChain
),
MatchSet
:
KubeLoadbalancerFWSet
,
},
{
JumpChain
:
string
(
KubeMarkMasqChain
),
MatchSet
:
""
,
}},
string
(
KubeFireWallChain
)
:
{{
JumpChain
:
"
ACCEPT
"
,
MatchSet
:
KubeLoadBalancerSourceCIDRSet
,
JumpChain
:
"
RETURN
"
,
MatchSet
:
KubeLoadBalancerSourceCIDRSet
,
},
{
JumpChain
:
string
(
KubeMarkDropChain
),
MatchSet
:
""
,
}},
...
...
@@ -1109,7 +1121,7 @@ func TestOnlyLocalLoadBalancing(t *testing.T) {
Protocol
:
strings
.
ToLower
(
string
(
api
.
ProtocolTCP
)),
SetType
:
utilipset
.
HashIPPort
,
}},
KubeLoadBalancer
Ingress
LocalSet
:
{{
KubeLoadBalancerLocalSet
:
{{
IP
:
svcLBIP
,
Port
:
svcPort
,
Protocol
:
strings
.
ToLower
(
string
(
api
.
ProtocolTCP
)),
...
...
@@ -1121,10 +1133,10 @@ func TestOnlyLocalLoadBalancing(t *testing.T) {
// Check iptables chain and rules
epIpt
:=
netlinktest
.
ExpectedIptablesChain
{
string
(
kubeServicesChain
)
:
{{
JumpChain
:
string
(
Kube
FireWall
Chain
),
MatchSet
:
KubeLoadBalancerSet
,
JumpChain
:
string
(
Kube
LoadBalancer
Chain
),
MatchSet
:
KubeLoadBalancerSet
,
}},
string
(
Kube
FireWall
Chain
)
:
{{
JumpChain
:
"
ACCEPT"
,
MatchSet
:
KubeLoadBalancerIngress
LocalSet
,
string
(
Kube
LoadBalancer
Chain
)
:
{{
JumpChain
:
"
RETURN"
,
MatchSet
:
KubeLoadBalancer
LocalSet
,
},
{
JumpChain
:
string
(
KubeMarkMasqChain
),
MatchSet
:
""
,
}},
...
...
@@ -2580,7 +2592,7 @@ func checkIPSet(t *testing.T, fp *Proxier, ipSet netlinktest.ExpectedIPSet) {
for
set
,
entries
:=
range
ipSet
{
ents
,
err
:=
fp
.
ipset
.
ListEntries
(
set
)
if
err
!=
nil
||
len
(
ents
)
!=
len
(
entries
)
{
t
.
Errorf
(
"Check ipset entries failed for ipset: %q
"
,
set
)
t
.
Errorf
(
"Check ipset entries failed for ipset: %q
, expect %d, got %d"
,
set
,
len
(
entries
),
len
(
ents
)
)
continue
}
if
len
(
entries
)
==
1
{
...
...
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