diff --git a/pkg/api/validation/validation.go b/pkg/api/validation/validation.go index c862d51f52c..8f94910ba99 100644 --- a/pkg/api/validation/validation.go +++ b/pkg/api/validation/validation.go @@ -2191,8 +2191,8 @@ func ValidatePodSpec(spec *api.PodSpec, fldPath *field.Path) field.ErrorList { if spec.ActiveDeadlineSeconds != nil { value := *spec.ActiveDeadlineSeconds - if value < 1 || value > math.MaxUint32 { - allErrs = append(allErrs, field.Invalid(fldPath.Child("activeDeadlineSeconds"), value, validation.InclusiveRangeError(1, math.MaxUint32))) + if value < 1 || value > math.MaxInt32 { + allErrs = append(allErrs, field.Invalid(fldPath.Child("activeDeadlineSeconds"), value, validation.InclusiveRangeError(1, math.MaxInt32))) } } @@ -2578,8 +2578,8 @@ func ValidatePodUpdate(newPod, oldPod *api.Pod) field.ErrorList { // 2. from a positive value to a lesser, non-negative value if newPod.Spec.ActiveDeadlineSeconds != nil { newActiveDeadlineSeconds := *newPod.Spec.ActiveDeadlineSeconds - if newActiveDeadlineSeconds < 0 || newActiveDeadlineSeconds > math.MaxUint32 { - allErrs = append(allErrs, field.Invalid(specPath.Child("activeDeadlineSeconds"), newActiveDeadlineSeconds, validation.InclusiveRangeError(0, math.MaxUint32))) + if newActiveDeadlineSeconds < 0 || newActiveDeadlineSeconds > math.MaxInt32 { + allErrs = append(allErrs, field.Invalid(specPath.Child("activeDeadlineSeconds"), newActiveDeadlineSeconds, validation.InclusiveRangeError(0, math.MaxInt32))) return allErrs } if oldPod.Spec.ActiveDeadlineSeconds != nil { diff --git a/pkg/api/validation/validation_test.go b/pkg/api/validation/validation_test.go index 671e2de5f86..9ab40bc1f93 100644 --- a/pkg/api/validation/validation_test.go +++ b/pkg/api/validation/validation_test.go @@ -3443,7 +3443,7 @@ func TestValidateDNSPolicy(t *testing.T) { func TestValidatePodSpec(t *testing.T) { activeDeadlineSeconds := int64(30) - activeDeadlineSecondsMax := int64(math.MaxUint32) + activeDeadlineSecondsMax := int64(math.MaxInt32) minUserID := types.UnixUserID(0) maxUserID := types.UnixUserID(2147483647) @@ -3559,7 +3559,7 @@ func TestValidatePodSpec(t *testing.T) { } activeDeadlineSeconds = int64(0) - activeDeadlineSecondsTooLarge := int64(math.MaxUint32 + 1) + activeDeadlineSecondsTooLarge := int64(math.MaxInt32 + 1) minUserID = types.UnixUserID(-1) maxUserID = types.UnixUserID(2147483648)