Add validation options for PersistentVolumes

These options provide an extensible way of configuring how PVs are
validated
This commit is contained in:
Chris Henzie
2021-06-08 12:38:03 -07:00
parent d92f6c424d
commit 9ba0eed7c5
4 changed files with 45 additions and 17 deletions

View File

@@ -192,7 +192,8 @@ func validateVolumeAttachmentSource(source *storage.VolumeAttachmentSource, fldP
allErrs = append(allErrs, field.Required(fldPath.Child("persistentVolumeName"), "must specify non empty persistentVolumeName"))
}
case source.InlineVolumeSpec != nil:
allErrs = append(allErrs, apivalidation.ValidatePersistentVolumeSpec(source.InlineVolumeSpec, "", true, fldPath.Child("inlineVolumeSpec"))...)
opts := apivalidation.PersistentVolumeSpecValidationOptions{}
allErrs = append(allErrs, apivalidation.ValidatePersistentVolumeSpec(source.InlineVolumeSpec, "", true, fldPath.Child("inlineVolumeSpec"), opts)...)
}
return allErrs
}