Skip to content

Commit 1f2d1ed

Browse files
authored
fix(tenant): fixed validation for tenant restore (#651)
1 parent 6e84a3e commit 1f2d1ed

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

api/v1alpha1/obtenant_webhook.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,9 +290,9 @@ func (r *OBTenant) validateMutation() error {
290290
if r.Spec.Source != nil && r.Spec.Source.Restore != nil {
291291
res := r.Spec.Source.Restore
292292

293-
if res.ArchiveSource == nil && res.BakDataSource == nil && res.SourceUri == "" {
293+
if (res.ArchiveSource == nil || res.BakDataSource == nil) && res.SourceUri == "" {
294294
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"))
295-
} else {
295+
} else if res.ArchiveSource != nil && res.BakDataSource != nil {
296296
destErrs := errors.Join(
297297
validateBackupDestination(cluster, res.ArchiveSource, "spec", "source", "restore", "archiveSource"),
298298
validateBackupDestination(cluster, res.BakDataSource, "spec", "source", "restore", "bakDataSource"),

0 commit comments

Comments
 (0)