Commit 254b5207 authored by Brian Downs's avatar Brian Downs

add retention default and wire in s3 prune

parent 7e175e8a
...@@ -122,7 +122,7 @@ func NewEtcdSnapshotSubcommands(delete, list, prune, save func(ctx *cli.Context) ...@@ -122,7 +122,7 @@ func NewEtcdSnapshotSubcommands(delete, list, prune, save func(ctx *cli.Context)
Action: prune, Action: prune,
Flags: append(EtcdSnapshotFlags, &cli.IntFlag{ Flags: append(EtcdSnapshotFlags, &cli.IntFlag{
Name: "snapshot-retention", Name: "snapshot-retention",
Usage: "(db) Number of snapshots to retain", Usage: "(db) Number of snapshots to retain. Default: 5",
Destination: &ServerConfig.EtcdSnapshotRetention, Destination: &ServerConfig.EtcdSnapshotRetention,
Value: defaultSnapshotRentention, Value: defaultSnapshotRentention,
}), }),
......
...@@ -252,7 +252,7 @@ func NewServerCommand(action func(*cli.Context) error) cli.Command { ...@@ -252,7 +252,7 @@ func NewServerCommand(action func(*cli.Context) error) cli.Command {
}, },
&cli.IntFlag{ &cli.IntFlag{
Name: "etcd-snapshot-retention", Name: "etcd-snapshot-retention",
Usage: "(db) Number of snapshots to retain", Usage: "(db) Number of snapshots to retain Default: 5",
Destination: &ServerConfig.EtcdSnapshotRetention, Destination: &ServerConfig.EtcdSnapshotRetention,
Value: defaultSnapshotRentention, Value: defaultSnapshotRentention,
}, },
......
...@@ -978,6 +978,14 @@ func (e *ETCD) PruneSnapshots(ctx context.Context) error { ...@@ -978,6 +978,14 @@ func (e *ETCD) PruneSnapshots(ctx context.Context) error {
return errors.Wrap(err, "failed to get the snapshot dir") 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) return snapshotRetention(e.config.EtcdSnapshotRetention, snapshotDir)
} }
......
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