diff --git a/pkg/apis/storage/validation/validation.go b/pkg/apis/storage/validation/validation.go index e8510c152a4..fd4be03c956 100644 --- a/pkg/apis/storage/validation/validation.go +++ b/pkg/apis/storage/validation/validation.go @@ -404,7 +404,7 @@ func ValidateCSIDriver(csiDriver *storage.CSIDriver) field.ErrorList { // ValidateCSIDriverUpdate validates a CSIDriver. func ValidateCSIDriverUpdate(new, old *storage.CSIDriver) field.ErrorList { - allErrs := ValidateCSIDriver(new) + allErrs := apivalidation.ValidateObjectMetaUpdate(&new.ObjectMeta, &old.ObjectMeta, field.NewPath("metadata")) // Spec is read-only // If this ever relaxes in the future, make sure to increment the Generation number in PrepareForUpdate diff --git a/pkg/apis/storage/validation/validation_test.go b/pkg/apis/storage/validation/validation_test.go index 10c071f2240..dd4b8ae21b4 100644 --- a/pkg/apis/storage/validation/validation_test.go +++ b/pkg/apis/storage/validation/validation_test.go @@ -1869,9 +1869,13 @@ func TestCSIDriverValidationUpdate(t *testing.T) { attachNotRequired := false podInfoOnMount := true notPodInfoOnMount := false +<<<<<<< HEAD notRequiresRepublish := false +======= + resourceVersion := "1" +>>>>>>> Relax validation for CSIVolumeFSGroupPolicy old := storage.CSIDriver{ - ObjectMeta: metav1.ObjectMeta{Name: driverName}, + ObjectMeta: metav1.ObjectMeta{Name: driverName, ResourceVersion: resourceVersion}, Spec: storage.CSIDriverSpec{ AttachRequired: &attachNotRequired, PodInfoOnMount: ¬PodInfoOnMount, diff --git a/pkg/registry/storage/csidriver/strategy.go b/pkg/registry/storage/csidriver/strategy.go index 8cf3f06144d..ec600ac4109 100644 --- a/pkg/registry/storage/csidriver/strategy.go +++ b/pkg/registry/storage/csidriver/strategy.go @@ -113,8 +113,7 @@ func (csiDriverStrategy) PrepareForUpdate(ctx context.Context, obj, old runtime. func (csiDriverStrategy) ValidateUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { newCSIDriverObj := obj.(*storage.CSIDriver) oldCSIDriverObj := old.(*storage.CSIDriver) - errorList := validation.ValidateCSIDriver(newCSIDriverObj) - return append(errorList, validation.ValidateCSIDriverUpdate(newCSIDriverObj, oldCSIDriverObj)...) + return validation.ValidateCSIDriverUpdate(newCSIDriverObj, oldCSIDriverObj) } func (csiDriverStrategy) AllowUnconditionalUpdate() bool {