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
365cfa1e
Commit
365cfa1e
authored
Nov 04, 2016
by
Michail Kargakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
extensions: invalidate progress deadline less than minreadyseconds
parent
5a2c473c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
0 deletions
+10
-0
validation.go
pkg/apis/extensions/validation/validation.go
+3
-0
validation_test.go
pkg/apis/extensions/validation/validation_test.go
+7
-0
No files found.
pkg/apis/extensions/validation/validation.go
View file @
365cfa1e
...
@@ -264,6 +264,9 @@ func ValidateDeploymentSpec(spec *extensions.DeploymentSpec, fldPath *field.Path
...
@@ -264,6 +264,9 @@ func ValidateDeploymentSpec(spec *extensions.DeploymentSpec, fldPath *field.Path
}
}
if
spec
.
ProgressDeadlineSeconds
!=
nil
{
if
spec
.
ProgressDeadlineSeconds
!=
nil
{
allErrs
=
append
(
allErrs
,
apivalidation
.
ValidateNonnegativeField
(
int64
(
*
spec
.
ProgressDeadlineSeconds
),
fldPath
.
Child
(
"progressDeadlineSeconds"
))
...
)
allErrs
=
append
(
allErrs
,
apivalidation
.
ValidateNonnegativeField
(
int64
(
*
spec
.
ProgressDeadlineSeconds
),
fldPath
.
Child
(
"progressDeadlineSeconds"
))
...
)
if
*
spec
.
ProgressDeadlineSeconds
<=
spec
.
MinReadySeconds
{
allErrs
=
append
(
allErrs
,
field
.
Invalid
(
fldPath
.
Child
(
"progressDeadlineSeconds"
),
spec
.
ProgressDeadlineSeconds
,
"must be greater than minReadySeconds."
))
}
}
}
return
allErrs
return
allErrs
}
}
...
...
pkg/apis/extensions/validation/validation_test.go
View file @
365cfa1e
...
@@ -666,6 +666,13 @@ func TestValidateDeployment(t *testing.T) {
...
@@ -666,6 +666,13 @@ func TestValidateDeployment(t *testing.T) {
invalidRollbackRevisionDeployment
.
Spec
.
RollbackTo
.
Revision
=
-
3
invalidRollbackRevisionDeployment
.
Spec
.
RollbackTo
.
Revision
=
-
3
errorCases
[
"must be greater than or equal to 0"
]
=
invalidRollbackRevisionDeployment
errorCases
[
"must be greater than or equal to 0"
]
=
invalidRollbackRevisionDeployment
// ProgressDeadlineSeconds should be greater than MinReadySeconds
invalidProgressDeadlineDeployment
:=
validDeployment
()
seconds
:=
int32
(
600
)
invalidProgressDeadlineDeployment
.
Spec
.
ProgressDeadlineSeconds
=
&
seconds
invalidProgressDeadlineDeployment
.
Spec
.
MinReadySeconds
=
seconds
errorCases
[
"must be greater than minReadySeconds"
]
=
invalidProgressDeadlineDeployment
for
k
,
v
:=
range
errorCases
{
for
k
,
v
:=
range
errorCases
{
errs
:=
ValidateDeployment
(
v
)
errs
:=
ValidateDeployment
(
v
)
if
len
(
errs
)
==
0
{
if
len
(
errs
)
==
0
{
...
...
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