Skip to content

Commit a84e728

Browse files
committed
Use etcd-snapshot-retention as default for s3 if etcd-s3-retention is not set
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
1 parent 3f5eec4 commit a84e728

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

pkg/cli/etcdsnapshot/etcd_snapshot.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,12 @@ func commandSetup(app *cli.Context, cfg *cmds.Server) (*etcd.SnapshotRequest, *c
4848
if app.IsSet("etcd-snapshot-retention") {
4949
sr.Retention = &cfg.EtcdSnapshotRetention
5050
}
51-
5251
if cfg.EtcdS3 {
52+
// set default s3 retention from local snapshot retention
53+
// preserves legacy behavior of local snapshot retention also affecting s3
54+
if !app.IsSet("etcd-s3-retention") && app.IsSet("etcd-snapshot-retention") {
55+
cfg.EtcdS3Retention = cfg.EtcdSnapshotRetention
56+
}
5357
sr.S3 = &config.EtcdS3{
5458
AccessKey: cfg.EtcdS3AccessKey,
5559
Bucket: cfg.EtcdS3BucketName,

pkg/cli/server/server.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,11 @@ func run(app *cli.Context, cfg *cmds.Server, leaderControllers server.CustomCont
213213
if cfg.EtcdS3Timeout <= 0 {
214214
return errors.New("etcd-s3-timeout must be greater than 0s")
215215
}
216+
// set default s3 retention from local snapshot retention
217+
// preserves legacy behavior of local snapshot retention also affecting s3
218+
if !app.IsSet("etcd-s3-retention") && app.IsSet("etcd-snapshot-retention") {
219+
cfg.EtcdS3Retention = cfg.EtcdSnapshotRetention
220+
}
216221
serverConfig.ControlConfig.EtcdS3 = &config.EtcdS3{
217222
AccessKey: cfg.EtcdS3AccessKey,
218223
Bucket: cfg.EtcdS3BucketName,

0 commit comments

Comments
 (0)