Skip to content

Commit

Permalink
Add InitScript restore option into manifest restore (#1388)
Browse files Browse the repository at this point in the history
Signed-off-by: Anisur Rahman <[email protected]>
  • Loading branch information
anisurrahman75 authored Jan 30, 2025
1 parent e37dc98 commit f435670
Show file tree
Hide file tree
Showing 114 changed files with 7,305 additions and 2,010 deletions.
3 changes: 2 additions & 1 deletion apis/archiver/v1alpha1/mariadbarchiver_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
kmapi "kmodules.xyz/client-go/api/v1"
storageapi "kubestash.dev/apimachinery/apis/storage/v1alpha1"
)

const (
Expand Down Expand Up @@ -72,7 +73,7 @@ type MariaDBArchiverSpec struct {
BackupStorage *BackupStorage `json:"backupStorage"`
// DeletionPolicy defines the DeletionPolicy for the backup repository
// +optional
DeletionPolicy *DeletionPolicy `json:"deletionPolicy"`
DeletionPolicy *storageapi.BackupConfigDeletionPolicy `json:"deletionPolicy"`
}

// MariaDBArchiverStatus defines the observed state of MariaDBArchiver
Expand Down
3 changes: 2 additions & 1 deletion apis/archiver/v1alpha1/mongodbarchiver_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
kmapi "kmodules.xyz/client-go/api/v1"
storageapi "kubestash.dev/apimachinery/apis/storage/v1alpha1"
)

const (
Expand Down Expand Up @@ -72,7 +73,7 @@ type MongoDBArchiverSpec struct {
BackupStorage *BackupStorage `json:"backupStorage"`
// DeletionPolicy defines the created repository's deletionPolicy
// +optional
DeletionPolicy *DeletionPolicy `json:"deletionPolicy"`
DeletionPolicy *storageapi.BackupConfigDeletionPolicy `json:"deletionPolicy"`
}

// MongoDBArchiverStatus defines the observed state of MongoDBArchiver
Expand Down
3 changes: 2 additions & 1 deletion apis/archiver/v1alpha1/mssqlserverarchiver_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
kmapi "kmodules.xyz/client-go/api/v1"
storageapi "kubestash.dev/apimachinery/apis/storage/v1alpha1"
)

const (
Expand Down Expand Up @@ -72,7 +73,7 @@ type MSSQLServerArchiverSpec struct {
BackupStorage *BackupStorage `json:"backupStorage"`
// DeletionPolicy defines the created repository's deletionPolicy
// +optional
DeletionPolicy *DeletionPolicy `json:"deletionPolicy"`
DeletionPolicy *storageapi.BackupConfigDeletionPolicy `json:"deletionPolicy"`
}

// MSSQLServerArchiverStatus defines the observed state of MSSQLServerArchiver
Expand Down
3 changes: 2 additions & 1 deletion apis/archiver/v1alpha1/mysqlarchiver_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
kmapi "kmodules.xyz/client-go/api/v1"
storageapi "kubestash.dev/apimachinery/apis/storage/v1alpha1"
)

const (
Expand Down Expand Up @@ -72,7 +73,7 @@ type MySQLArchiverSpec struct {
BackupStorage *BackupStorage `json:"backupStorage"`
// DeletionPolicy defines the created repository's deletionPolicy
// +optional
DeletionPolicy *DeletionPolicy `json:"deletionPolicy"`
DeletionPolicy *storageapi.BackupConfigDeletionPolicy `json:"deletionPolicy"`
}

// MySQLArchiverStatus defines the observed state of MySQLArchiver
Expand Down
3 changes: 2 additions & 1 deletion apis/archiver/v1alpha1/postgresarchiver_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
kmapi "kmodules.xyz/client-go/api/v1"
storageapi "kubestash.dev/apimachinery/apis/storage/v1alpha1"
)

