Add ability to perform an etcd on-demand snapshot via cli (#2819)

* add ability to perform an etcd on-demand snapshot via cli

(cherry picked from commit 13229019f8)
Signed-off-by: Brian Downs <brian.downs@gmail.com>
This commit is contained in:
Brian Downs
2021-01-21 14:09:15 -07:00
parent 64017c5272
commit ca55efaa8e
15 changed files with 204 additions and 25 deletions

View File

@@ -64,6 +64,7 @@ type Server struct {
ClusterResetRestorePath string
EncryptSecrets bool
StartupHooks []func(context.Context, <-chan struct{}, string) error
EtcdSnapshotName string
EtcdDisableSnapshots bool
EtcdSnapshotDir string
EtcdSnapshotCron string
@@ -220,6 +221,12 @@ func NewServerCommand(action func(*cli.Context) error) cli.Command {
Usage: "(db) Disable automatic etcd snapshots",
Destination: &ServerConfig.EtcdDisableSnapshots,
},
&cli.StringFlag{
Name: "etcd-snapshot-name",
Usage: "(db) Set the base name of etcd snapshots. Default: etcd-snapshot-<unix-timestamp>",
Destination: &ServerConfig.EtcdSnapshotName,
Value: "etcd-snapshot",
},
&cli.StringFlag{
Name: "etcd-snapshot-schedule-cron",
Usage: "(db) Snapshot interval time in cron spec. eg. every 5 hours '* */5 * * *'",