Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
858a21f6
Commit
858a21f6
authored
Jan 30, 2016
by
k8s-merge-robot
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #19909 from pmorie/config-size-limit
Auto commit by PR queue bot
parents
e963e4ad
defd1d05
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
1 deletion
+9
-1
validation.go
pkg/api/validation/validation.go
+7
-1
validation_test.go
pkg/api/validation/validation_test.go
+2
-0
No files found.
pkg/api/validation/validation.go
View file @
858a21f6
...
...
@@ -1999,10 +1999,16 @@ func ValidateConfigMap(cfg *api.ConfigMap) field.ErrorList {
allErrs
:=
field
.
ErrorList
{}
allErrs
=
append
(
allErrs
,
ValidateObjectMeta
(
&
cfg
.
ObjectMeta
,
true
,
ValidateConfigMapName
,
field
.
NewPath
(
"metadata"
))
...
)
for
key
:=
range
cfg
.
Data
{
totalSize
:=
0
for
key
,
value
:=
range
cfg
.
Data
{
if
!
IsSecretKey
(
key
)
{
allErrs
=
append
(
allErrs
,
field
.
Invalid
(
field
.
NewPath
(
"data"
)
.
Key
(
key
),
key
,
fmt
.
Sprintf
(
"must have at most %d characters and match regex %s"
,
validation
.
DNS1123SubdomainMaxLength
,
SecretKeyFmt
)))
}
totalSize
+=
len
(
value
)
}
if
totalSize
>
api
.
MaxSecretSize
{
allErrs
=
append
(
allErrs
,
field
.
TooLong
(
field
.
NewPath
(
"data"
),
""
,
api
.
MaxSecretSize
))
}
return
allErrs
...
...
pkg/api/validation/validation_test.go
View file @
858a21f6
...
...
@@ -4480,6 +4480,7 @@ func TestValidateConfigMap(t *testing.T) {
dotKey
=
newConfigMap
(
"validname"
,
"validns"
,
map
[
string
]
string
{
"."
:
"value"
})
doubleDotKey
=
newConfigMap
(
"validname"
,
"validns"
,
map
[
string
]
string
{
".."
:
"value"
})
overMaxKeyLength
=
newConfigMap
(
"validname"
,
"validns"
,
map
[
string
]
string
{
strings
.
Repeat
(
"a"
,
254
)
:
"value"
})
overMaxSize
=
newConfigMap
(
"validname"
,
"validns"
,
map
[
string
]
string
{
"key"
:
strings
.
Repeat
(
"a"
,
api
.
MaxSecretSize
+
1
)})
)
tests
:=
map
[
string
]
struct
{
...
...
@@ -4497,6 +4498,7 @@ func TestValidateConfigMap(t *testing.T) {
"dot key"
:
{
dotKey
,
false
},
"double dot key"
:
{
doubleDotKey
,
false
},
"over max key length"
:
{
overMaxKeyLength
,
false
},
"over max size"
:
{
overMaxSize
,
false
},
}
for
name
,
tc
:=
range
tests
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment