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
997ed7b9
Commit
997ed7b9
authored
Jul 21, 2021
by
galal-hussein
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
simplifying the code
Signed-off-by:
galal-hussein
<
hussein.galal.ahmed.11@gmail.com
>
parent
ad17292f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
7 deletions
+3
-7
storage.go
pkg/cluster/storage.go
+3
-7
No files found.
pkg/cluster/storage.go
View file @
997ed7b9
...
@@ -143,8 +143,7 @@ func (c *Cluster) getBootstrapKeyFromStorage(ctx context.Context, storageClient
...
@@ -143,8 +143,7 @@ func (c *Cluster) getBootstrapKeyFromStorage(ctx context.Context, storageClient
}
}
for
_
,
bootstrapKV
:=
range
bootstrapList
{
for
_
,
bootstrapKV
:=
range
bootstrapList
{
// checking for empty string bootstrap key
// checking for empty string bootstrap key
switch
string
(
bootstrapKV
.
Key
)
{
if
string
(
bootstrapKV
.
Key
)
==
tokenKey
{
case
tokenKey
:
return
&
bootstrapKV
,
nil
return
&
bootstrapKV
,
nil
}
}
}
}
...
@@ -189,7 +188,7 @@ func (c *Cluster) migrateEmptyStringToken(ctx context.Context, bootstrapList []c
...
@@ -189,7 +188,7 @@ func (c *Cluster) migrateEmptyStringToken(ctx context.Context, bootstrapList []c
// checking for empty string bootstrap key
// checking for empty string bootstrap key
if
string
(
bootstrapKV
.
Key
)
==
emptyStringKey
{
if
string
(
bootstrapKV
.
Key
)
==
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"
)
// mak
ing sure that the process is autonmous by decrypting and rencrypting the data first
// mak
e sure that the process is non-destructive by decrypting/re-encrypting/storing the data before deleting the old key
data
,
err
:=
decrypt
(
""
,
bootstrapKV
.
Data
)
data
,
err
:=
decrypt
(
""
,
bootstrapKV
.
Data
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
...
@@ -210,10 +209,7 @@ func (c *Cluster) migrateEmptyStringToken(ctx context.Context, bootstrapList []c
...
@@ -210,10 +209,7 @@ func (c *Cluster) migrateEmptyStringToken(ctx context.Context, bootstrapList []c
return
err
return
err
}
}
// deleting the empty string key
// deleting the empty string key
if
err
:=
storageClient
.
Delete
(
ctx
,
emptyStringKey
,
bootstrapKV
.
Modified
);
err
!=
nil
{
return
storageClient
.
Delete
(
ctx
,
emptyStringKey
,
bootstrapKV
.
Modified
)
return
err
}
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