Skip to content

Commit

Permalink
Add apis for archiver manifest recovery (#1387)
Browse files Browse the repository at this point in the history
Signed-off-by: Anisur Rahman <[email protected]>
  • Loading branch information
anisurrahman75 authored Jan 27, 2025
1 parent 85c4437 commit 7f9ee3e
Show file tree
Hide file tree
Showing 14 changed files with 233 additions and 6 deletions.
43 changes: 43 additions & 0 deletions apis/archiver/v1alpha1/mssqlserverarchiver_helpers.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
Copyright AppsCode Inc. and Contributors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package v1alpha1

import (
api "kubedb.dev/apimachinery/apis/kubedb/v1"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

var _ Accessor = &MSSQLServerArchiver{}

func (m *MSSQLServerArchiver) GetObjectMeta() metav1.ObjectMeta {
return m.ObjectMeta
}

func (m *MSSQLServerArchiver) GetConsumers() *api.AllowedConsumers {
return m.Spec.Databases
}

var _ ListAccessor = MSSQLServerArchiverList{}

func (l MSSQLServerArchiverList) GetItems() []Accessor {
var accessors []Accessor
for _, item := range l.Items {
accessors = append(accessors, &item)
}
return accessors
}
2 changes: 1 addition & 1 deletion apis/archiver/v1alpha1/mssqlserverarchiver_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ limitations under the License.
package v1alpha1

import (
dbapi "kubedb.dev/apimachinery/apis/kubedb/v1alpha2"
dbapi "kubedb.dev/apimachinery/apis/kubedb/v1"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
kmapi "kmodules.xyz/client-go/api/v1"
Expand Down
4 changes: 2 additions & 2 deletions apis/archiver/v1alpha1/openapi_generated.go

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

3 changes: 1 addition & 2 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.

36 changes: 35 additions & 1 deletion apis/kubedb/v1/openapi_generated.go

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

15 changes: 15 additions & 0 deletions apis/kubedb/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,4 +237,19 @@ 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"`
}
31 changes: 31 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.

15 changes: 15 additions & 0 deletions crds/kubedb.com_elasticsearches.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,21 @@ spec:
required:
- name
type: object
manifestOptions:
properties:
archiver:
default: false
type: boolean
archiverRef:
properties:
name:
type: string
namespace:
type: string
required:
- name
type: object
type: object
manifestRepository:
properties:
name:
Expand Down
15 changes: 15 additions & 0 deletions crds/kubedb.com_mariadbs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,21 @@ spec:
required:
- name
type: object
manifestOptions:
properties:
archiver:
default: false
type: boolean
archiverRef:
properties:
name:
type: string
namespace:
type: string
required:
- name
type: object
type: object
manifestRepository:
properties:
name:
Expand Down
15 changes: 15 additions & 0 deletions crds/kubedb.com_mongodbs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6474,6 +6474,21 @@ spec:
required:
- name
type: object
manifestOptions:
properties:
archiver:
default: false
type: boolean
archiverRef:
properties:
name:
type: string
namespace:
type: string
required:
- name
type: object
type: object
manifestRepository:
properties:
name:
Expand Down
15 changes: 15 additions & 0 deletions crds/kubedb.com_mysqls.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,21 @@ spec:
required:
- name
type: object
manifestOptions:
properties:
archiver:
default: false
type: boolean
archiverRef:
properties:
name:
type: string
namespace:
type: string
required:
- name
type: object
type: object
manifestRepository:
properties:
name:
Expand Down
15 changes: 15 additions & 0 deletions crds/kubedb.com_perconaxtradbs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,21 @@ spec:
required:
- name
type: object
manifestOptions:
properties:
archiver:
default: false
type: boolean
archiverRef:
properties:
name:
type: string
namespace:
type: string
required:
- name
type: object
type: object
manifestRepository:
properties:
name:
Expand Down
15 changes: 15 additions & 0 deletions crds/kubedb.com_postgreses.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,21 @@ spec:
required:
- name
type: object
manifestOptions:
properties:
archiver:
default: false
type: boolean
archiverRef:
properties:
name:
type: string
namespace:
type: string
required:
- name
type: object
type: object
manifestRepository:
properties:
name:
Expand Down
15 changes: 15 additions & 0 deletions crds/kubedb.com_redises.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,21 @@ spec:
required:
- name
type: object
manifestOptions:
properties:
archiver:
default: false
type: boolean
archiverRef:
properties:
name:
type: string
namespace:
type: string
required:
- name
type: object
type: object
manifestRepository:
properties:
name:
Expand Down

0 comments on commit 7f9ee3e

Please sign in to comment.