Merge pull request #3340 from briandowns/issue-3278-2

add retention default and wire in s3 prune
pull/3346/head
Brian Downs 2021-05-18 16:18:04 -07:00 committed by GitHub
commit 5bf4d9f687
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 2 deletions

View File

@ -122,7 +122,7 @@ func NewEtcdSnapshotSubcommands(delete, list, prune, save func(ctx *cli.Context)
Action: prune,
Flags: append(EtcdSnapshotFlags, &cli.IntFlag{
Name: "snapshot-retention",
Usage: "(db) Number of snapshots to retain",
Usage: "(db) Number of snapshots to retain. Default: 5",
Destination: &ServerConfig.EtcdSnapshotRetention,
Value: defaultSnapshotRentention,
}),

View File

@ -252,7 +252,7 @@ func NewServerCommand(action func(*cli.Context) error) cli.Command {
},
&cli.IntFlag{
Name: "etcd-snapshot-retention",
Usage: "(db) Number of snapshots to retain",
Usage: "(db) Number of snapshots to retain Default: 5",
Destination: &ServerConfig.EtcdSnapshotRetention,
Value: defaultSnapshotRentention,
},

View File

@ -978,6 +978,14 @@ func (e *ETCD) PruneSnapshots(ctx context.Context) error {
return errors.Wrap(err, "failed to get the snapshot dir")
}
if e.config.EtcdS3 {
if e.initS3IfNil(ctx); err != nil {
return err
}
return e.s3.snapshotRetention(ctx)
}
return snapshotRetention(e.config.EtcdSnapshotRetention, snapshotDir)
}