mirror of https://github.com/k3s-io/k3s
Merge pull request #3340 from briandowns/issue-3278-2
add retention default and wire in s3 prunepull/3346/head
commit
5bf4d9f687
|
@ -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,
|
||||
}),
|
||||
|
|
|
@ -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,
|
||||
},
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue