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
a65e5b64
Commit
a65e5b64
authored
Jul 21, 2021
by
galal-hussein
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix multiple bootstrap keys found
Signed-off-by:
galal-hussein
<
hussein.galal.ahmed.11@gmail.com
>
parent
37fcb61f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
12 deletions
+13
-12
storage.go
pkg/cluster/storage.go
+13
-12
No files found.
pkg/cluster/storage.go
View file @
a65e5b64
...
@@ -132,20 +132,21 @@ func (c *Cluster) getBootstrapKeyFromStorage(ctx context.Context, storageClient
...
@@ -132,20 +132,21 @@ func (c *Cluster) getBootstrapKeyFromStorage(ctx context.Context, storageClient
return
nil
,
false
,
nil
return
nil
,
false
,
nil
}
}
if
len
(
bootstrapList
)
>
1
{
if
len
(
bootstrapList
)
>
1
{
return
nil
,
false
,
errors
.
New
(
"found multiple bootstrap keys in storage"
)
logrus
.
Warn
(
"found multiple bootstrap keys in storage"
)
}
}
bootstrapKV
:=
bootstrapList
[
0
]
for
_
,
bootstrapKV
:=
range
bootstrapList
{
// checking for empty string bootstrap key
// checking for empty string bootstrap key
switch
string
(
bootstrapKV
.
Key
)
{
switch
string
(
bootstrapKV
.
Key
)
{
case
emptyStringKey
:
case
emptyStringKey
:
logrus
.
Warn
(
"bootstrap data encrypted with empty string, deleting and resaving with token"
)
logrus
.
Warn
(
"bootstrap data encrypted with empty string, deleting and resaving with token"
)
c
.
saveBootstrap
=
true
c
.
saveBootstrap
=
true
if
err
:=
storageClient
.
Delete
(
ctx
,
emptyStringKey
,
bootstrapKV
.
Modified
);
err
!=
nil
{
if
err
:=
storageClient
.
Delete
(
ctx
,
emptyStringKey
,
bootstrapKV
.
Modified
);
err
!=
nil
{
return
nil
,
false
,
err
return
nil
,
false
,
err
}
return
&
bootstrapKV
,
true
,
nil
case
tokenKey
:
return
&
bootstrapKV
,
false
,
nil
}
}
return
&
bootstrapKV
,
true
,
nil
case
tokenKey
:
return
&
bootstrapKV
,
false
,
nil
}
}
return
nil
,
false
,
errors
.
New
(
"bootstrap data already found and encrypted with different token"
)
return
nil
,
false
,
errors
.
New
(
"bootstrap data already found and encrypted with different token"
)
...
...
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