-
Notifications
You must be signed in to change notification settings - Fork 706
feat: Add WeightedZones to PreferLocalZones #7251
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
Changes from 17 commits
5dfbd4b
dde6326
e8e5a04
fd78201
6fc119f
6556bc0
69fb847
30d48c7
815393b
96b24a6
7b191fe
2388cbd
ac66a7f
fa35ab8
2585dec
e257d7b
626d700
bcaff53
fbf9a52
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 |
|---|---|---|
|
|
@@ -12,7 +12,8 @@ import gwapiv1 "sigs.k8s.io/gateway-api/apis/v1" | |
| // | ||
| // +kubebuilder:validation:XValidation:rule="self.type == 'ConsistentHash' ? has(self.consistentHash) : !has(self.consistentHash)",message="If LoadBalancer type is consistentHash, consistentHash field needs to be set." | ||
| // +kubebuilder:validation:XValidation:rule="self.type in ['Random', 'ConsistentHash'] ? !has(self.slowStart) : true ",message="Currently SlowStart is only supported for RoundRobin and LeastRequest load balancers." | ||
| // +kubebuilder:validation:XValidation:rule="self.type == 'ConsistentHash' ? !has(self.zoneAware) : true ",message="Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers." | ||
| // +kubebuilder:validation:XValidation:rule="self.type == 'ConsistentHash' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true",message="PreferLocal zone-aware routing is not supported for ConsistentHash load balancers. Use weightedZones instead." | ||
| // +kubebuilder:validation:XValidation:rule="has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) && has(self.zoneAware.weightedZones)) : true",message="ZoneAware PreferLocal and WeightedZones cannot be specified together." | ||
| type LoadBalancer struct { | ||
| // Type decides the type of Load Balancer policy. | ||
| // Valid LoadBalancerType values are | ||
|
|
@@ -184,6 +185,14 @@ type ZoneAware struct { | |
| // | ||
| // +optional | ||
| PreferLocal *PreferLocalZone `json:"preferLocal,omitempty"` | ||
|
|
||
| // WeightedZones configures weight-based traffic distribution across locality zones. | ||
| // Traffic is distributed proportionally based on the sum of all zone weights. | ||
| // | ||
| // +optional | ||
| // +listType=map | ||
| // +listMapKey=zone | ||
| WeightedZones []WeightedZoneConfig `json:"weightedZones,omitempty"` | ||
| } | ||
|
|
||
| // PreferLocalZone configures zone-aware routing to prefer sending traffic to the local locality zone. | ||
|
|
@@ -217,6 +226,20 @@ type ForceLocalZone struct { | |
| MinEndpointsInZoneThreshold *uint32 `json:"minEndpointsInZoneThreshold,omitempty"` | ||
| } | ||
|
|
||
| // WeightedZoneConfig defines the weight for a specific locality zone. | ||
| type WeightedZoneConfig struct { | ||
| // Zone specifies the topology zone this weight applies to. | ||
| // The value should match the topology.kubernetes.io/zone label | ||
| // of the nodes where endpoints are running. | ||
| // Zones not listed in the configuration receive a default weight of 1. | ||
|
Contributor
Author
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. This is a design choice, if preferred we could default to zero or even add another field here to configure default weight directly but it seemed unnecessary. |
||
| Zone string `json:"zone"` | ||
|
|
||
| // Weight defines the weight for this locality. | ||
| // Higher values receive more traffic. The actual traffic distribution | ||
| // is proportional to this value relative to other localities. | ||
| Weight uint32 `json:"weight"` | ||
| } | ||
|
|
||
| // EndpointOverride defines the configuration for endpoint override. | ||
| // This allows endpoint picking to be implemented based on request headers or metadata. | ||
| // It extracts selected override endpoints from the specified sources (request headers, metadata, etc.). | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.