Skip to content

Commit

Permalink
fix(tenant): fixed validation for tenant restore (#650)
Browse files Browse the repository at this point in the history
  • Loading branch information
powerfooI authored Nov 27, 2024
1 parent 06ff15b commit 80ec957
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions api/v1alpha1/obtenant_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,9 @@ func (r *OBTenant) validateMutation() error {
if r.Spec.Source != nil && r.Spec.Source.Restore != nil {
res := r.Spec.Source.Restore

if res.ArchiveSource == nil && res.BakDataSource == nil && res.SourceUri == "" {
if (res.ArchiveSource == nil || res.BakDataSource == nil) && res.SourceUri == "" {
allErrs = append(allErrs, field.Invalid(field.NewPath("spec").Child("source").Child("restore"), res, "Restore must have a source option, but both archiveSource, bakDataSource and sourceUri are nil now"))
} else {
} else if res.ArchiveSource != nil && res.BakDataSource != nil {
destErrs := errors.Join(
validateBackupDestination(cluster, res.ArchiveSource, "spec", "source", "restore", "archiveSource"),
validateBackupDestination(cluster, res.BakDataSource, "spec", "source", "restore", "bakDataSource"),
Expand Down

0 comments on commit 80ec957

Please sign in to comment.