Commit 9fc75e74 authored by Ian Cardoso's avatar Ian Cardoso Committed by Brad Davidson

fix for etcd-snapshot delete with --etcd-s3 flag (#8110)

k3s etcd-snapshot save --etcd-s3 ... is creating a local snapshot and uploading it to s3 while k3s etcd-snapshot delete --etcd-s3 ... was deleting the snapshot only on s3 buckets, this commit change the behavior of delete to do it locally and on s3 Signed-off-by: 's avatarIan Cardoso <osodracnai@gmail.com> (cherry picked from commit e551308d)
parent 2adec135
...@@ -1704,6 +1704,7 @@ func (e *ETCD) DeleteSnapshots(ctx context.Context, snapshots []string) error { ...@@ -1704,6 +1704,7 @@ func (e *ETCD) DeleteSnapshots(ctx context.Context, snapshots []string) error {
} }
}() }()
err = func() error {
for { for {
select { select {
case <-ctx.Done(): case <-ctx.Done():
...@@ -1720,6 +1721,10 @@ func (e *ETCD) DeleteSnapshots(ctx context.Context, snapshots []string) error { ...@@ -1720,6 +1721,10 @@ func (e *ETCD) DeleteSnapshots(ctx context.Context, snapshots []string) error {
} }
} }
} }
}()
if err != nil {
return err
}
} }
logrus.Info("Removing the given locally stored etcd snapshot(s)") logrus.Info("Removing the given locally stored etcd snapshot(s)")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment