From bb77aa7a63124bf3a46daaa421d033f3dbd04346 Mon Sep 17 00:00:00 2001 From: Ted Yu Date: Tue, 6 Aug 2019 08:33:25 -0700 Subject: [PATCH] Validate CSI Inline Migration unconditionally --- pkg/apis/storage/validation/validation.go | 6 +----- pkg/apis/storage/validation/validation_test.go | 16 +++------------- 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/pkg/apis/storage/validation/validation.go b/pkg/apis/storage/validation/validation.go index 1947ca7eb39..fd8e9984135 100644 --- a/pkg/apis/storage/validation/validation.go +++ b/pkg/apis/storage/validation/validation.go @@ -187,11 +187,7 @@ func validateVolumeAttachmentSource(source *storage.VolumeAttachmentSource, fldP allErrs = append(allErrs, field.Required(fldPath.Child("persistentVolumeName"), "must specify non empty persistentVolumeName")) } case source.InlineVolumeSpec != nil: - if utilfeature.DefaultFeatureGate.Enabled(features.CSIMigration) { - allErrs = append(allErrs, storagevalidation.ValidatePersistentVolumeSpec(source.InlineVolumeSpec, "", true, fldPath.Child("inlineVolumeSpec"))...) - } else { - allErrs = append(allErrs, field.Forbidden(fldPath, "may not specify inlineVolumeSpec when CSIMigration feature is disabled")) - } + allErrs = append(allErrs, storagevalidation.ValidatePersistentVolumeSpec(source.InlineVolumeSpec, "", true, fldPath.Child("inlineVolumeSpec"))...) } return allErrs } diff --git a/pkg/apis/storage/validation/validation_test.go b/pkg/apis/storage/validation/validation_test.go index 5a9ffd19fd2..15f54b419e9 100644 --- a/pkg/apis/storage/validation/validation_test.go +++ b/pkg/apis/storage/validation/validation_test.go @@ -394,14 +394,6 @@ func TestVolumeAttachmentValidation(t *testing.T) { }, }, }, - } - for _, volumeAttachment := range migrationDisabledSuccessCases { - if errs := ValidateVolumeAttachment(&volumeAttachment); len(errs) != 0 { - t.Errorf("expected success: %v %v", volumeAttachment, errs) - } - } - - migrationDisabledErrorCases := []storage.VolumeAttachment{ { // InlineSpec specified with migration disabled ObjectMeta: metav1.ObjectMeta{Name: "foo"}, @@ -414,13 +406,11 @@ func TestVolumeAttachmentValidation(t *testing.T) { }, }, } - - for _, volumeAttachment := range migrationDisabledErrorCases { - if errs := ValidateVolumeAttachment(&volumeAttachment); len(errs) == 0 { - t.Errorf("expected failure: %v %v", volumeAttachment, errs) + for _, volumeAttachment := range migrationDisabledSuccessCases { + if errs := ValidateVolumeAttachment(&volumeAttachment); len(errs) != 0 { + t.Errorf("expected success: %v %v", volumeAttachment, errs) } } - } func TestVolumeAttachmentUpdateValidation(t *testing.T) {