Skip to content

Commit 1d10e5e

Browse files
author
Milla Samuel
committed
add backupVersion to restore spec
1 parent ae527ce commit 1d10e5e

File tree

9 files changed

+16
-1
lines changed

9 files changed

+16
-1
lines changed

api/v1beta2/foundationdbrestore_types.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ type FoundationDBRestoreSpec struct {
6565
// The path to the encryption key used to encrypt the backup.
6666
// +kubebuilder:validation:MaxLength=4096
6767
EncryptionKeyPath string `json:"encryptionKeyPath,omitempty"`
68+
69+
// Instead of the latest version the backup can be restored to, restore to BackupVersion.
70+
BackupVersion string `json:"backupVersion,omitempty"`
6871
}
6972

7073
// FoundationDBRestoreStatus describes the current status of the restore for a cluster.

config/crd/bases/apps.foundationdb.org_foundationdbrestores.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ spec:
3636
type: object
3737
spec:
3838
properties:
39+
backupVersion:
40+
type: string
3941
blobStoreConfiguration:
4042
properties:
4143
accountName:

controllers/admin_client_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,7 @@ var _ = Describe("admin_client_test", func() {
357357
"blobstore://test@test-service/test-backup",
358358
nil,
359359
"",
360+
"",
360361
),
361362
).To(Succeed())
362363

controllers/start_restore.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ func (s startRestore) reconcile(
5656
restore.BackupURL(),
5757
restore.Spec.KeyRanges,
5858
restore.Spec.EncryptionKeyPath,
59+
restore.Spec.BackupVersion,
5960
)
6061
if err != nil {
6162
return &requeue{curError: err}

docs/restore_spec.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ FoundationDBRestoreSpec describes the desired state of the backup for a cluster.
5656
| blobStoreConfiguration | This is the configuration of the target blobstore for this backup. | *BlobStoreConfiguration | false |
5757
| customParameters | CustomParameters defines additional parameters to pass to the backup agents. | FoundationDBCustomParameters | false |
5858
| encryptionKeyPath | The path to the encryption key used to encrypt the backup. | string | false |
59+
| backupVersion | Instead of the latest version the backup can be restored to, restore to BackupVersion. | string | false |
5960

6061
[Back to TOC](#table-of-contents)
6162

fdbclient/admin_client.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -918,6 +918,7 @@ func (client *cliAdminClient) StartRestore(
918918
url string,
919919
keyRanges []fdbv1beta2.FoundationDBKeyRange,
920920
encryptionKeyPath string,
921+
backupVersion string,
921922
) error {
922923
args := []string{
923924
"start",
@@ -934,6 +935,10 @@ func (client *cliAdminClient) StartRestore(
934935
args = append(args, "--encryption-key-file", encryptionKeyPath)
935936
}
936937

938+
if backupVersion != "" {
939+
args = append(args, "-v", backupVersion)
940+
}
941+
937942
if keyRanges != nil {
938943
keyRangeString := ""
939944
for _, keyRange := range keyRanges {

fdbclient/admin_client_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1047,7 +1047,7 @@ protocol fdb00b071010000`,
10471047

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

1050-
err := client.StartRestore(url, keyRanges, encryptionKeyPath)
1050+
err := client.StartRestore(url, keyRanges, encryptionKeyPath, "mock-versionstamp")
10511051
Expect(err).NotTo(HaveOccurred())
10521052

10531053
Expect(mockRunner.receivedArgs[0]).To(ContainElements(

pkg/fdbadminclient/admin_client.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ type AdminClient interface {
9292
url string,
9393
keyRanges []fdbv1beta2.FoundationDBKeyRange,
9494
encyptionKeyPath string,
95+
backupVersion string,
9596
) error
9697

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

pkg/fdbadminclient/mock/admin_client_mock.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -969,6 +969,7 @@ func (client *AdminClient) StartRestore(
969969
url string,
970970
_ []fdbv1beta2.FoundationDBKeyRange,
971971
_ string,
972+
_ string,
972973
) error {
973974
adminClientMutex.Lock()
974975
defer adminClientMutex.Unlock()

0 commit comments

Comments
 (0)