const (
Expand Down Expand Up @@ -72,7 +73,7 @@ type PostgresArchiverSpec struct {
BackupStorage *BackupStorage `json:"backupStorage"`
// DeletionPolicy defines the created repository's deletionPolicy
// +optional
DeletionPolicy *DeletionPolicy `json:"deletionPolicy"`
DeletionPolicy *storageapi.BackupConfigDeletionPolicy `json:"deletionPolicy"`
}

// PostgresArchiverStatus defines the observed state of PostgresArchiver
Expand Down
10 changes: 0 additions & 10 deletions apis/archiver/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,16 +101,6 @@ type BackupStorage struct {
SubDir string `json:"subDir,omitempty"`
}

// +kubebuilder:validation:Enum=Delete;WipeOut;DoNotDelete
type DeletionPolicy string

const (
// Deletes archiver, removes the backup jobs and walg sidecar containers, but keeps the backup data
DeletionPolicyDelete DeletionPolicy = "Delete"
// Deletes everything including the backup data
DeletionPolicyWipeOut DeletionPolicy = "WipeOut"
)

type SchedulerOptions struct {
Schedule string `json:"schedule"`
// +optional
Expand Down
11 changes: 6 additions & 5 deletions apis/archiver/v1alpha1/zz_generated.deepcopy.go

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

7 changes: 7 additions & 0 deletions apis/kubedb/v1/openapi_generated.go

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

5 changes: 5 additions & 0 deletions apis/kubedb/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,4 +252,9 @@ type ManifestOptions struct {
// ArchiverRef specifies the new name and namespace of the Archiver yaml after restore
// +optional
ArchiverRef *kmapi.ObjectReference `json:"archiverRef,omitempty"`

// InitScript specifies whether to restore the InitScript or not
// +kubebuilder:default=false
// +optional
InitScript *bool `json:"initScript,omitempty"`
}
5 changes: 5 additions & 0 deletions apis/kubedb/v1/zz_generated.deepcopy.go

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

43 changes: 42 additions & 1 deletion apis/kubedb/v1alpha2/openapi_generated.go

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

20 changes: 20 additions & 0 deletions apis/kubedb/v1alpha2/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,26 @@ type ArchiverRecovery struct {
// FullDBRepository means db restore + manifest restore
FullDBRepository *kmapi.ObjectReference `json:"fullDBRepository,omitempty"`
ReplicationStrategy *PITRReplicationStrategy `json:"replicationStrategy,omitempty"`

// ManifestOptions provide options to select particular manifest object to restore
// +optional
ManifestOptions *ManifestOptions `json:"manifestOptions,omitempty"`
}

type ManifestOptions struct {
// Archiver specifies whether to restore the Archiver manifest or not
// +kubebuilder:default=false
// +optional
Archiver *bool `json:"archiver,omitempty"`

// ArchiverRef specifies the new name and namespace of the Archiver yaml after restore
// +optional
ArchiverRef *kmapi.ObjectReference `json:"archiverRef,omitempty"`

// InitScript specifies whether to restore the InitScript or not
// +kubebuilder:default=false
// +optional
InitScript *bool `json:"initScript,omitempty"`
}

type ArbiterSpec struct {
Expand Down
36 changes: 36 additions & 0 deletions apis/kubedb/v1alpha2/zz_generated.deepcopy.go

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

2 changes: 1 addition & 1 deletion crds/archiver.kubedb.com_mariadbarchivers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ spec:
enum:
- Delete
- WipeOut
- DoNotDelete
- Retain
type: string
encryptionSecret:
properties:
Expand Down
2 changes: 1 addition & 1 deletion crds/archiver.kubedb.com_mongodbarchivers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ spec:
enum:
- Delete
- WipeOut
- DoNotDelete
- Retain
type: string
encryptionSecret:
properties:
Expand Down
2 changes: 1 addition & 1 deletion crds/archiver.kubedb.com_mssqlserverarchivers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ spec:
enum:
- Delete
- WipeOut
- DoNotDelete
- Retain
type: string
encryptionSecret:
properties:
Expand Down
2 changes: 1 addition & 1 deletion crds/archiver.kubedb.com_mysqlarchivers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ spec:
enum:
- Delete
- WipeOut
- DoNotDelete
- Retain
type: string
encryptionSecret:
properties:
Expand Down
2 changes: 1 addition & 1 deletion crds/archiver.kubedb.com_postgresarchivers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ spec:
enum:
- Delete
- WipeOut
- DoNotDelete
- Retain
type: string
encryptionSecret:
properties:
Expand Down
Loading

0 comments on commit f435670

Please sign in to comment.