From 9f439506945da910bb92f733ba9ef2d578ef97d0 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Steenis Date: Thu, 6 Aug 2020 22:10:13 +0200 Subject: [PATCH] Fix restoring backups when custom certs are used This also includes a cherry-pick fix of the local-state-flag for etcd snapshot-restore --- cmd/etcd.go | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/cmd/etcd.go b/cmd/etcd.go index a2592c017..f36fcf493 100644 --- a/cmd/etcd.go +++ b/cmd/etcd.go @@ -65,7 +65,23 @@ func EtcdCommand() cli.Command { Usage: "Specify s3 folder name", }, } - snapshotFlags = append(snapshotFlags, commonFlags...) + snapshotSaveFlags := append(snapshotFlags, commonFlags...) + + snapshotRestoreFlags := []cli.Flag{ + cli.StringFlag{ + Name: "cert-dir", + Usage: "Specify a certificate dir path", + }, + cli.BoolFlag{ + Name: "custom-certs", + Usage: "Use custom certificates from a cert dir", + }, + cli.BoolFlag{ + Name: "use-local-state", + Usage: "Use local state file (do not check or use snapshot archive for state file)", + }, + } + snapshotRestoreFlags = append(append(snapshotFlags, snapshotRestoreFlags...), commonFlags...) return cli.Command{ Name: "etcd", @@ -74,13 +90,13 @@ func EtcdCommand() cli.Command { { Name: "snapshot-save", Usage: "Take snapshot on all etcd hosts", - Flags: snapshotFlags, + Flags: snapshotSaveFlags, Action: SnapshotSaveEtcdHostsFromCli, }, { Name: "snapshot-restore", Usage: "Restore existing snapshot", - Flags: snapshotFlags, + Flags: snapshotRestoreFlags, Action: RestoreEtcdSnapshotFromCli, }, },