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
643fc380
Commit
643fc380
authored
Aug 11, 2016
by
Minhan Xia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add firewall chain to filter request based on loadbalancer source range
parent
3bf86792
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
122 additions
and
38 deletions
+122
-38
server.go
cmd/kube-proxy/app/server.go
+16
-2
proxier.go
pkg/proxy/iptables/proxier.go
+106
-36
No files found.
cmd/kube-proxy/app/server.go
View file @
643fc380
...
@@ -204,8 +204,7 @@ func NewProxyServerDefault(config *options.ProxyServerConfig) (*ProxyServer, err
...
@@ -204,8 +204,7 @@ func NewProxyServerDefault(config *options.ProxyServerConfig) (*ProxyServer, err
// IPTablesMasqueradeBit must be specified or defaulted.
// IPTablesMasqueradeBit must be specified or defaulted.
return
nil
,
fmt
.
Errorf
(
"Unable to read IPTablesMasqueradeBit from config"
)
return
nil
,
fmt
.
Errorf
(
"Unable to read IPTablesMasqueradeBit from config"
)
}
}
proxierIptables
,
err
:=
iptables
.
NewProxier
(
iptInterface
,
execer
,
config
.
IPTablesSyncPeriod
.
Duration
,
config
.
MasqueradeAll
,
int
(
*
config
.
IPTablesMasqueradeBit
),
config
.
ClusterCIDR
,
hostname
,
getNodeIP
(
client
,
hostname
))
proxierIptables
,
err
:=
iptables
.
NewProxier
(
iptInterface
,
execer
,
config
.
IPTablesSyncPeriod
.
Duration
,
config
.
MasqueradeAll
,
int
(
*
config
.
IPTablesMasqueradeBit
),
config
.
ClusterCIDR
,
hostname
)
if
err
!=
nil
{
if
err
!=
nil
{
glog
.
Fatalf
(
"Unable to create proxier: %v"
,
err
)
glog
.
Fatalf
(
"Unable to create proxier: %v"
,
err
)
}
}
...
@@ -409,3 +408,18 @@ func tryIptablesProxy(iptver iptables.IptablesVersioner, kcompat iptables.Kernel
...
@@ -409,3 +408,18 @@ func tryIptablesProxy(iptver iptables.IptablesVersioner, kcompat iptables.Kernel
func
(
s
*
ProxyServer
)
birthCry
()
{
func
(
s
*
ProxyServer
)
birthCry
()
{
s
.
Recorder
.
Eventf
(
s
.
Config
.
NodeRef
,
api
.
EventTypeNormal
,
"Starting"
,
"Starting kube-proxy."
)
s
.
Recorder
.
Eventf
(
s
.
Config
.
NodeRef
,
api
.
EventTypeNormal
,
"Starting"
,
"Starting kube-proxy."
)
}
}
func
getNodeIP
(
client
*
kubeclient
.
Client
,
hostname
string
)
net
.
IP
{
var
nodeIP
net
.
IP
node
,
err
:=
client
.
Nodes
()
.
Get
(
hostname
)
if
err
!=
nil
{
glog
.
Warningf
(
"Failed to retrieve node info: %v"
,
err
)
return
nil
}
nodeIP
,
err
=
nodeutil
.
GetNodeHostIP
(
node
)
if
err
!=
nil
{
glog
.
Warningf
(
"Failed to retrieve node IP: %v"
,
err
)
return
nil
}
return
nodeIP
}
pkg/proxy/iptables/proxier.go
View file @
643fc380
This diff is collapsed.
Click to expand it.
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