-
Notifications
You must be signed in to change notification settings - Fork 613
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix replicas limit throws "Replicas must be an integer" if any 10 digit number other than 1 is provided #2276
Fix replicas limit throws "Replicas must be an integer" if any 10 digit number other than 1 is provided #2276
Conversation
/kind bug |
maxpods: yup | ||
.number() | ||
.transform((cv) => (_.isNaN(cv) ? undefined : cv)) | ||
.integer('Max Pods must be an Integer.') | ||
.test(isInteger('Max Pods must be an Integer.')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need a separate util isInteger
here? What is the issue with using .integer
from yup
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In yup, to validate an Integer they have used the below validation code
value == null || (value | 0) == value
The maximum value it can validate successful is 2147483647 anything more than that, it fails.
`
let a = 2147483647;
a|0
<2147483647
(a+1)|0
<-2147483648
(a+2)|0
<-2147483647
`
This bug is fixed in jquense/yup#405 but they have not made any release with this fix. Myself and @christianvogt had a discussion and we conclude our own way of fixing until the formal release is made.
You can track the conversation in https://jira.coreos.com/browse/ODC-1225
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also the restriction of MAX_SAFE_INTEGER to max value is to enable correct validation.
`>let x = Number.MAX_SAFE_INTEGER + 1
<undefined
let y = Number.MAX_SAFE_INTEGER + 2
<undefined
x
<9007199254740992
y
<9007199254740992
x === y
<true`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it. Thanks.
/approve |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: gijohn, rohitkrai03, vikram-raj The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/test e2e-aws |
/test e2e-aws-console-olm |
Fixes: https://jira.coreos.com/browse/ODC-1225