mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 04:06:03 +00:00
Merge pull request #36241 from kargakis/validate-pds-against-mrs
Automatic merge from submit-queue extensions: invalidate progress deadline less than minreadyseconds @kubernetes/deployment ptal
This commit is contained in:
commit
052b31a989
@ -264,6 +264,9 @@ func ValidateDeploymentSpec(spec *extensions.DeploymentSpec, fldPath *field.Path
|
||||
}
|
||||
if spec.ProgressDeadlineSeconds != nil {
|
||||
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
|
||||
}
|
||||
|
@ -666,6 +666,13 @@ func TestValidateDeployment(t *testing.T) {
|
||||
invalidRollbackRevisionDeployment.Spec.RollbackTo.Revision = -3
|
||||
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 {
|
||||
errs := ValidateDeployment(v)
|
||||
if len(errs) == 0 {
|
||||
|
Loading…
Reference in New Issue
Block a user