Skip to content

Commit e6bb041

Browse files
committed
Clarify errors in ProjectedVolume validation
Also clarify API docs.
1 parent 07cc20a commit e6bb041

File tree

9 files changed

+22
-20
lines changed

9 files changed

+22
-20
lines changed

api/openapi-spec/swagger.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/openapi-spec/v3/api__v1_openapi.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6133,7 +6133,7 @@
61336133
"type": "integer"
61346134
},
61356135
"sources": {
6136-
"description": "sources is the list of volume projections",
6136+
"description": "sources is the list of volume projections. Each entry in this list handles one source.",
61376137
"items": {
61386138
"allOf": [
61396139
{
@@ -8311,7 +8311,7 @@
83118311
"type": "object"
83128312
},
83138313
"io.k8s.api.core.v1.VolumeProjection": {
8314-
"description": "Projection that may be projected along with other supported volume types",
8314+
"description": "Projection that may be projected along with other supported volume types. Exactly one of these fields must be set.",
83158315
"properties": {
83168316
"clusterTrustBundle": {
83178317
"allOf": [

api/openapi-spec/v3/apis__apps__v1_openapi.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4173,7 +4173,7 @@
41734173
"type": "integer"
41744174
},
41754175
"sources": {
4176-
"description": "sources is the list of volume projections",
4176+
"description": "sources is the list of volume projections. Each entry in this list handles one source.",
41774177
"items": {
41784178
"allOf": [
41794179
{
@@ -5190,7 +5190,7 @@
51905190
"type": "object"
51915191
},
51925192
"io.k8s.api.core.v1.VolumeProjection": {
5193-
"description": "Projection that may be projected along with other supported volume types",
5193+
"description": "Projection that may be projected along with other supported volume types. Exactly one of these fields must be set.",
51945194
"properties": {
51955195
"clusterTrustBundle": {
51965196
"allOf": [

api/openapi-spec/v3/apis__batch__v1_openapi.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3377,7 +3377,7 @@
33773377
"type": "integer"
33783378
},
33793379
"sources": {
3380-
"description": "sources is the list of volume projections",
3380+
"description": "sources is the list of volume projections. Each entry in this list handles one source.",
33813381
"items": {
33823382
"allOf": [
33833383
{
@@ -4394,7 +4394,7 @@
43944394
"type": "object"
43954395
},
43964396
"io.k8s.api.core.v1.VolumeProjection": {
4397-
"description": "Projection that may be projected along with other supported volume types",
4397+
"description": "Projection that may be projected along with other supported volume types. Exactly one of these fields must be set.",
43984398
"properties": {
43994399
"clusterTrustBundle": {
44004400
"allOf": [

pkg/apis/core/validation/validation.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1157,7 +1157,7 @@ func validateProjectionSources(projection *core.ProjectedVolumeSource, projectio
11571157
allErrs = append(allErrs, ValidateLocalNonReservedPath(source.ServiceAccountToken.Path, fldPath.Child("path"))...)
11581158
}
11591159
}
1160-
if projPath := srcPath.Child("clusterTrustBundlePEM"); source.ClusterTrustBundle != nil {
1160+
if projPath := srcPath.Child("clusterTrustBundle"); source.ClusterTrustBundle != nil {
11611161
numSources++
11621162

11631163
usingName := source.ClusterTrustBundle.Name != nil
@@ -1221,7 +1221,7 @@ func validateProjectionSources(projection *core.ProjectedVolumeSource, projectio
12211221
}
12221222
}
12231223
if numSources > 1 {
1224-
allErrs = append(allErrs, field.Forbidden(srcPath, "may not specify more than 1 volume type"))
1224+
allErrs = append(allErrs, field.Forbidden(srcPath, "may not specify more than 1 volume type per source"))
12251225
}
12261226
}
12271227
return allErrs

pkg/generated/openapi/zz_generated.openapi.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

staging/src/k8s.io/api/core/v1/generated.proto

Lines changed: 4 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

staging/src/k8s.io/api/core/v1/types.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1911,7 +1911,8 @@ type ClusterTrustBundleProjection struct {
19111911

19121912
// Represents a projected volume source
19131913
type ProjectedVolumeSource struct {
1914-
// sources is the list of volume projections
1914+
// sources is the list of volume projections. Each entry in this list
1915+
// handles one source.
19151916
// +optional
19161917
// +listType=atomic
19171918
Sources []VolumeProjection `json:"sources" protobuf:"bytes,1,rep,name=sources"`
@@ -1925,10 +1926,9 @@ type ProjectedVolumeSource struct {
19251926
DefaultMode *int32 `json:"defaultMode,omitempty" protobuf:"varint,2,opt,name=defaultMode"`
19261927
}
19271928

1928-
// Projection that may be projected along with other supported volume types
1929+
// Projection that may be projected along with other supported volume types.
1930+
// Exactly one of these fields must be set.
19291931
type VolumeProjection struct {
1930-
// all types below are the supported types for projection into the same volume
1931-
19321932
// secret information about the secret data to project
19331933
// +optional
19341934
Secret *SecretProjection `json:"secret,omitempty" protobuf:"bytes,1,opt,name=secret"`

staging/src/k8s.io/api/core/v1/types_swagger_doc_generated.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)