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
34fc4d03
Unverified
Commit
34fc4d03
authored
Jul 12, 2019
by
Erik Wilson
Committed by
GitHub
Jul 12, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #629 from erikwilson/update-remotedialer
Update remotedialer & tunnel logs
parents
131f3bec
7e6664b6
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
14 deletions
+22
-14
tunnel.go
pkg/agent/tunnel/tunnel.go
+14
-7
trash.lock
trash.lock
+1
-1
vendor.conf
vendor.conf
+1
-1
client.go
vendor/github.com/rancher/remotedialer/client.go
+6
-5
No files found.
pkg/agent/tunnel/tunnel.go
View file @
34fc4d03
...
@@ -68,10 +68,12 @@ func Setup(config *config.Node) error {
...
@@ -68,10 +68,12 @@ func Setup(config *config.Node) error {
}
}
addresses
:=
[]
string
{
config
.
ServerAddress
}
addresses
:=
[]
string
{
config
.
ServerAddress
}
endpointResourceVersion
:=
""
endpoint
,
_
:=
client
.
CoreV1
()
.
Endpoints
(
"default"
)
.
Get
(
"kubernetes"
,
metav1
.
GetOptions
{})
endpoint
,
_
:=
client
.
CoreV1
()
.
Endpoints
(
"default"
)
.
Get
(
"kubernetes"
,
metav1
.
GetOptions
{})
if
endpoint
!=
nil
{
if
endpoint
!=
nil
{
addresses
=
getAddresses
(
endpoint
)
addresses
=
getAddresses
(
endpoint
)
endpointResourceVersion
=
endpoint
.
ResourceVersion
}
}
disconnect
:=
map
[
string
]
context
.
CancelFunc
{}
disconnect
:=
map
[
string
]
context
.
CancelFunc
{}
...
@@ -88,10 +90,11 @@ func Setup(config *config.Node) error {
...
@@ -88,10 +90,11 @@ func Setup(config *config.Node) error {
connect
:
connect
:
for
{
for
{
watch
,
err
:=
client
.
CoreV1
()
.
Endpoints
(
"default"
)
.
Watch
(
metav1
.
ListOptions
{
watch
,
err
:=
client
.
CoreV1
()
.
Endpoints
(
"default"
)
.
Watch
(
metav1
.
ListOptions
{
FieldSelector
:
fields
.
Set
{
"metadata.name"
:
"kubernetes"
}
.
String
(),
FieldSelector
:
fields
.
Set
{
"metadata.name"
:
"kubernetes"
}
.
String
(),
ResourceVersion
:
endpointResourceVersion
,
})
})
if
err
!=
nil
{
if
err
!=
nil
{
logrus
.
Errorf
(
"Unable to watch for endpoints: %v"
,
err
)
logrus
.
Errorf
(
"Unable to watch for
tunnel
endpoints: %v"
,
err
)
time
.
Sleep
(
5
*
time
.
Second
)
time
.
Sleep
(
5
*
time
.
Second
)
continue
connect
continue
connect
}
}
...
@@ -100,21 +103,25 @@ func Setup(config *config.Node) error {
...
@@ -100,21 +103,25 @@ func Setup(config *config.Node) error {
select
{
select
{
case
ev
,
ok
:=
<-
watch
.
ResultChan
()
:
case
ev
,
ok
:=
<-
watch
.
ResultChan
()
:
if
!
ok
{
if
!
ok
{
logrus
.
Error
(
"endpoint watch channel closed"
)
logrus
.
Error
(
"
Tunnel
endpoint watch channel closed"
)
continue
connect
continue
connect
}
}
endpoint
,
ok
:=
ev
.
Object
.
(
*
v1
.
Endpoints
)
endpoint
,
ok
:=
ev
.
Object
.
(
*
v1
.
Endpoints
)
if
!
ok
{
if
!
ok
{
logrus
.
Error
(
"could not case event object to endpoint"
)
logrus
.
Error
(
"
Tunnel
could not case event object to endpoint"
)
continue
watching
continue
watching
}
}
endpointResourceVersion
=
endpoint
.
ResourceVersion
validEndpoint
:=
map
[
string
]
bool
{}
var
addresses
=
getAddresses
(
endpoint
)
var
addresses
=
getAddresses
(
endpoint
)
logrus
.
Infof
(
"Tunnel endpoint watch event: %v"
,
addresses
)
validEndpoint
:=
map
[
string
]
bool
{}
for
_
,
address
:=
range
addresses
{
for
_
,
address
:=
range
addresses
{
validEndpoint
[
address
]
=
true
validEndpoint
[
address
]
=
true
if
_
,
ok
:=
disconnect
[
address
];
!
ok
{
if
_
,
ok
:=
disconnect
[
address
];
!
ok
{
disconnect
[
address
]
=
connect
(
wg
,
address
,
config
,
transportConfig
)
disconnect
[
address
]
=
connect
(
nil
,
address
,
config
,
transportConfig
)
}
}
}
}
...
@@ -173,7 +180,7 @@ func connect(waitGroup *sync.WaitGroup, address string, config *config.Node, tra
...
@@ -173,7 +180,7 @@ func connect(waitGroup *sync.WaitGroup, address string, config *config.Node, tra
})
})
if
ctx
.
Err
()
!=
nil
{
if
ctx
.
Err
()
!=
nil
{
logrus
.
Infof
(
"Stopp
ing
tunnel to %s"
,
wsURL
)
logrus
.
Infof
(
"Stopp
ed
tunnel to %s"
,
wsURL
)
return
return
}
}
}
}
...
...
trash.lock
View file @
34fc4d03
...
@@ -229,7 +229,7 @@ import:
...
@@ -229,7 +229,7 @@ import:
- package: github.com/rancher/helm-controller
- package: github.com/rancher/helm-controller
version: v0.2.1
version: v0.2.1
- package: github.com/rancher/remotedialer
- package: github.com/rancher/remotedialer
version:
66218bc42b4fa27c34523c0d19a41a0e2b74983d
version:
4a5a661be67697d6369df54ef62d5a30b0385697
- package: github.com/rancher/wrangler
- package: github.com/rancher/wrangler
version: 7737c167e16514a38229bc64c839cee8cd14e6d3
version: 7737c167e16514a38229bc64c839cee8cd14e6d3
- package: github.com/rancher/wrangler-api
- package: github.com/rancher/wrangler-api
...
...
vendor.conf
View file @
34fc4d03
...
@@ -14,7 +14,7 @@ k8s.io/kubernetes v1.14.3-k3s.2 ht
...
@@ -14,7 +14,7 @@ k8s.io/kubernetes v1.14.3-k3s.2 ht
github
.
com
/
rancher
/
wrangler
7737
c167e16514a38229bc64c839cee8cd14e6d3
github
.
com
/
rancher
/
wrangler
7737
c167e16514a38229bc64c839cee8cd14e6d3
github
.
com
/
rancher
/
wrangler
-
api
v0
.
1
.
4
github
.
com
/
rancher
/
wrangler
-
api
v0
.
1
.
4
github
.
com
/
rancher
/
dynamiclistener
4716
ac2362986f28bede3f3caf5d1ce347da55b0
github
.
com
/
rancher
/
dynamiclistener
4716
ac2362986f28bede3f3caf5d1ce347da55b0
github
.
com
/
rancher
/
remotedialer
66218
bc42b4fa27c34523c0d19a41a0e2b74983d
github
.
com
/
rancher
/
remotedialer
4
a5a661be67697d6369df54ef62d5a30b0385697
github
.
com
/
rancher
/
helm
-
controller
v0
.
2
.
1
github
.
com
/
rancher
/
helm
-
controller
v0
.
2
.
1
github
.
com
/
matryer
/
moq
ee5226d43009
https
://
github
.
com
/
rancher
/
moq
.
git
github
.
com
/
matryer
/
moq
ee5226d43009
https
://
github
.
com
/
rancher
/
moq
.
git
github
.
com
/
coreos
/
flannel
823
afe66b2266bf71f5bec24e6e28b26d70cfc7c
https
://
github
.
com
/
ibuildthecloud
/
flannel
.
git
github
.
com
/
coreos
/
flannel
823
afe66b2266bf71f5bec24e6e28b26d70cfc7c
https
://
github
.
com
/
ibuildthecloud
/
flannel
.
git
...
...
vendor/github.com/rancher/remotedialer/client.go
View file @
34fc4d03
...
@@ -31,11 +31,11 @@ func connectToProxy(ctx context.Context, proxyURL string, headers http.Header, a
...
@@ -31,11 +31,11 @@ func connectToProxy(ctx context.Context, proxyURL string, headers http.Header, a
}
}
defer
ws
.
Close
()
defer
ws
.
Close
()
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
if
onConnect
!=
nil
{
if
onConnect
!=
nil
{
if
err
:=
onConnect
(
ctx
);
err
!=
nil
{
ctxOnConnect
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
if
err
:=
onConnect
(
ctxOnConnect
);
err
!=
nil
{
return
err
return
err
}
}
}
}
...
@@ -51,7 +51,8 @@ func connectToProxy(ctx context.Context, proxyURL string, headers http.Header, a
...
@@ -51,7 +51,8 @@ func connectToProxy(ctx context.Context, proxyURL string, headers http.Header, a
select
{
select
{
case
<-
ctx
.
Done
()
:
case
<-
ctx
.
Done
()
:
return
ctx
.
Err
()
logrus
.
WithField
(
"url"
,
proxyURL
)
.
WithField
(
"err"
,
ctx
.
Err
())
.
Info
(
"Proxy done"
)
return
nil
case
err
:=
<-
result
:
case
err
:=
<-
result
:
return
err
return
err
}
}
...
...
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