Skip to content

Commit

Permalink
Add consistent hash table size api
Browse files Browse the repository at this point in the history
Signed-off-by: Dingkang Li <dingkang1743@gmail.com>
  • Loading branch information
aoledk committed May 8, 2024
1 parent 239fdd7 commit 7a37883
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 1 deletion.
8 changes: 8 additions & 0 deletions api/v1alpha1/loadbalancer_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
// +kubebuilder:validation:Maximum=5000011
// +kubebuilder:default=65537
// +optional
TableSize *uint64 `json:"tableSize,omitempty"`
}

// ConsistentHashType defines the type of input to hash on.
Expand Down
7 changes: 6 additions & 1 deletion api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,14 @@ spec:
ConsistentHash defines the configuration when the load balancer type is
set to ConsistentHash
properties:
tableSize:
default: 65537
description: The table size for consistent hashing, must be
prime number limited to 5000011.
format: int64
maximum: 5000011
minimum: 1
type: integer
type:
description: ConsistentHashType defines the type of input
to hash on.
Expand Down
1 change: 1 addition & 0 deletions site/content/en/latest/api/extension_types.md
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,7 @@ _Appears in:_
| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `type` | _[ConsistentHashType](#consistenthashtype)_ | true | |
| `tableSize` | _integer_ | false | The table size for consistent hashing, must be prime number limited to 5000011. |


#### ConsistentHashType
Expand Down

0 comments on commit 7a37883

Please sign in to comment.