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
7f271e4e
Commit
7f271e4e
authored
Jan 06, 2022
by
Brad Davidson
Committed by
Brad Davidson
Jan 07, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix handling of agent-token fallback to token
Signed-off-by:
Brad Davidson
<
brad.davidson@rancher.com
>
parent
a82d4781
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
+8
-4
bootstrap.go
pkg/cluster/bootstrap.go
+8
-4
No files found.
pkg/cluster/bootstrap.go
View file @
7f271e4e
...
...
@@ -4,11 +4,11 @@ import (
"bytes"
"context"
"encoding/json"
"errors"
"os"
"path/filepath"
"reflect"
"github.com/pkg/errors"
"github.com/rancher/k3s/pkg/bootstrap"
"github.com/rancher/k3s/pkg/clientaccess"
"github.com/rancher/k3s/pkg/daemons/config"
...
...
@@ -138,7 +138,7 @@ func (c *Cluster) bootstrap(ctx context.Context) error {
if
c
.
runtime
.
HTTPBootstrap
{
// Assuming we should just compare on managed databases
if
err
:=
c
.
compareConfig
();
err
!=
nil
{
return
err
return
err
ors
.
Wrap
(
err
,
"failed to validate server configuration"
)
}
return
c
.
httpBootstrap
()
}
...
...
@@ -165,7 +165,11 @@ func (c *Cluster) Snapshot(ctx context.Context, config *config.Control) error {
// compareConfig verifies that the config of the joining control plane node coincides with the cluster's config
func
(
c
*
Cluster
)
compareConfig
()
error
{
agentClientAccessInfo
,
err
:=
clientaccess
.
ParseAndValidateTokenForUser
(
c
.
config
.
JoinURL
,
c
.
config
.
AgentToken
,
"node"
)
token
:=
c
.
config
.
AgentToken
if
token
==
""
{
token
=
c
.
config
.
Token
}
agentClientAccessInfo
,
err
:=
clientaccess
.
ParseAndValidateTokenForUser
(
c
.
config
.
JoinURL
,
token
,
"node"
)
if
err
!=
nil
{
return
err
}
...
...
@@ -186,7 +190,7 @@ func (c *Cluster) compareConfig() error {
if
!
reflect
.
DeepEqual
(
clusterControl
.
CriticalControlArgs
,
c
.
config
.
CriticalControlArgs
)
{
logrus
.
Debugf
(
"This is the server CriticalControlArgs: %#v"
,
clusterControl
.
CriticalControlArgs
)
logrus
.
Debugf
(
"This is the local CriticalControlArgs: %#v"
,
c
.
config
.
CriticalControlArgs
)
return
errors
.
New
(
"
Unable to join cluster due to
critical configuration value mismatch"
)
return
errors
.
New
(
"critical configuration value mismatch"
)
}
return
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