Skip to content

Commit

Permalink
Add support for restoring redis backups
Browse files Browse the repository at this point in the history
Signed-off-by: Nicolas Bigler <[email protected]>
  • Loading branch information
TheBigLee committed Jul 18, 2023
1 parent af99cb9 commit 8e8c8a9
Show file tree
Hide file tree
Showing 14 changed files with 920 additions and 0 deletions.
11 changes: 11 additions & 0 deletions apis/vshn/v1/common_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,17 @@ type K8upRetentionPolicy struct {
KeepYearly int `json:"keepYearly,omitempty"`
}

// K8upRestoreSpec contains restore specific parameters.
type K8upRestoreSpec struct {

// ClaimName specifies the name of the instance you want to restore from.
// The claim has to be in the same namespace as this new instance.
ClaimName string `json:"claimName,omitempty"`

// BackupName is the name of the specific backup you want to restore.
BackupName string `json:"backupName,omitempty"`
}

// VSHNDBaaSMaintenanceScheduleSpec contains settings to control the maintenance of an instance.
type VSHNDBaaSMaintenanceScheduleSpec struct {
// +kubebuilder:validation:Enum=monday;tuesday;wednesday;thursday;friday;saturday;sunday
Expand Down
3 changes: 3 additions & 0 deletions apis/vshn/v1/dbaas_vshn_redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ type VSHNRedisParameters struct {
// Backup contains settings to control how the instance should get backed up.
Backup K8upBackupSpec `json:"backup,omitempty"`

// Restore contains settings to control the restore of an instance.
Restore K8upRestoreSpec `json:"restore,omitempty"`

// Maintenance contains settings to control the maintenance of an instance.
Maintenance VSHNDBaaSMaintenanceScheduleSpec `json:"maintenance,omitempty"`
}
Expand Down
16 changes: 16 additions & 0 deletions apis/vshn/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions cmd/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ var images = map[string][]runtime.Transform{
Name: "backup",
TransformFunc: vshnredis.AddBackup,
},
{
Name: "restore",
TransformFunc: vshnredis.RestoreBackup,
},
{
Name: "maintenance",
TransformFunc: vshnredis.AddMaintenanceJob,
Expand Down
10 changes: 10 additions & 0 deletions crds/vshn.appcat.vshn.io_vshnredis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,16 @@ spec:
pattern: ^([0-1]?[0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])$
type: string
type: object
restore:
description: Restore contains settings to control the restore of an instance.
properties:
backupName:
description: BackupName is the name of the specific backup you want to restore.
type: string
claimName:
description: ClaimName specifies the name of the instance you want to restore from. The claim has to be in the same namespace as this new instance.
type: string
type: object
scheduling:
description: Scheduling contains settings to control the scheduling of an instance.
properties:
Expand Down
Loading

0 comments on commit 8e8c8a9

Please sign in to comment.