mirror of https://github.com/k3s-io/k3s.git
Validate CSI Inline Migration unconditionally
parent
37cd490ae7
commit
46a1cbf3da
|
@ -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
|
||||
}
|
||||
|
|
|
@ -393,14 +393,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"},
|
||||
|
@ -413,13 +405,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