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
3b1ae9cd
Commit
3b1ae9cd
authored
Apr 14, 2022
by
Brad Davidson
Committed by
Brad Davidson
Apr 15, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix issue with RKE2 servers hanging on listing apiserver addresses
Signed-off-by:
Brad Davidson
<
brad.davidson@rancher.com
>
(cherry picked from commit
7e447692
)
parent
66ed08c8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
11 deletions
+22
-11
apiproxy.go
pkg/agent/proxy/apiproxy.go
+5
-0
tunnel.go
pkg/agent/tunnel/tunnel.go
+17
-11
No files found.
pkg/agent/proxy/apiproxy.go
View file @
3b1ae9cd
...
...
@@ -16,6 +16,7 @@ type Proxy interface {
Update
(
addresses
[]
string
)
SetAPIServerPort
(
ctx
context
.
Context
,
port
int
)
error
SetSupervisorDefault
(
address
string
)
IsSupervisorLBEnabled
()
bool
SupervisorURL
()
string
SupervisorAddresses
()
[]
string
APIServerURL
()
string
...
...
@@ -158,6 +159,10 @@ func (p *proxy) SetSupervisorDefault(address string) {
}
}
func
(
p
*
proxy
)
IsSupervisorLBEnabled
()
bool
{
return
p
.
supervisorLB
!=
nil
}
func
(
p
*
proxy
)
SupervisorURL
()
string
{
return
p
.
supervisorURL
}
...
...
pkg/agent/tunnel/tunnel.go
View file @
3b1ae9cd
...
...
@@ -54,17 +54,23 @@ func Setup(ctx context.Context, config *config.Node, proxy proxy.Proxy) error {
return
err
}
// Try to get a list of apiservers from the server we're connecting to. If that fails, fall back to
// querying the endpoints list from Kubernetes. This fallback requires that the server we're joining be
// running an apiserver, but is the only safe thing to do if its supervisor is down-level and can't provide us
// with an endpoint list.
if
addresses
:=
agentconfig
.
APIServers
(
ctx
,
config
,
proxy
);
len
(
addresses
)
>
0
{
proxy
.
SetSupervisorDefault
(
addresses
[
0
])
proxy
.
Update
(
addresses
)
}
else
{
if
endpoint
,
_
:=
client
.
CoreV1
()
.
Endpoints
(
"default"
)
.
Get
(
ctx
,
"kubernetes"
,
metav1
.
GetOptions
{});
endpoint
!=
nil
{
if
addresses
:=
util
.
GetAddresses
(
endpoint
);
len
(
addresses
)
>
0
{
proxy
.
Update
(
addresses
)
// The loadbalancer is only disabled when there is a local apiserver. Servers without a local
// apiserver load-balance to themselves initially, then switch over to an apiserver node as soon
// as we get some addresses from the code below.
if
proxy
.
IsSupervisorLBEnabled
()
&&
proxy
.
SupervisorURL
()
!=
""
{
logrus
.
Info
(
"Getting list of apiserver endpoints from server"
)
// If not running an apiserver locally, try to get a list of apiservers from the server we're
// connecting to. If that fails, fall back to querying the endpoints list from Kubernetes. This
// fallback requires that the server we're joining be running an apiserver, but is the only safe
// thing to do if its supervisor is down-level and can't provide us with an endpoint list.
if
addresses
:=
agentconfig
.
APIServers
(
ctx
,
config
,
proxy
);
len
(
addresses
)
>
0
{
proxy
.
SetSupervisorDefault
(
addresses
[
0
])
proxy
.
Update
(
addresses
)
}
else
{
if
endpoint
,
_
:=
client
.
CoreV1
()
.
Endpoints
(
"default"
)
.
Get
(
ctx
,
"kubernetes"
,
metav1
.
GetOptions
{});
endpoint
!=
nil
{
if
addresses
:=
util
.
GetAddresses
(
endpoint
);
len
(
addresses
)
>
0
{
proxy
.
Update
(
addresses
)
}
}
}
}
...
...
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