-
Notifications
You must be signed in to change notification settings - Fork 783
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
feat: support for numeric operators #1536
feat: support for numeric operators #1536
Conversation
@JimBugwadia for now I have implemented the support for |
6fe45f1
to
b08b066
Compare
@yashvardhan-kukreja - looks good! I would suggest factoring out reusable code wherever possible as you implement the other operators. This package seems to have a lot of duplication we can improve. Thanks! |
True. I was thinking of creating one |
…no policies Signed-off-by: Yashvardhan Kukreja <yash.kukreja.98@gmail.com>
b08b066
to
f7e775f
Compare
@JimBugwadia @realshuting I have implemented a generic |
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.
Looks good!
Please use closing keywords in the pull request's description, the issue will be closed when merging into the default branch. |
Signed-off-by: Yashvardhan Kukreja yash.kukreja.98@gmail.com
Related issue
#1512
What type of PR is this?
Proposed changes
The newly added operators which can be applied to
validate.deny.conditions
andpreconditions
over kyverno policy rules are the following:GreaterThanOrEquals
: key >= value?GreaterThan
: key > value?LessThanOrEquals
: key <= value?LessThan
: key < value?Checklist
works.
Further comments
Here, the key will only be expected to be int, int64, float, float64, string (for the cases like "2", "2.4" only)
In rest of the cases, an error with saying "Unknown key type found" would be generated because clearly, these are numeric operators and these operations can't be applied on types which can't be casted to int or float.