No need for the Repository struct, a string is enough
This commit is contained in:
parent
0f65f114f6
commit
8303869dd2
@ -21,14 +21,6 @@ import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
|
||||
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
|
||||
|
||||
// Resource references a repsoitory where the backups will be stored
|
||||
type Repository struct {
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
type Step struct {
|
||||
Name string `json:"name"`
|
||||
Namespace string `json:"namespace"`
|
||||
@ -74,7 +66,7 @@ type BackupConfigurationSpec struct {
|
||||
// Important: Run "make" to regenerate code after modifying this file
|
||||
|
||||
// Foo is an example field of BackupConfiguration. Edit BackupConfiguration_types.go to remove/update
|
||||
Repository `json:"repository"`
|
||||
Repository string `json:"repository"`
|
||||
|
||||
// +optional
|
||||
Suspend *bool `json:"suspend,omitempty"`
|
||||
|
||||
@ -104,7 +104,6 @@ func (in *BackupConfigurationList) DeepCopyObject() runtime.Object {
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *BackupConfigurationSpec) DeepCopyInto(out *BackupConfigurationSpec) {
|
||||
*out = *in
|
||||
out.Repository = in.Repository
|
||||
if in.Suspend != nil {
|
||||
in, out := &in.Suspend, &out.Suspend
|
||||
*out = new(bool)
|
||||
@ -448,21 +447,6 @@ func (in *RepoStatus) DeepCopy() *RepoStatus {
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Repository) DeepCopyInto(out *Repository) {
|
||||
*out = *in
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Repository.
|
||||
func (in *Repository) DeepCopy() *Repository {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Repository)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *RestoreSession) DeepCopyInto(out *RestoreSession) {
|
||||
*out = *in
|
||||
|
||||
@ -171,7 +171,7 @@ func (r *BackupConfigurationReconciler) addSidecarContainer(backupConf *formolv1
|
||||
repo := &formolv1alpha1.Repo{}
|
||||
if err := r.Get(context.Background(), client.ObjectKey{
|
||||
Namespace: backupConf.Namespace,
|
||||
Name: backupConf.Spec.Repository.Name,
|
||||
Name: backupConf.Spec.Repository,
|
||||
}, repo); err != nil {
|
||||
log.Error(err, "unable to get Repo from BackupConfiguration")
|
||||
return err
|
||||
|
||||
21
controllers/backupconfiguration_controller_test.go
Normal file
21
controllers/backupconfiguration_controller_test.go
Normal file
@ -0,0 +1,21 @@
|
||||
package controllers
|
||||
|
||||
import (
|
||||
"context"
|
||||
"reflect"
|
||||
"time"
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
batchv1 "k8s.io/api/batch/v1"
|
||||
batchv1beta1 "k8s.io/api/batch/v1beta1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
|
||||
formolv1alpha1 "github.com/desmo999r/formol/api/v1alpha1"
|
||||
)
|
||||
|
||||
var _ = Describe("BackupConfiguration controller", func() {
|
||||
|
||||
})
|
||||
@ -357,7 +357,7 @@ func (r *BackupSessionReconciler) CreateBackupJob(target formolv1alpha1.Target)
|
||||
repo := &formolv1alpha1.Repo{}
|
||||
if err := r.Get(ctx, client.ObjectKey{
|
||||
Namespace: r.BackupConf.Namespace,
|
||||
Name: r.BackupConf.Spec.Repository.Name,
|
||||
Name: r.BackupConf.Spec.Repository,
|
||||
}, repo); err != nil {
|
||||
log.Error(err, "unable to get Repo from BackupConfiguration")
|
||||
return err
|
||||
@ -415,7 +415,7 @@ func (r *BackupSessionReconciler) deleteExternalResources() error {
|
||||
repo := &formolv1alpha1.Repo{}
|
||||
if err := r.Get(ctx, client.ObjectKey{
|
||||
Namespace: r.BackupConf.Namespace,
|
||||
Name: r.BackupConf.Spec.Repository.Name,
|
||||
Name: r.BackupConf.Spec.Repository,
|
||||
}, repo); err != nil {
|
||||
log.Error(err, "unable to get Repo from BackupConfiguration")
|
||||
return err
|
||||
|
||||
@ -92,7 +92,7 @@ func (r *RestoreSessionReconciler) CreateRestoreJob(target formolv1alpha1.Target
|
||||
repo := &formolv1alpha1.Repo{}
|
||||
if err := r.Get(ctx, client.ObjectKey{
|
||||
Namespace: r.BackupConf.Namespace,
|
||||
Name: r.BackupConf.Spec.Repository.Name,
|
||||
Name: r.BackupConf.Spec.Repository,
|
||||
}, repo); err != nil {
|
||||
log.Error(err, "unable to get Repo from BackupConfiguration")
|
||||
return err
|
||||
@ -221,7 +221,7 @@ func (r *RestoreSessionReconciler) CreateRestoreInitContainer(target formolv1alp
|
||||
repo := &formolv1alpha1.Repo{}
|
||||
if err := r.Get(ctx, client.ObjectKey{
|
||||
Namespace: r.BackupConf.Namespace,
|
||||
Name: r.BackupConf.Spec.Repository.Name,
|
||||
Name: r.BackupConf.Spec.Repository,
|
||||
}, repo); err != nil {
|
||||
log.Error(err, "unable to get Repo from BackupConfiguration")
|
||||
return err
|
||||
|
||||
@ -5,8 +5,7 @@ metadata:
|
||||
name: backup-demo
|
||||
namespace: demo
|
||||
spec:
|
||||
repository:
|
||||
name: repo-minio
|
||||
repository: repo-minio
|
||||
schedule: "15 * * * *"
|
||||
targets:
|
||||
- kind: Deployment
|
||||
|
||||
Loading…
Reference in New Issue
Block a user