Clarify errors in ProjectedVolume validation

Also clarify API docs.
This commit is contained in:
Tim Hockin
2024-07-07 10:50:17 -07:00
parent 07cc20a750
commit e6bb041445
9 changed files with 22 additions and 20 deletions

View File

@@ -1157,7 +1157,7 @@ func validateProjectionSources(projection *core.ProjectedVolumeSource, projectio
allErrs = append(allErrs, ValidateLocalNonReservedPath(source.ServiceAccountToken.Path, fldPath.Child("path"))...)
}
}
if projPath := srcPath.Child("clusterTrustBundlePEM"); source.ClusterTrustBundle != nil {
if projPath := srcPath.Child("clusterTrustBundle"); source.ClusterTrustBundle != nil {
numSources++
usingName := source.ClusterTrustBundle.Name != nil
@@ -1221,7 +1221,7 @@ func validateProjectionSources(projection *core.ProjectedVolumeSource, projectio
}
}
if numSources > 1 {
allErrs = append(allErrs, field.Forbidden(srcPath, "may not specify more than 1 volume type"))
allErrs = append(allErrs, field.Forbidden(srcPath, "may not specify more than 1 volume type per source"))
}
}
return allErrs

View File

@@ -28414,7 +28414,7 @@ func schema_k8sio_api_core_v1_ProjectedVolumeSource(ref common.ReferenceCallback
},
},
SchemaProps: spec.SchemaProps{
Description: "sources is the list of volume projections",
Description: "sources is the list of volume projections. Each entry in this list handles one source.",
Type: []string{"array"},
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
@@ -31735,7 +31735,7 @@ func schema_k8sio_api_core_v1_VolumeProjection(ref common.ReferenceCallback) com
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "Projection that may be projected along with other supported volume types",
Description: "Projection that may be projected along with other supported volume types. Exactly one of these fields must be set.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"secret": {