diff --git a/pkg/apis/extensions/validation/backupentry.go b/pkg/apis/extensions/validation/backupentry.go index 1b3e8728912..33fcccc0210 100644 --- a/pkg/apis/extensions/validation/backupentry.go +++ b/pkg/apis/extensions/validation/backupentry.go @@ -75,7 +75,6 @@ func ValidateBackupEntrySpecUpdate(new, old *extensionsv1alpha1.BackupEntrySpec, } allErrs = append(allErrs, apivalidation.ValidateImmutableField(new.Type, old.Type, fldPath.Child("type"))...) - allErrs = append(allErrs, apivalidation.ValidateImmutableField(new.Region, old.Region, fldPath.Child("region"))...) return allErrs } diff --git a/pkg/apis/extensions/validation/backupentry_test.go b/pkg/apis/extensions/validation/backupentry_test.go index f6d2be78de7..9c6ec71ca5d 100644 --- a/pkg/apis/extensions/validation/backupentry_test.go +++ b/pkg/apis/extensions/validation/backupentry_test.go @@ -93,20 +93,15 @@ var _ = Describe("BackupEntry validation tests", func() { })))) }) - It("should prevent updating the type or region", func() { + It("should prevent updating the type", func() { newBackupEntry := prepareBackupEntryForUpdate(be) newBackupEntry.Spec.Type = "changed-type" - newBackupEntry.Spec.Region = "changed-region" - newBackupEntry.Spec.BucketName = "changed-bucket-name" errorList := ValidateBackupEntryUpdate(newBackupEntry, be) Expect(errorList).To(ConsistOf(PointTo(MatchFields(IgnoreExtras, Fields{ "Type": Equal(field.ErrorTypeInvalid), "Field": Equal("spec.type"), - })), PointTo(MatchFields(IgnoreExtras, Fields{ - "Type": Equal(field.ErrorTypeInvalid), - "Field": Equal("spec.region"), })))) }) @@ -118,6 +113,24 @@ var _ = Describe("BackupEntry validation tests", func() { Expect(errorList).To(BeEmpty()) }) + + It("should allow updating the name of the backup bucket", func() { + newBackupEntry := prepareBackupEntryForUpdate(be) + newBackupEntry.Spec.BucketName = "changed-bucket-name" + + errorList := ValidateBackupEntryUpdate(newBackupEntry, be) + + Expect(errorList).To(BeEmpty()) + }) + + It("should allow updating the region", func() { + newBackupEntry := prepareBackupEntryForUpdate(be) + newBackupEntry.Spec.Region = "changed-region" + + errorList := ValidateBackupEntryUpdate(newBackupEntry, be) + + Expect(errorList).To(BeEmpty()) + }) }) })