Skip to content

Commit 31e4525

Browse files
author
Milla Samuel
committed
pass entire restore spec
1 parent 84185ad commit 31e4525

File tree

6 files changed

+23
-20
lines changed

6 files changed

+23
-20
lines changed

controllers/admin_client_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -355,10 +355,10 @@ var _ = Describe("admin_client_test", func() {
355355
Expect(
356356
mockAdminClient.StartRestore(
357357
"blobstore://test@test-service/test-backup",
358-
fdbv1beta2.FoundationDBRestoreSpec{
359-
DestinationClusterName: cluster.Name},
360-
),
361-
).To(Succeed())
358+
fdbv1beta2.FoundationDBRestore{
359+
Spec: fdbv1beta2.FoundationDBRestoreSpec{
360+
DestinationClusterName: cluster.Name,
361+
}})).To(Succeed())
362362

363363
restoreStatus, err = mockAdminClient.GetRestoreStatus()
364364
Expect(err).NotTo(HaveOccurred())

controllers/start_restore.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ func (s startRestore) reconcile(
5454
if len(strings.TrimSpace(status)) == 0 {
5555
err = adminClient.StartRestore(
5656
restore.BackupURL(),
57-
restore.Spec,
57+
*restore,
5858
)
5959
if err != nil {
6060
return &requeue{curError: err}

fdbclient/admin_client.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -916,7 +916,7 @@ func (client *cliAdminClient) GetBackupStatus() (*fdbv1beta2.FoundationDBLiveBac
916916
// StartRestore starts a new restore.
917917
func (client *cliAdminClient) StartRestore(
918918
url string,
919-
fdbRestoreSpec fdbv1beta2.FoundationDBRestoreSpec,
919+
restore fdbv1beta2.FoundationDBRestore,
920920
) error {
921921
args := []string{
922922
"start",
@@ -929,17 +929,17 @@ func (client *cliAdminClient) StartRestore(
929929
return verErr
930930
}
931931

932-
if fdbRestoreSpec.EncryptionKeyPath != "" && fdbVersion.SupportsBackupEncryption() {
933-
args = append(args, "--encryption-key-file", fdbRestoreSpec.EncryptionKeyPath)
932+
if restore.Spec.EncryptionKeyPath != "" && fdbVersion.SupportsBackupEncryption() {
933+
args = append(args, "--encryption-key-file", restore.Spec.EncryptionKeyPath)
934934
}
935935

936-
if fdbRestoreSpec.BackupVersion != nil {
937-
args = append(args, "-v", strconv.FormatUint(*fdbRestoreSpec.BackupVersion, 10))
936+
if restore.Spec.BackupVersion != nil {
937+
args = append(args, "-v", strconv.FormatUint(*restore.Spec.BackupVersion, 10))
938938
}
939939

940-
if fdbRestoreSpec.KeyRanges != nil {
940+
if restore.Spec.KeyRanges != nil {
941941
keyRangeString := ""
942-
for _, keyRange := range fdbRestoreSpec.KeyRanges {
942+
for _, keyRange := range restore.Spec.KeyRanges {
943943
if keyRangeString != "" {
944944
keyRangeString += ";"
945945
}

fdbclient/admin_client_test.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,10 +1047,11 @@ protocol fdb00b071010000`,
10471047

10481048
url := "blobstore://test@test-service/test-backup"
10491049

1050-
err := client.StartRestore(url, fdbv1beta2.FoundationDBRestoreSpec{
1051-
KeyRanges: keyRanges,
1052-
EncryptionKeyPath: encryptionKeyPath,
1053-
})
1050+
err := client.StartRestore(url, fdbv1beta2.FoundationDBRestore{
1051+
Spec: fdbv1beta2.FoundationDBRestoreSpec{
1052+
KeyRanges: keyRanges,
1053+
EncryptionKeyPath: encryptionKeyPath,
1054+
}})
10541055
Expect(err).NotTo(HaveOccurred())
10551056

10561057
Expect(mockRunner.receivedArgs[0]).To(ContainElements(
@@ -1129,8 +1130,10 @@ protocol fdb00b071010000`,
11291130

11301131
url := "blobstore://test@test-service/test-backup"
11311132

1132-
err := client.StartRestore(url, fdbv1beta2.FoundationDBRestoreSpec{
1133-
BackupVersion: actualBackupVersion,
1133+
err := client.StartRestore(url, fdbv1beta2.FoundationDBRestore{
1134+
Spec: fdbv1beta2.FoundationDBRestoreSpec{
1135+
BackupVersion: actualBackupVersion,
1136+
},
11341137
})
11351138
Expect(err).NotTo(HaveOccurred())
11361139

pkg/fdbadminclient/admin_client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ type AdminClient interface {
9090
// StartRestore starts a new restore.
9191
StartRestore(
9292
url string,
93-
fdbRestoreSpec fdbv1beta2.FoundationDBRestoreSpec,
93+
fdbRestore fdbv1beta2.FoundationDBRestore,
9494
) error
9595

9696
// GetRestoreStatus gets the status of the current restore.

pkg/fdbadminclient/mock/admin_client_mock.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -967,7 +967,7 @@ func (client *AdminClient) GetBackupStatus() (*fdbv1beta2.FoundationDBLiveBackup
967967
// StartRestore starts a new restore.
968968
func (client *AdminClient) StartRestore(
969969
url string,
970-
_ fdbv1beta2.FoundationDBRestoreSpec,
970+
_ fdbv1beta2.FoundationDBRestore,
971971
) error {
972972
adminClientMutex.Lock()
973973
defer adminClientMutex.Unlock()

0 commit comments

Comments
 (0)