mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 03:11:40 +00:00
Validate CSI Inline Migration unconditionally
This commit is contained in:
parent
c981c65c90
commit
bb77aa7a63
@ -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
|
||||
}
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user