Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EVEVERST-614 Restore-from-pitr #253

Merged
merged 3 commits into from
Jan 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions controllers/databaseclusterrestore_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,14 @@ func (r *DatabaseClusterRestoreReconciler) restorePSMDB(
return fmt.Errorf("unsupported backup storage type %s for %s", backupStorage.Spec.Type, backupStorage.Name)
}
}

if restore.Spec.DataSource.PITR != nil {
psmdbCR.Spec.PITR = &psmdbv1.PITRestoreSpec{
Type: psmdbv1.PITRestoreType(restore.Spec.DataSource.PITR.Type),
Date: &psmdbv1.PITRestoreDate{Time: restore.Spec.DataSource.PITR.Date.Time},
}
}

return nil
})
if err != nil {
Expand Down
1 change: 0 additions & 1 deletion e2e-tests/tests/features/dbbackup_psmdb/40-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ spec:
enabled: true
pitr:
enabled: true
backupStorageName: test-storage
uploadIntervalSec: 120
status:
activeStorage: test-storage
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ spec:
enabled: true
pitr:
enabled: true
backupStorageName: test-storage
uploadIntervalSec: 120
schedules:
- name: daily-backup
Expand Down
14 changes: 14 additions & 0 deletions e2e-tests/tests/features/dbbackup_psmdb/41-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: kuttl.dev/v1
kind: TestAssert
timeout: 1000000
---
apiVersion: psmdb.percona.com/v1
kind: PerconaServerMongoDBRestore
metadata:
name: test-db-restore
spec:
backupName: test-db-backup-pitr
clusterName: test-psmdb-cluster
pitr:
date: "2023-12-06 14:24:42"
type: date
23 changes: 23 additions & 0 deletions e2e-tests/tests/features/dbbackup_psmdb/41-restore-pitr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
apiVersion: kuttl.dev/v1
kind: TestStep
---
apiVersion: everest.percona.com/v1alpha1
kind: DatabaseClusterBackup
metadata:
name: test-db-backup-pitr
spec:
backupStorageName: test-storage
dbClusterName: test-psmdb-cluster
---
apiVersion: everest.percona.com/v1alpha1
kind: DatabaseClusterRestore
metadata:
name: test-db-restore
spec:
dataSource:
dbClusterBackupName: test-db-backup-pitr
pitr:
date: "2023-12-06T14:24:42Z"
type: date
dbClusterName: test-psmdb-cluster

9 changes: 9 additions & 0 deletions e2e-tests/tests/features/dbbackup_psmdb/71-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: kuttl.dev/v1
kind: TestAssert
timeout: 20
commands:
# check that there is no dbr/psmdb-restore CRs left
- script: >
test "$(kubectl get dbr -n $NAMESPACE -o jsonpath='{.items}')" = "[]"
- script: >
test "$(kubectl get psmdb-restore -n $NAMESPACE -o jsonpath='{.items}')" = "[]"
14 changes: 14 additions & 0 deletions e2e-tests/tests/features/dbbackup_psmdb/71-delete-restores.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: kuttl.dev/v1
kind: TestStep
timeout: 10
delete:
- apiVersion: psmdb.percona.com/v1
kind: PerconaServerMongoDBRestore
name: test-db-restore
- apiVersion: everest.percona.com/v1alpha1
kind: DatabaseClusterRestore
name: test-db-restore
- apiVersion: everest.percona.com/v1alpha1
kind: DatabaseClusterBackup
name: test-db-backup-pitr