Merge pull request #125940 from thockin/master

Clarify errors in ProjectedVolume validation
This commit is contained in:
Kubernetes Prow Robot 2024-07-17 13:09:51 -07:00 committed by GitHub
commit b23f41e192
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 22 additions and 20 deletions

View File

@ -10096,7 +10096,7 @@
"type": "integer"
},
"sources": {
"description": "sources is the list of volume projections",
"description": "sources is the list of volume projections. Each entry in this list handles one source.",
"items": {
"$ref": "#/definitions/io.k8s.api.core.v1.VolumeProjection"
},
@ -11883,7 +11883,7 @@
"type": "object"
},
"io.k8s.api.core.v1.VolumeProjection": {
"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.",
"properties": {
"clusterTrustBundle": {
"$ref": "#/definitions/io.k8s.api.core.v1.ClusterTrustBundleProjection",

View File

@ -6163,7 +6163,7 @@
"type": "integer"
},
"sources": {
"description": "sources is the list of volume projections",
"description": "sources is the list of volume projections. Each entry in this list handles one source.",
"items": {
"allOf": [
{
@ -8341,7 +8341,7 @@
"type": "object"
},
"io.k8s.api.core.v1.VolumeProjection": {
"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.",
"properties": {
"clusterTrustBundle": {
"allOf": [

View File

@ -4173,7 +4173,7 @@
"type": "integer"
},
"sources": {
"description": "sources is the list of volume projections",
"description": "sources is the list of volume projections. Each entry in this list handles one source.",
"items": {
"allOf": [
{
@ -5190,7 +5190,7 @@
"type": "object"
},
"io.k8s.api.core.v1.VolumeProjection": {
"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.",
"properties": {
"clusterTrustBundle": {
"allOf": [

View File

@ -3377,7 +3377,7 @@
"type": "integer"
},
"sources": {
"description": "sources is the list of volume projections",
"description": "sources is the list of volume projections. Each entry in this list handles one source.",
"items": {
"allOf": [
{
@ -4394,7 +4394,7 @@
"type": "object"
},
"io.k8s.api.core.v1.VolumeProjection": {
"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.",
"properties": {
"clusterTrustBundle": {
"allOf": [

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

@ -28458,7 +28458,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{
@ -31779,7 +31779,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": {

View File

@ -4684,7 +4684,8 @@ message ProbeHandler {
// Represents a projected volume source
message ProjectedVolumeSource {
// sources is the list of volume projections
// sources is the list of volume projections. Each entry in this list
// handles one source.
// +optional
// +listType=atomic
repeated VolumeProjection sources = 1;
@ -6393,7 +6394,8 @@ message VolumeNodeAffinity {
optional NodeSelector required = 1;
}
// Projection that may be projected along with other supported volume types
// Projection that may be projected along with other supported volume types.
// Exactly one of these fields must be set.
message VolumeProjection {
// secret information about the secret data to project
// +optional

View File

@ -1909,7 +1909,8 @@ type ClusterTrustBundleProjection struct {
// Represents a projected volume source
type ProjectedVolumeSource struct {
// sources is the list of volume projections
// sources is the list of volume projections. Each entry in this list
// handles one source.
// +optional
// +listType=atomic
Sources []VolumeProjection `json:"sources" protobuf:"bytes,1,rep,name=sources"`
@ -1923,10 +1924,9 @@ type ProjectedVolumeSource struct {
DefaultMode *int32 `json:"defaultMode,omitempty" protobuf:"varint,2,opt,name=defaultMode"`
}
// Projection that may be projected along with other supported volume types
// Projection that may be projected along with other supported volume types.
// Exactly one of these fields must be set.
type VolumeProjection struct {
// all types below are the supported types for projection into the same volume
// secret information about the secret data to project
// +optional
Secret *SecretProjection `json:"secret,omitempty" protobuf:"bytes,1,opt,name=secret"`

View File

@ -1967,7 +1967,7 @@ func (ProbeHandler) SwaggerDoc() map[string]string {
var map_ProjectedVolumeSource = map[string]string{
"": "Represents a projected volume source",
"sources": "sources is the list of volume projections",
"sources": "sources is the list of volume projections. Each entry in this list handles one source.",
"defaultMode": "defaultMode are the mode bits used to set permissions on created files by default. Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. Directories within the path are not affected by this setting. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set.",
}
@ -2663,7 +2663,7 @@ func (VolumeNodeAffinity) SwaggerDoc() map[string]string {
}
var map_VolumeProjection = map[string]string{
"": "Projection that may be projected along with other supported volume types",
"": "Projection that may be projected along with other supported volume types. Exactly one of these fields must be set.",
"secret": "secret information about the secret data to project",
"downwardAPI": "downwardAPI information about the downwardAPI data to project",
"configMap": "configMap information about the configMap data to project",