Browse Source

add retention default and wire in s3 prune

Signed-off-by: Brian Downs <brian.downs@gmail.com>
pull/3340/head
Brian Downs 4 years ago
parent
commit
254b52077e
  1. 2
      pkg/cli/cmds/etcd_snapshot.go
  2. 2
      pkg/cli/cmds/server.go
  3. 8
      pkg/etcd/etcd.go

2
pkg/cli/cmds/etcd_snapshot.go

@ -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,
}),

2
pkg/cli/cmds/server.go

@ -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,
},

8
pkg/etcd/etcd.go

@ -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…
Cancel
Save