-
Notifications
You must be signed in to change notification settings - Fork 681
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
apis: replace unsigned integers in CRD fields with signed integers, add validation #2133
Conversation
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.
Thanks for working on this, same comment everywhere, if we can just say int
not int64
throughout I'd be fine.
Also, is it just uint32 that (can't remember the thing that complained) will uint
work?
@@ -86,7 +86,8 @@ type Service struct { | |||
Port int `json:"port"` | |||
// Weight defines percentage of traffic to balance traffic | |||
// +optional | |||
Weight uint32 `json:"weight,omitempty"` | |||
// +kubebuilder:validation:Minimum=0 | |||
Weight int64 `json:"weight,omitempty"` |
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 not just int
?
@@ -115,10 +116,12 @@ type HealthCheck struct { | |||
TimeoutSeconds int64 `json:"timeoutSeconds"` | |||
// The number of unhealthy health checks required before a host is marked unhealthy | |||
// +optional | |||
UnhealthyThresholdCount uint32 `json:"unhealthyThresholdCount"` | |||
// +kubebuilder:validation:Minimum=0 | |||
UnhealthyThresholdCount int64 `json:"unhealthyThresholdCount"` |
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.
same as above
Upon reading https://book.kubebuilder.io/cronjob-tutorial/api-design.html?highlight=integer#designing-an-api it also recommends not using Should I raise a second ticket for this? |
Thanks for the quick reply! See comment #2133 (comment) about usage of |
Hi all :)
|
Also see kubernetes/kubernetes#62981 and kubernetes/kubernetes#63522 |
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.
Given that Kubernetes doesn't do straight int, this LGTM. Thanks for adding the validation.
@awprice if you can fix up the merge conflicts, I'll merge this one. |
…dd validation This commit replaces the unsigned integers in the HTTPProxy and IngressRoute CRDs with signed integers. Unsigned integers are discouraged due to API compatibility issues. Validation rules have been added to the fields to ensure that the value provided is always positive. Fixes projectcontour#2123 Signed-off-by: Alex Price <aprice@atlassian.com>
Codecov Report
@@ Coverage Diff @@
## master #2133 +/- ##
=======================================
Coverage 78.08% 78.08%
=======================================
Files 56 56
Lines 4946 4946
=======================================
Hits 3862 3862
Misses 1005 1005
Partials 79 79
Continue to review full report at Codecov.
|
@youngnick Thanks for the reminder. Conflicts fixed. |
This commit replaces the unsigned integers in the HTTPProxy and IngressRoute CRDs
with signed integers. Unsigned integers are discouraged due to API compatibility
issues. Validation rules have been added to the fields to ensure that the value
provided is always positive.
Fixes #2123
Signed-off-by: Alex Price aprice@atlassian.com