mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 20:24:09 +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"))
|
allErrs = append(allErrs, field.Required(fldPath.Child("persistentVolumeName"), "must specify non empty persistentVolumeName"))
|
||||||
}
|
}
|
||||||
case source.InlineVolumeSpec != nil:
|
case source.InlineVolumeSpec != nil:
|
||||||
if utilfeature.DefaultFeatureGate.Enabled(features.CSIMigration) {
|
allErrs = append(allErrs, storagevalidation.ValidatePersistentVolumeSpec(source.InlineVolumeSpec, "", true, fldPath.Child("inlineVolumeSpec"))...)
|
||||||
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"))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return allErrs
|
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
|
// InlineSpec specified with migration disabled
|
||||||
ObjectMeta: metav1.ObjectMeta{Name: "foo"},
|
ObjectMeta: metav1.ObjectMeta{Name: "foo"},
|
||||||
@ -414,13 +406,11 @@ func TestVolumeAttachmentValidation(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
for _, volumeAttachment := range migrationDisabledSuccessCases {
|
||||||
for _, volumeAttachment := range migrationDisabledErrorCases {
|
if errs := ValidateVolumeAttachment(&volumeAttachment); len(errs) != 0 {
|
||||||
if errs := ValidateVolumeAttachment(&volumeAttachment); len(errs) == 0 {
|
t.Errorf("expected success: %v %v", volumeAttachment, errs)
|
||||||
t.Errorf("expected failure: %v %v", volumeAttachment, errs)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestVolumeAttachmentUpdateValidation(t *testing.T) {
|
func TestVolumeAttachmentUpdateValidation(t *testing.T) {
|
||||||
|
Loading…
Reference in New Issue
Block a user