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
7e6778ef
Commit
7e6778ef
authored
May 05, 2021
by
Brian Downs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove unnecessary code
Signed-off-by:
Brian Downs
<
brian.downs@gmail.com
>
parent
49073cd2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
15 deletions
+10
-15
etcd.go
pkg/etcd/etcd.go
+10
-15
No files found.
pkg/etcd/etcd.go
View file @
7e6778ef
...
...
@@ -979,19 +979,16 @@ func (e *ETCD) DeleteSnapshots(ctx context.Context, snapshots []string) error {
}
if
e
.
config
.
EtcdS3
{
logrus
.
Info
(
"Removing the given etcd snapshot from S3"
)
logrus
.
Info
(
"Removing the given etcd snapshot
(s)
from S3"
)
logrus
.
Debugf
(
"Removing the given etcd snapshot from S3: %v"
,
snapshots
)
if
e
.
initS3IfNil
(
ctx
);
err
!=
nil
{
return
err
}
if
len
(
snapshots
)
>
1
{
logrus
.
Info
(
"Removing the given etcd snapshot(s) from S3"
)
objectsCh
:=
make
(
chan
minio
.
ObjectInfo
)
toCtx
,
cancel
:=
context
.
WithTimeout
(
ctx
,
time
.
Second
*
30
)
toCtx
,
cancel
:=
context
.
WithTimeout
(
ctx
,
defaultS3OpTimeout
)
defer
cancel
()
go
func
(
ctx
context
.
Context
)
{
...
...
@@ -1002,7 +999,11 @@ func (e *ETCD) DeleteSnapshots(ctx context.Context, snapshots []string) error {
case
<-
ctx
.
Done
()
:
return
default
:
for
obj
:=
range
e
.
s3
.
client
.
ListObjects
(
ctx
,
e
.
config
.
EtcdS3BucketName
,
minio
.
ListObjectsOptions
{})
{
opts
:=
minio
.
ListObjectsOptions
{
Recursive
:
true
,
}
for
obj
:=
range
e
.
s3
.
client
.
ListObjects
(
ctx
,
e
.
config
.
EtcdS3BucketName
,
opts
)
{
if
obj
.
Err
!=
nil
{
logrus
.
Error
(
obj
.
Err
)
continue
...
...
@@ -1012,25 +1013,19 @@ func (e *ETCD) DeleteSnapshots(ctx context.Context, snapshots []string) error {
// add them to the channel for remove if they're
// actually found from the bucket listing.
for
_
,
snapshot
:=
range
snapshots
{
logrus
.
Warnf
(
"snapshot: %s - obj.Key: %s
\n
"
,
snapshot
,
obj
.
Key
)
if
snapshot
==
obj
.
Key
{
objectsCh
<-
obj
}
}
}
return
}
}
}(
toCtx
)
for
roErr
:=
range
e
.
s3
.
client
.
RemoveObjects
(
ctx
,
e
.
config
.
EtcdS3BucketName
,
objectsCh
,
minio
.
RemoveObjectsOptions
{})
{
logrus
.
Errorf
(
"Error detected during deletion: %v"
,
roErr
)
}
return
e
.
StoreSnapshotData
(
ctx
)
}
if
err
=
e
.
s3
.
client
.
RemoveObject
(
ctx
,
e
.
config
.
EtcdS3BucketName
,
snapshots
[
0
],
minio
.
RemoveObjectOptions
{});
err
!=
nil
{
return
errors
.
Wrap
(
err
,
"error detected during deletion"
)
logrus
.
Errorf
(
"Unable to delete snapshot: %v"
,
roErr
)
}
return
e
.
StoreSnapshotData
(
ctx
)
...
...
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