Skip to content

Commit

Permalink
Allow using same repo from multiple sessions (#94)
Browse files Browse the repository at this point in the history
Signed-off-by: Anisur Rahman <anisur@appscode.com>
  • Loading branch information
anisurrahman75 committed Jan 17, 2024
1 parent 3f4dfb9 commit 70eeee2
Show file tree
Hide file tree
Showing 8 changed files with 5 additions and 2,591 deletions.
1 change: 1 addition & 0 deletions apis/addons/v1alpha1/zz_generated.deepcopy.go

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

1 change: 1 addition & 0 deletions apis/config/v1alpha1/zz_generated.deepcopy.go

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

19 changes: 0 additions & 19 deletions apis/core/v1alpha1/backupconfiguration_webhook.go
Expand Up @@ -273,10 +273,6 @@ func (b *BackupConfiguration) validateSessions(ctx context.Context, c client.Cli
}
}

if err := b.validateUniqueRepo(); err != nil {
return err
}

if err := b.validateUniqueRepoDir(ctx, c); err != nil {
return err
}
Expand Down Expand Up @@ -365,21 +361,6 @@ func (b *BackupConfiguration) validateRepositories(ctx context.Context, c client
return nil
}

func (b *BackupConfiguration) validateUniqueRepo() error {
mapRepoToBackend := make(map[string]map[string]string)
for _, session := range b.Spec.Sessions {
for _, repo := range session.Repositories {
if repoInfo, ok := mapRepoToBackend[repo.Name]; ok && repoInfo[repo.Backend] == repo.Name {
return fmt.Errorf("repository %q can not be used from multiple sessions. Please choose a different repository", repo.Name)
}
mapRepoToBackend[repo.Name] = map[string]string{
repo.Backend: repo.Name,
}
}
}
return nil
}

func (b *BackupConfiguration) validateUniqueRepoDir(ctx context.Context, c client.Client) error {
if err := b.validateRepoDirectories(); err != nil {
return err
Expand Down
5 changes: 0 additions & 5 deletions apis/core/v1alpha1/restoresession_types.go
Expand Up @@ -19,7 +19,6 @@ package v1alpha1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
kmapi "kmodules.xyz/client-go/api/v1"
ofst "kmodules.xyz/offshoot-api/api/v1"
)

const (
Expand Down Expand Up @@ -69,10 +68,6 @@ type RestoreSessionSpec struct {
// +optional
Timeout *metav1.Duration `json:"timeout,omitempty"`

// RuntimeSettings allow to specify Resources, NodeSelector, Affinity, Toleration, ReadinessProbe etc.
// +optional
RuntimeSettings ofst.RuntimeSettings `json:"runtimeSettings,omitempty"`

// ManifestOptions provide options to select particular manifest object to restore
// +optional
ManifestOptions *ManifestRestoreOptions `json:"manifestOptions,omitempty"`
Expand Down
2 changes: 1 addition & 1 deletion apis/core/v1alpha1/zz_generated.deepcopy.go

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

1 change: 1 addition & 0 deletions apis/storage/v1alpha1/zz_generated.deepcopy.go

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

1 change: 1 addition & 0 deletions apis/zz_generated.deepcopy.go

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

2,566 changes: 0 additions & 2,566 deletions crds/core.kubestash.com_restoresessions.yaml

Large diffs are not rendered by default.

0 comments on commit 70eeee2

Please sign in to comment.