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
a2e4f95e
Commit
a2e4f95e
authored
May 18, 2015
by
Clayton Coleman
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #8269 from smarterclayton/add_proxier_error
Proxier should return typed errors
parents
4a47e89e
de36967c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
92 additions
and
38 deletions
+92
-38
server.go
cmd/kube-proxy/app/server.go
+5
-5
proxier.go
pkg/proxy/proxier.go
+31
-19
proxier_test.go
pkg/proxy/proxier_test.go
+56
-14
No files found.
cmd/kube-proxy/app/server.go
View file @
a2e4f95e
...
@@ -76,14 +76,14 @@ func (s *ProxyServer) AddFlags(fs *pflag.FlagSet) {
...
@@ -76,14 +76,14 @@ func (s *ProxyServer) AddFlags(fs *pflag.FlagSet) {
func
(
s
*
ProxyServer
)
Run
(
_
[]
string
)
error
{
func
(
s
*
ProxyServer
)
Run
(
_
[]
string
)
error
{
// TODO(vmarmol): Use container config for this.
// TODO(vmarmol): Use container config for this.
if
err
:=
util
.
ApplyOomScoreAdj
(
0
,
s
.
OOMScoreAdj
);
err
!=
nil
{
if
err
:=
util
.
ApplyOomScoreAdj
(
0
,
s
.
OOMScoreAdj
);
err
!=
nil
{
glog
.
Info
(
err
)
glog
.
V
(
2
)
.
Info
(
err
)
}
}
// Run in its own container.
// Run in its own container.
if
err
:=
util
.
RunInResourceContainer
(
s
.
ResourceContainer
);
err
!=
nil
{
if
err
:=
util
.
RunInResourceContainer
(
s
.
ResourceContainer
);
err
!=
nil
{
glog
.
Warningf
(
"Failed to start in resource-only container %q: %v"
,
s
.
ResourceContainer
,
err
)
glog
.
Warningf
(
"Failed to start in resource-only container %q: %v"
,
s
.
ResourceContainer
,
err
)
}
else
{
}
else
{
glog
.
Infof
(
"Running in resource-only container %q"
,
s
.
ResourceContainer
)
glog
.
V
(
2
)
.
Infof
(
"Running in resource-only container %q"
,
s
.
ResourceContainer
)
}
}
serviceConfig
:=
config
.
NewServiceConfig
()
serviceConfig
:=
config
.
NewServiceConfig
()
...
@@ -94,9 +94,9 @@ func (s *ProxyServer) Run(_ []string) error {
...
@@ -94,9 +94,9 @@ func (s *ProxyServer) Run(_ []string) error {
protocol
=
iptables
.
ProtocolIpv6
protocol
=
iptables
.
ProtocolIpv6
}
}
loadBalancer
:=
proxy
.
NewLoadBalancerRR
()
loadBalancer
:=
proxy
.
NewLoadBalancerRR
()
proxier
:=
proxy
.
NewProxier
(
loadBalancer
,
net
.
IP
(
s
.
BindAddress
),
iptables
.
New
(
exec
.
New
(),
protocol
))
proxier
,
err
:=
proxy
.
NewProxier
(
loadBalancer
,
net
.
IP
(
s
.
BindAddress
),
iptables
.
New
(
exec
.
New
(),
protocol
))
if
proxier
=
=
nil
{
if
err
!
=
nil
{
glog
.
Fatalf
(
"
failed to create proxier, aborting"
)
glog
.
Fatalf
(
"
Unable to create proxer: %v"
,
err
)
}
}
// Wire proxier to handle changes to services
// Wire proxier to handle changes to services
...
...
pkg/proxy/proxier.go
View file @
a2e4f95e
...
@@ -67,38 +67,50 @@ type Proxier struct {
...
@@ -67,38 +67,50 @@ type Proxier struct {
hostIP
net
.
IP
hostIP
net
.
IP
}
}
var
(
// ErrProxyOnLocalhost is returned by NewProxier if the user requests a proxier on
// the loopback address. May be checked for by callers of NewProxier to know whether
// the caller provided invalid input.
ErrProxyOnLocalhost
=
fmt
.
Errorf
(
"cannot proxy on localhost"
)
)
// IsProxyLocked returns true if the proxy could not acquire the lock on iptables.
func
IsProxyLocked
(
err
error
)
bool
{
return
strings
.
Contains
(
err
.
Error
(),
"holding the xtables lock"
)
}
// NewProxier returns a new Proxier given a LoadBalancer and an address on
// NewProxier returns a new Proxier given a LoadBalancer and an address on
// which to listen. Because of the iptables logic, It is assumed that there
// which to listen. Because of the iptables logic, It is assumed that there
// is only a single Proxier active on a machine.
// is only a single Proxier active on a machine. An error will be returned if
func
NewProxier
(
loadBalancer
LoadBalancer
,
listenIP
net
.
IP
,
iptables
iptables
.
Interface
)
*
Proxier
{
// the proxier cannot be started due to an invalid ListenIP (loopback) or
// if iptables fails to update or acquire the initial lock. Once a proxier is
// created, it will keep iptables up to date in the background and will not
// terminate if a particular iptables call fails.
func
NewProxier
(
loadBalancer
LoadBalancer
,
listenIP
net
.
IP
,
iptables
iptables
.
Interface
)
(
*
Proxier
,
error
)
{
if
listenIP
.
Equal
(
localhostIPv4
)
||
listenIP
.
Equal
(
localhostIPv6
)
{
if
listenIP
.
Equal
(
localhostIPv4
)
||
listenIP
.
Equal
(
localhostIPv6
)
{
glog
.
Errorf
(
"Can't proxy only on localhost - iptables can't do it"
)
return
nil
,
ErrProxyOnLocalhost
return
nil
}
}
hostIP
,
err
:=
util
.
ChooseHostInterface
()
hostIP
,
err
:=
util
.
ChooseHostInterface
()
if
err
!=
nil
{
if
err
!=
nil
{
glog
.
Errorf
(
"Failed to select a host interface: %v"
,
err
)
return
nil
,
fmt
.
Errorf
(
"failed to select a host interface: %v"
,
err
)
return
nil
}
}
glog
.
Infof
(
"Setting Proxy IP to %v"
,
hostIP
)
glog
.
V
(
2
)
.
Infof
(
"Setting proxy IP to %v and initializing iptables"
,
hostIP
)
return
createProxier
(
loadBalancer
,
listenIP
,
iptables
,
hostIP
)
return
createProxier
(
loadBalancer
,
listenIP
,
iptables
,
hostIP
)
}
}
func
createProxier
(
loadBalancer
LoadBalancer
,
listenIP
net
.
IP
,
iptables
iptables
.
Interface
,
hostIP
net
.
IP
)
*
Proxier
{
func
createProxier
(
loadBalancer
LoadBalancer
,
listenIP
net
.
IP
,
iptables
iptables
.
Interface
,
hostIP
net
.
IP
)
(
*
Proxier
,
error
)
{
glog
.
Infof
(
"Initializing iptables"
)
// Clean up old messes. Ignore erors.
// Clean up old messes. Ignore erors.
iptablesDeleteOld
(
iptables
)
iptablesDeleteOld
(
iptables
)
// Set up the iptables foundations we need.
// Set up the iptables foundations we need.
if
err
:=
iptablesInit
(
iptables
);
err
!=
nil
{
if
err
:=
iptablesInit
(
iptables
);
err
!=
nil
{
glog
.
Errorf
(
"Failed to initialize iptables: %v"
,
err
)
return
nil
,
fmt
.
Errorf
(
"failed to initialize iptables: %v"
,
err
)
return
nil
}
}
// Flush old iptables rules (since the bound ports will be invalid after a restart).
// Flush old iptables rules (since the bound ports will be invalid after a restart).
// When OnUpdate() is first called, the rules will be recreated.
// When OnUpdate() is first called, the rules will be recreated.
if
err
:=
iptablesFlush
(
iptables
);
err
!=
nil
{
if
err
:=
iptablesFlush
(
iptables
);
err
!=
nil
{
glog
.
Errorf
(
"Failed to flush iptables: %v"
,
err
)
return
nil
,
fmt
.
Errorf
(
"failed to flush iptables: %v"
,
err
)
return
nil
}
}
return
&
Proxier
{
return
&
Proxier
{
loadBalancer
:
loadBalancer
,
loadBalancer
:
loadBalancer
,
...
@@ -106,7 +118,7 @@ func createProxier(loadBalancer LoadBalancer, listenIP net.IP, iptables iptables
...
@@ -106,7 +118,7 @@ func createProxier(loadBalancer LoadBalancer, listenIP net.IP, iptables iptables
listenIP
:
listenIP
,
listenIP
:
listenIP
,
iptables
:
iptables
,
iptables
:
iptables
,
hostIP
:
hostIP
,
hostIP
:
hostIP
,
}
}
,
nil
}
}
// The periodic interval for checking the state of things.
// The periodic interval for checking the state of things.
...
@@ -118,7 +130,7 @@ func (proxier *Proxier) SyncLoop() {
...
@@ -118,7 +130,7 @@ func (proxier *Proxier) SyncLoop() {
defer
t
.
Stop
()
defer
t
.
Stop
()
for
{
for
{
<-
t
.
C
<-
t
.
C
glog
.
V
(
3
)
.
Infof
(
"Periodic sync"
)
glog
.
V
(
6
)
.
Infof
(
"Periodic sync"
)
if
err
:=
iptablesInit
(
proxier
.
iptables
);
err
!=
nil
{
if
err
:=
iptablesInit
(
proxier
.
iptables
);
err
!=
nil
{
glog
.
Errorf
(
"Failed to ensure iptables: %v"
,
err
)
glog
.
Errorf
(
"Failed to ensure iptables: %v"
,
err
)
}
}
...
@@ -201,7 +213,7 @@ func (proxier *Proxier) addServiceOnPort(service ServicePortName, protocol api.P
...
@@ -201,7 +213,7 @@ func (proxier *Proxier) addServiceOnPort(service ServicePortName, protocol api.P
}
}
proxier
.
setServiceInfo
(
service
,
si
)
proxier
.
setServiceInfo
(
service
,
si
)
glog
.
V
(
1
)
.
Infof
(
"Proxying for service %q on %s port %d"
,
service
,
protocol
,
portNum
)
glog
.
V
(
2
)
.
Infof
(
"Proxying for service %q on %s port %d"
,
service
,
protocol
,
portNum
)
go
func
(
service
ServicePortName
,
proxier
*
Proxier
)
{
go
func
(
service
ServicePortName
,
proxier
*
Proxier
)
{
defer
util
.
HandleCrash
()
defer
util
.
HandleCrash
()
atomic
.
AddInt32
(
&
proxier
.
numProxyLoops
,
1
)
atomic
.
AddInt32
(
&
proxier
.
numProxyLoops
,
1
)
...
@@ -340,7 +352,7 @@ func (proxier *Proxier) openOnePortal(portalIP net.IP, portalPort int, protocol
...
@@ -340,7 +352,7 @@ func (proxier *Proxier) openOnePortal(portalIP net.IP, portalPort int, protocol
return
err
return
err
}
}
if
!
existed
{
if
!
existed
{
glog
.
Infof
(
"Opened iptables from-containers portal for service %q on %s %s:%d"
,
name
,
protocol
,
portalIP
,
portalPort
)
glog
.
V
(
3
)
.
Infof
(
"Opened iptables from-containers portal for service %q on %s %s:%d"
,
name
,
protocol
,
portalIP
,
portalPort
)
}
}
// Handle traffic from the host.
// Handle traffic from the host.
...
@@ -351,7 +363,7 @@ func (proxier *Proxier) openOnePortal(portalIP net.IP, portalPort int, protocol
...
@@ -351,7 +363,7 @@ func (proxier *Proxier) openOnePortal(portalIP net.IP, portalPort int, protocol
return
err
return
err
}
}
if
!
existed
{
if
!
existed
{
glog
.
Infof
(
"Opened iptables from-host portal for service %q on %s %s:%d"
,
name
,
protocol
,
portalIP
,
portalPort
)
glog
.
V
(
3
)
.
Infof
(
"Opened iptables from-host portal for service %q on %s %s:%d"
,
name
,
protocol
,
portalIP
,
portalPort
)
}
}
return
nil
return
nil
}
}
...
@@ -363,7 +375,7 @@ func (proxier *Proxier) closePortal(service ServicePortName, info *serviceInfo)
...
@@ -363,7 +375,7 @@ func (proxier *Proxier) closePortal(service ServicePortName, info *serviceInfo)
el
=
append
(
el
,
proxier
.
closeOnePortal
(
net
.
ParseIP
(
publicIP
),
info
.
portalPort
,
info
.
protocol
,
proxier
.
listenIP
,
info
.
proxyPort
,
service
)
...
)
el
=
append
(
el
,
proxier
.
closeOnePortal
(
net
.
ParseIP
(
publicIP
),
info
.
portalPort
,
info
.
protocol
,
proxier
.
listenIP
,
info
.
proxyPort
,
service
)
...
)
}
}
if
len
(
el
)
==
0
{
if
len
(
el
)
==
0
{
glog
.
Infof
(
"Closed iptables portals for service %q"
,
service
)
glog
.
V
(
3
)
.
Infof
(
"Closed iptables portals for service %q"
,
service
)
}
else
{
}
else
{
glog
.
Errorf
(
"Some errors closing iptables portals for service %q"
,
service
)
glog
.
Errorf
(
"Some errors closing iptables portals for service %q"
,
service
)
}
}
...
...
pkg/proxy/proxier_test.go
View file @
a2e4f95e
...
@@ -206,7 +206,10 @@ func TestTCPProxy(t *testing.T) {
...
@@ -206,7 +206,10 @@ func TestTCPProxy(t *testing.T) {
},
},
})
})
p
:=
createProxier
(
lb
,
net
.
ParseIP
(
"0.0.0.0"
),
&
fakeIptables
{},
net
.
ParseIP
(
"127.0.0.1"
))
p
,
err
:=
createProxier
(
lb
,
net
.
ParseIP
(
"0.0.0.0"
),
&
fakeIptables
{},
net
.
ParseIP
(
"127.0.0.1"
))
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
waitForNumProxyLoops
(
t
,
p
,
0
)
waitForNumProxyLoops
(
t
,
p
,
0
)
svcInfo
,
err
:=
p
.
addServiceOnPort
(
service
,
"TCP"
,
0
,
time
.
Second
)
svcInfo
,
err
:=
p
.
addServiceOnPort
(
service
,
"TCP"
,
0
,
time
.
Second
)
...
@@ -230,7 +233,10 @@ func TestUDPProxy(t *testing.T) {
...
@@ -230,7 +233,10 @@ func TestUDPProxy(t *testing.T) {
},
},
})
})
p
:=
createProxier
(
lb
,
net
.
ParseIP
(
"0.0.0.0"
),
&
fakeIptables
{},
net
.
ParseIP
(
"127.0.0.1"
))
p
,
err
:=
createProxier
(
lb
,
net
.
ParseIP
(
"0.0.0.0"
),
&
fakeIptables
{},
net
.
ParseIP
(
"127.0.0.1"
))
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
waitForNumProxyLoops
(
t
,
p
,
0
)
waitForNumProxyLoops
(
t
,
p
,
0
)
svcInfo
,
err
:=
p
.
addServiceOnPort
(
service
,
"UDP"
,
0
,
time
.
Second
)
svcInfo
,
err
:=
p
.
addServiceOnPort
(
service
,
"UDP"
,
0
,
time
.
Second
)
...
@@ -259,7 +265,10 @@ func TestMultiPortProxy(t *testing.T) {
...
@@ -259,7 +265,10 @@ func TestMultiPortProxy(t *testing.T) {
}},
}},
}})
}})
p
:=
createProxier
(
lb
,
net
.
ParseIP
(
"0.0.0.0"
),
&
fakeIptables
{},
net
.
ParseIP
(
"127.0.0.1"
))
p
,
err
:=
createProxier
(
lb
,
net
.
ParseIP
(
"0.0.0.0"
),
&
fakeIptables
{},
net
.
ParseIP
(
"127.0.0.1"
))
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
waitForNumProxyLoops
(
t
,
p
,
0
)
waitForNumProxyLoops
(
t
,
p
,
0
)
svcInfoP
,
err
:=
p
.
addServiceOnPort
(
serviceP
,
"TCP"
,
0
,
time
.
Second
)
svcInfoP
,
err
:=
p
.
addServiceOnPort
(
serviceP
,
"TCP"
,
0
,
time
.
Second
)
...
@@ -283,7 +292,10 @@ func TestMultiPortOnUpdate(t *testing.T) {
...
@@ -283,7 +292,10 @@ func TestMultiPortOnUpdate(t *testing.T) {
serviceQ
:=
ServicePortName
{
types
.
NamespacedName
{
"testnamespace"
,
"echo"
},
"q"
}
serviceQ
:=
ServicePortName
{
types
.
NamespacedName
{
"testnamespace"
,
"echo"
},
"q"
}
serviceX
:=
ServicePortName
{
types
.
NamespacedName
{
"testnamespace"
,
"echo"
},
"x"
}
serviceX
:=
ServicePortName
{
types
.
NamespacedName
{
"testnamespace"
,
"echo"
},
"x"
}
p
:=
createProxier
(
lb
,
net
.
ParseIP
(
"0.0.0.0"
),
&
fakeIptables
{},
net
.
ParseIP
(
"127.0.0.1"
))
p
,
err
:=
createProxier
(
lb
,
net
.
ParseIP
(
"0.0.0.0"
),
&
fakeIptables
{},
net
.
ParseIP
(
"127.0.0.1"
))
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
waitForNumProxyLoops
(
t
,
p
,
0
)
waitForNumProxyLoops
(
t
,
p
,
0
)
p
.
OnUpdate
([]
api
.
Service
{{
p
.
OnUpdate
([]
api
.
Service
{{
...
@@ -343,7 +355,10 @@ func TestTCPProxyStop(t *testing.T) {
...
@@ -343,7 +355,10 @@ func TestTCPProxyStop(t *testing.T) {
},
},
})
})
p
:=
createProxier
(
lb
,
net
.
ParseIP
(
"0.0.0.0"
),
&
fakeIptables
{},
net
.
ParseIP
(
"127.0.0.1"
))
p
,
err
:=
createProxier
(
lb
,
net
.
ParseIP
(
"0.0.0.0"
),
&
fakeIptables
{},
net
.
ParseIP
(
"127.0.0.1"
))
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
waitForNumProxyLoops
(
t
,
p
,
0
)
waitForNumProxyLoops
(
t
,
p
,
0
)
svcInfo
,
err
:=
p
.
addServiceOnPort
(
service
,
"TCP"
,
0
,
time
.
Second
)
svcInfo
,
err
:=
p
.
addServiceOnPort
(
service
,
"TCP"
,
0
,
time
.
Second
)
...
@@ -378,7 +393,10 @@ func TestUDPProxyStop(t *testing.T) {
...
@@ -378,7 +393,10 @@ func TestUDPProxyStop(t *testing.T) {
},
},
})
})
p
:=
createProxier
(
lb
,
net
.
ParseIP
(
"0.0.0.0"
),
&
fakeIptables
{},
net
.
ParseIP
(
"127.0.0.1"
))
p
,
err
:=
createProxier
(
lb
,
net
.
ParseIP
(
"0.0.0.0"
),
&
fakeIptables
{},
net
.
ParseIP
(
"127.0.0.1"
))
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
waitForNumProxyLoops
(
t
,
p
,
0
)
waitForNumProxyLoops
(
t
,
p
,
0
)
svcInfo
,
err
:=
p
.
addServiceOnPort
(
service
,
"UDP"
,
0
,
time
.
Second
)
svcInfo
,
err
:=
p
.
addServiceOnPort
(
service
,
"UDP"
,
0
,
time
.
Second
)
...
@@ -413,7 +431,10 @@ func TestTCPProxyUpdateDelete(t *testing.T) {
...
@@ -413,7 +431,10 @@ func TestTCPProxyUpdateDelete(t *testing.T) {
},
},
})
})
p
:=
createProxier
(
lb
,
net
.
ParseIP
(
"0.0.0.0"
),
&
fakeIptables
{},
net
.
ParseIP
(
"127.0.0.1"
))
p
,
err
:=
createProxier
(
lb
,
net
.
ParseIP
(
"0.0.0.0"
),
&
fakeIptables
{},
net
.
ParseIP
(
"127.0.0.1"
))
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
waitForNumProxyLoops
(
t
,
p
,
0
)
waitForNumProxyLoops
(
t
,
p
,
0
)
svcInfo
,
err
:=
p
.
addServiceOnPort
(
service
,
"TCP"
,
0
,
time
.
Second
)
svcInfo
,
err
:=
p
.
addServiceOnPort
(
service
,
"TCP"
,
0
,
time
.
Second
)
...
@@ -447,7 +468,10 @@ func TestUDPProxyUpdateDelete(t *testing.T) {
...
@@ -447,7 +468,10 @@ func TestUDPProxyUpdateDelete(t *testing.T) {
},
},
})
})
p
:=
createProxier
(
lb
,
net
.
ParseIP
(
"0.0.0.0"
),
&
fakeIptables
{},
net
.
ParseIP
(
"127.0.0.1"
))
p
,
err
:=
createProxier
(
lb
,
net
.
ParseIP
(
"0.0.0.0"
),
&
fakeIptables
{},
net
.
ParseIP
(
"127.0.0.1"
))
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
waitForNumProxyLoops
(
t
,
p
,
0
)
waitForNumProxyLoops
(
t
,
p
,
0
)
svcInfo
,
err
:=
p
.
addServiceOnPort
(
service
,
"UDP"
,
0
,
time
.
Second
)
svcInfo
,
err
:=
p
.
addServiceOnPort
(
service
,
"UDP"
,
0
,
time
.
Second
)
...
@@ -481,7 +505,10 @@ func TestTCPProxyUpdateDeleteUpdate(t *testing.T) {
...
@@ -481,7 +505,10 @@ func TestTCPProxyUpdateDeleteUpdate(t *testing.T) {
},
},
})
})
p
:=
createProxier
(
lb
,
net
.
ParseIP
(
"0.0.0.0"
),
&
fakeIptables
{},
net
.
ParseIP
(
"127.0.0.1"
))
p
,
err
:=
createProxier
(
lb
,
net
.
ParseIP
(
"0.0.0.0"
),
&
fakeIptables
{},
net
.
ParseIP
(
"127.0.0.1"
))
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
waitForNumProxyLoops
(
t
,
p
,
0
)
waitForNumProxyLoops
(
t
,
p
,
0
)
svcInfo
,
err
:=
p
.
addServiceOnPort
(
service
,
"TCP"
,
0
,
time
.
Second
)
svcInfo
,
err
:=
p
.
addServiceOnPort
(
service
,
"TCP"
,
0
,
time
.
Second
)
...
@@ -530,7 +557,10 @@ func TestUDPProxyUpdateDeleteUpdate(t *testing.T) {
...
@@ -530,7 +557,10 @@ func TestUDPProxyUpdateDeleteUpdate(t *testing.T) {
},
},
})
})
p
:=
createProxier
(
lb
,
net
.
ParseIP
(
"0.0.0.0"
),
&
fakeIptables
{},
net
.
ParseIP
(
"127.0.0.1"
))
p
,
err
:=
createProxier
(
lb
,
net
.
ParseIP
(
"0.0.0.0"
),
&
fakeIptables
{},
net
.
ParseIP
(
"127.0.0.1"
))
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
waitForNumProxyLoops
(
t
,
p
,
0
)
waitForNumProxyLoops
(
t
,
p
,
0
)
svcInfo
,
err
:=
p
.
addServiceOnPort
(
service
,
"UDP"
,
0
,
time
.
Second
)
svcInfo
,
err
:=
p
.
addServiceOnPort
(
service
,
"UDP"
,
0
,
time
.
Second
)
...
@@ -579,7 +609,10 @@ func TestTCPProxyUpdatePort(t *testing.T) {
...
@@ -579,7 +609,10 @@ func TestTCPProxyUpdatePort(t *testing.T) {
},
},
})
})
p
:=
createProxier
(
lb
,
net
.
ParseIP
(
"0.0.0.0"
),
&
fakeIptables
{},
net
.
ParseIP
(
"127.0.0.1"
))
p
,
err
:=
createProxier
(
lb
,
net
.
ParseIP
(
"0.0.0.0"
),
&
fakeIptables
{},
net
.
ParseIP
(
"127.0.0.1"
))
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
waitForNumProxyLoops
(
t
,
p
,
0
)
waitForNumProxyLoops
(
t
,
p
,
0
)
svcInfo
,
err
:=
p
.
addServiceOnPort
(
service
,
"TCP"
,
0
,
time
.
Second
)
svcInfo
,
err
:=
p
.
addServiceOnPort
(
service
,
"TCP"
,
0
,
time
.
Second
)
...
@@ -624,7 +657,10 @@ func TestUDPProxyUpdatePort(t *testing.T) {
...
@@ -624,7 +657,10 @@ func TestUDPProxyUpdatePort(t *testing.T) {
},
},
})
})
p
:=
createProxier
(
lb
,
net
.
ParseIP
(
"0.0.0.0"
),
&
fakeIptables
{},
net
.
ParseIP
(
"127.0.0.1"
))
p
,
err
:=
createProxier
(
lb
,
net
.
ParseIP
(
"0.0.0.0"
),
&
fakeIptables
{},
net
.
ParseIP
(
"127.0.0.1"
))
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
waitForNumProxyLoops
(
t
,
p
,
0
)
waitForNumProxyLoops
(
t
,
p
,
0
)
svcInfo
,
err
:=
p
.
addServiceOnPort
(
service
,
"UDP"
,
0
,
time
.
Second
)
svcInfo
,
err
:=
p
.
addServiceOnPort
(
service
,
"UDP"
,
0
,
time
.
Second
)
...
@@ -666,7 +702,10 @@ func TestProxyUpdatePublicIPs(t *testing.T) {
...
@@ -666,7 +702,10 @@ func TestProxyUpdatePublicIPs(t *testing.T) {
},
},
})
})
p
:=
createProxier
(
lb
,
net
.
ParseIP
(
"0.0.0.0"
),
&
fakeIptables
{},
net
.
ParseIP
(
"127.0.0.1"
))
p
,
err
:=
createProxier
(
lb
,
net
.
ParseIP
(
"0.0.0.0"
),
&
fakeIptables
{},
net
.
ParseIP
(
"127.0.0.1"
))
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
waitForNumProxyLoops
(
t
,
p
,
0
)
waitForNumProxyLoops
(
t
,
p
,
0
)
svcInfo
,
err
:=
p
.
addServiceOnPort
(
service
,
"TCP"
,
0
,
time
.
Second
)
svcInfo
,
err
:=
p
.
addServiceOnPort
(
service
,
"TCP"
,
0
,
time
.
Second
)
...
@@ -715,7 +754,10 @@ func TestProxyUpdatePortal(t *testing.T) {
...
@@ -715,7 +754,10 @@ func TestProxyUpdatePortal(t *testing.T) {
},
},
})
})
p
:=
createProxier
(
lb
,
net
.
ParseIP
(
"0.0.0.0"
),
&
fakeIptables
{},
net
.
ParseIP
(
"127.0.0.1"
))
p
,
err
:=
createProxier
(
lb
,
net
.
ParseIP
(
"0.0.0.0"
),
&
fakeIptables
{},
net
.
ParseIP
(
"127.0.0.1"
))
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
waitForNumProxyLoops
(
t
,
p
,
0
)
waitForNumProxyLoops
(
t
,
p
,
0
)
svcInfo
,
err
:=
p
.
addServiceOnPort
(
service
,
"TCP"
,
0
,
time
.
Second
)
svcInfo
,
err
:=
p
.
addServiceOnPort
(
service
,
"TCP"
,
0
,
time
.
Second
)
...
...
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