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
4a8a2b5a
Commit
4a8a2b5a
authored
Nov 13, 2014
by
Brendan Burns
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Address comments.
parent
2aa52d04
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
13 deletions
+3
-13
proxier.go
pkg/proxy/proxier.go
+2
-13
rest.go
pkg/registry/service/rest.go
+1
-0
No files found.
pkg/proxy/proxier.go
View file @
4a8a2b5a
...
...
@@ -40,7 +40,8 @@ type serviceInfo struct {
timeout
time
.
Duration
mu
sync
.
Mutex
// protects active
active
bool
publicIP
[]
string
// TODO: make this an net.IP address
publicIP
[]
string
}
func
(
si
*
serviceInfo
)
isActive
()
bool
{
...
...
@@ -506,7 +507,6 @@ func (proxier *Proxier) openPortal(service string, info *serviceInfo) error {
func
(
proxier
*
Proxier
)
openExternalPortal
(
service
string
,
info
*
serviceInfo
)
error
{
for
_
,
publicIP
:=
range
info
.
publicIP
{
proxier
.
iptables
.
EnsureRule
(
iptables
.
TableNAT
,
iptables
.
ChainPostrouting
,
iptablesRoutingArgs
(
publicIP
)
...
)
args
:=
iptablesPortalArgs
(
net
.
ParseIP
(
publicIP
),
info
.
portalPort
,
info
.
protocol
,
proxier
.
listenAddress
,
info
.
proxyPort
,
service
)
existed
,
err
:=
proxier
.
iptables
.
EnsureRule
(
iptables
.
TableNAT
,
iptablesProxyChain
,
args
...
)
if
err
!=
nil
{
...
...
@@ -535,7 +535,6 @@ func (proxier *Proxier) closePortal(service string, info *serviceInfo) error {
func
(
proxier
*
Proxier
)
closeExternalPortal
(
service
string
,
info
*
serviceInfo
)
error
{
for
_
,
publicIP
:=
range
info
.
publicIP
{
proxier
.
iptables
.
DeleteRule
(
iptables
.
TableNAT
,
iptables
.
ChainPostrouting
,
iptablesRoutingArgs
(
publicIP
)
...
)
args
:=
iptablesPortalArgs
(
net
.
ParseIP
(
publicIP
),
info
.
portalPort
,
info
.
protocol
,
proxier
.
listenAddress
,
info
.
proxyPort
,
service
)
if
err
:=
proxier
.
iptables
.
DeleteRule
(
iptables
.
TableNAT
,
iptablesProxyChain
,
args
...
);
err
!=
nil
{
glog
.
Errorf
(
"Failed to delete external iptables %s rule for service %q"
,
iptablesProxyChain
,
service
)
...
...
@@ -577,16 +576,6 @@ var localhostIPv4 = net.ParseIP("127.0.0.1")
var
zeroIPv6
=
net
.
ParseIP
(
"::0"
)
var
localhostIPv6
=
net
.
ParseIP
(
"::1"
)
// Build an iptables args to route in a specific external ip
func
iptablesRoutingArgs
(
destIP
string
)
[]
string
{
return
[]
string
{
"!"
,
"-d"
,
destIP
+
"/32"
,
"-o"
,
"eth0"
,
"-j"
,
"MASQUERADE"
,
}
}
// Build a slice of iptables args for a portal rule.
func
iptablesPortalArgs
(
destIP
net
.
IP
,
destPort
int
,
protocol
api
.
Protocol
,
proxyIP
net
.
IP
,
proxyPort
int
,
service
string
)
[]
string
{
args
:=
[]
string
{
...
...
pkg/registry/service/rest.go
View file @
4a8a2b5a
...
...
@@ -112,6 +112,7 @@ func (rs *REST) Create(ctx api.Context, obj runtime.Object) (<-chan apiserver.RE
return
apiserver
.
MakeAsync
(
func
()
(
runtime
.
Object
,
error
)
{
// TODO: Consider moving this to a rectification loop, so that we make/remove external load balancers
// correctly no matter what http operations happen.
// TODO: Get rid of ProxyPort.
service
.
Spec
.
ProxyPort
=
0
if
service
.
Spec
.
CreateExternalLoadBalancer
{
if
rs
.
cloud
==
nil
{
...
...
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