@@ -813,6 +813,16 @@ func (h *HTTPRoute) GetRetry() *Retry {
813813 return nil
814814}
815815
816+ func (h * HTTPRoute ) NeedsClusterPerSetting () bool {
817+ if h .Traffic != nil &&
818+ h .Traffic .LoadBalancer != nil &&
819+ h .Traffic .LoadBalancer .ZoneAware != nil &&
820+ h .Traffic .LoadBalancer .ZoneAware .PreferLocal != nil {
821+ return true
822+ }
823+ return h .Destination .NeedsClusterPerSetting ()
824+ }
825+
816826// DNS contains configuration options for DNS resolution.
817827// +k8s:deepcopy-gen=true
818828type DNS struct {
@@ -1552,7 +1562,7 @@ func (r *RouteDestination) Validate() error {
15521562func (r * RouteDestination ) NeedsClusterPerSetting () bool {
15531563 return r .HasMixedEndpoints () ||
15541564 r .HasFiltersInSettings () ||
1555- (len (r .Settings ) > 1 && r .HasZoneAwareRouting ())
1565+ (len (r .Settings ) > 1 && r .HasPreferLocalZone ())
15561566}
15571567
15581568// HasMixedEndpoints returns true if the RouteDestination has endpoints of multiple types
@@ -1577,10 +1587,10 @@ func (r *RouteDestination) HasFiltersInSettings() bool {
15771587 return false
15781588}
15791589
1580- // HasZoneAwareRouting returns true if any setting in the destination has ZoneAwareRoutingEnabled set
1581- func (r * RouteDestination ) HasZoneAwareRouting () bool {
1590+ // HasPreferLocalZone returns true if any setting in the destination has PreferLocalZone set
1591+ func (r * RouteDestination ) HasPreferLocalZone () bool {
15821592 for _ , setting := range r .Settings {
1583- if setting .ZoneAwareRouting != nil {
1593+ if setting .PreferLocal != nil {
15841594 return true
15851595 }
15861596 }
@@ -1643,11 +1653,9 @@ type DestinationSetting struct {
16431653 IPFamily * egv1a1.IPFamily `json:"ipFamily,omitempty" yaml:"ipFamily,omitempty"`
16441654 TLS * TLSUpstreamConfig `json:"tls,omitempty" yaml:"tls,omitempty"`
16451655 Filters * DestinationFilters `json:"filters,omitempty" yaml:"filters,omitempty"`
1646- // ZoneAwareRouting specifies whether to enable Zone Aware Routing for this destination's endpoints.
1656+ // PreferLocal specifies whether to enable Zone Aware Routing for this destination's endpoints.
16471657 // This is derived from the backend service and depends on having Kubernetes Topology Aware Routing or Traffic Distribution enabled.
1648- //
1649- // +optional
1650- ZoneAwareRouting * ZoneAwareRouting `json:"zoneAwareRouting,omitempty" yaml:"zoneAwareRouting,omitempty"`
1658+ PreferLocal * PreferLocalZone `json:"preferLocal,omitempty" yaml:"preferLocal,omitempty"`
16511659 // Metadata is used to enrich envoy route metadata with user and provider-specific information
16521660 // The primary metadata for DestinationSettings comes from the Backend resource reference in BackendRef
16531661 Metadata * ResourceMetadata `json:"metadata,omitempty" yaml:"metadata,omitempty"`
@@ -2490,6 +2498,8 @@ type LoadBalancer struct {
24902498 Random * Random `json:"random,omitempty" yaml:"random,omitempty"`
24912499 // ConsistentHash load balancer policy
24922500 ConsistentHash * ConsistentHash `json:"consistentHash,omitempty" yaml:"consistentHash,omitempty"`
2501+ // ZoneAware defines the configuration related to the distribution of requests between locality zones.
2502+ ZoneAware * ZoneAware `json:"zoneAware,omitempty" yaml:"zoneAware,omitempty"`
24932503}
24942504
24952505// Validate the fields within the LoadBalancer structure
@@ -3162,8 +3172,28 @@ type RequestBuffer struct {
31623172 Limit resource.Quantity `json:"limit" yaml:"limit"`
31633173}
31643174
3165- // ZoneAwareRouting holds the zone aware routing configuration
3175+ // ZoneAware defines the configuration related to the distribution of requests between locality zones.
3176+ // +k8s:deepcopy-gen=true
3177+ type ZoneAware struct {
3178+ // PreferLocal configures zone-aware routing to prefer sending traffic to the local locality zone.
3179+ PreferLocal * PreferLocalZone `json:"preferLocal,omitempty" yaml:"preferLocal,omitempty"`
3180+ }
3181+
3182+ // PreferLocalZone configures zone-aware routing to prefer sending traffic to the local locality zone.
3183+ // +k8s:deepcopy-gen=true
3184+ type PreferLocalZone struct {
3185+ // ForceLocalZone defines override configuration for forcing all traffic to stay within the local zone instead of the default behavior
3186+ // which maintains equal distribution among upstream endpoints while sending as much traffic as possible locally.
3187+ Force * ForceLocalZone `json:"force,omitempty" yaml:"force,omitempty"`
3188+ // MinEndpointsThreshold is the minimum number of total upstream endpoints across all zones required to enable zone-aware routing.
3189+ MinEndpointsThreshold * uint64 `json:"minEndpointsThreshold,omitempty" yaml:"minEndpointsThreshold,omitempty"`
3190+ }
3191+
3192+ // ForceLocalZone defines override configuration for forcing all traffic to stay within the local zone instead of the default behavior
3193+ // which maintains equal distribution among upstream endpoints while sending as much traffic as possible locally.
31663194// +k8s:deepcopy-gen=true
3167- type ZoneAwareRouting struct {
3168- MinSize int `json:"minSize" yaml:"minSize"`
3195+ type ForceLocalZone struct {
3196+ // MinEndpointsInZoneThreshold is the minimum number of upstream endpoints in the local zone required to honor the forceLocalZone
3197+ // override. This is useful for protecting zones with fewer endpoints.
3198+ MinEndpointsInZoneThreshold * uint32 `json:"minEndpointsInZoneThreshold,omitempty" yaml:"minEndpointsInZoneThreshold,omitempty"`
31693199}
0 commit comments