Skip to content

Commit

Permalink
Merge pull request #1957 from psliwka/fix-restoring-backups-when-cust…
Browse files Browse the repository at this point in the history
…om-certs-are-used

Fix restoring backups when custom certs are used
  • Loading branch information
superseb authored Jul 7, 2020
2 parents 8408218 + 1dc2db8 commit e2b5828
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions cmd/etcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,20 @@ 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",
},
}
snapshotRestoreFlags = append(append(snapshotFlags, snapshotRestoreFlags...), commonFlags...)

return cli.Command{
Name: "etcd",
Expand All @@ -74,13 +87,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,
},
},
Expand Down Expand Up @@ -275,6 +288,9 @@ func RestoreEtcdSnapshotFromCli(ctx *cli.Context) error {
}
// setting up the flags
flags := cluster.GetExternalFlags(false, false, false, "", filePath)
// Custom certificates and certificate dir flags
flags.CertificateDir = ctx.String("cert-dir")
flags.CustomCerts = ctx.Bool("custom-certs")

_, _, _, _, _, err = RestoreEtcdSnapshot(context.Background(), rkeConfig, hosts.DialersOptions{}, flags, map[string]interface{}{}, etcdSnapshotName)
return err
Expand Down

0 comments on commit e2b5828

Please sign in to comment.