-
Notifications
You must be signed in to change notification settings - Fork 360
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(api): add consistent hash table size api #3348
Changes from 1 commit
7a37883
78f31d0
621e1c4
4202e18
6002bd6
6e3d50c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,6 +55,14 @@ const ( | |
// load balancer policy | ||
type ConsistentHash struct { | ||
Type ConsistentHashType `json:"type"` | ||
|
||
// The table size for consistent hashing, must be prime number limited to 5000011. | ||
// | ||
// +kubebuilder:validation:Minimum=1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should we make it There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, make the minimum to the smallest prime number |
||
// +kubebuilder:validation:Maximum=5000011 | ||
// +kubebuilder:default=65537 | ||
// +optional | ||
TableSize *uint64 `json:"tableSize,omitempty"` | ||
aoledk marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
// ConsistentHashType defines the type of input to hash on. | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
can we add CEL to validate it must be prime number?
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.
Seems like CEL in Kubernetes 1 doesn't support complex validation logic like
IsPrime
function. But we can validate whether table size is prime number when translating ClientTrafficPolicy to IR.Footnotes
https://kubernetes.io/docs/reference/using-api/cel/#cel-options-language-features-and-libraries ↩
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.
SGTM