From 971c3f1bc8dec9194f55d24e67f5dd1deab514d3 Mon Sep 17 00:00:00 2001 From: "anurag.ag" Date: Sun, 2 Nov 2025 08:53:40 +0530 Subject: [PATCH 01/23] Add support for ClientSideWeightedRoundRobin load balancer policy in Gateway CRDs, ensuring configurable parameters and validation rules are integrated. Includes e2e test for validation. Signed-off-by: anurag.ag --- api/v1alpha1/loadbalancer_types.go | 57 +- api/v1alpha1/zz_generated.deepcopy.go | 55 ++ ....envoyproxy.io_backendtrafficpolicies.yaml | 63 +- ....envoyproxy.io_envoyextensionpolicies.yaml | 64 +- .../gateway.envoyproxy.io_envoyproxies.yaml | 269 ++++++- ...ateway.envoyproxy.io_securitypolicies.yaml | 262 ++++++- ....envoyproxy.io_backendtrafficpolicies.yaml | 63 +- ....envoyproxy.io_envoyextensionpolicies.yaml | 64 +- .../gateway.envoyproxy.io_envoyproxies.yaml | 269 ++++++- ...ateway.envoyproxy.io_securitypolicies.yaml | 262 ++++++- internal/gatewayapi/clustersettings.go | 36 + internal/ir/xds.go | 19 + internal/ir/zz_generated.deepcopy.go | 55 ++ internal/xds/translator/cluster.go | 56 ++ internal/xds/translator/cluster_test.go | 29 + site/content/en/latest/api/extension_types.md | 26 +- .../en/latest/concepts/load-balancing.md | 1 + ...cing_client_side_weighted_round_robin.yaml | 80 +++ test/e2e/tests/load_balancing.go | 58 ++ test/helm/gateway-crds-helm/all.out.yaml | 658 ++++++++++++++++-- .../envoy-gateway-crds.out.yaml | 658 ++++++++++++++++-- 21 files changed, 2915 insertions(+), 189 deletions(-) create mode 100644 test/e2e/testdata/load_balancing_client_side_weighted_round_robin.yaml diff --git a/api/v1alpha1/loadbalancer_types.go b/api/v1alpha1/loadbalancer_types.go index 7cc7ea146d..7bc2f18b11 100644 --- a/api/v1alpha1/loadbalancer_types.go +++ b/api/v1alpha1/loadbalancer_types.go @@ -11,15 +11,17 @@ import gwapiv1 "sigs.k8s.io/gateway-api/apis/v1" // +union // // +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 == 'ClientSideWeightedRoundRobin' ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)",message="If LoadBalancer type is ClientSideWeightedRoundRobin, clientSideWeightedRoundRobin field needs to be set." +// +kubebuilder:validation:XValidation:rule="self.type in ['Random', 'ConsistentHash', 'ClientSideWeightedRoundRobin'] ? !has(self.slowStart) : true ",message="Currently SlowStart is only supported for RoundRobin and LeastRequest load balancers." +// +kubebuilder:validation:XValidation:rule="self.type in ['ConsistentHash', 'ClientSideWeightedRoundRobin'] ? !has(self.zoneAware) : true ",message="Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers." type LoadBalancer struct { // Type decides the type of Load Balancer policy. // Valid LoadBalancerType values are // "ConsistentHash", // "LeastRequest", // "Random", - // "RoundRobin". + // "RoundRobin", + // "ClientSideWeightedRoundRobin". // // +unionDiscriminator Type LoadBalancerType `json:"type"` @@ -29,6 +31,12 @@ type LoadBalancer struct { // +optional ConsistentHash *ConsistentHash `json:"consistentHash,omitempty"` + // ClientSideWeightedRoundRobin defines the configuration when the load balancer type is + // set to ClientSideWeightedRoundRobin. + // + // +optional + ClientSideWeightedRoundRobin *ClientSideWeightedRoundRobin `json:"clientSideWeightedRoundRobin,omitempty"` + // EndpointOverride defines the configuration for endpoint override. // When specified, the load balancer will attempt to route requests to endpoints // based on the override information extracted from request headers or metadata. @@ -51,7 +59,7 @@ type LoadBalancer struct { } // LoadBalancerType specifies the types of LoadBalancer. -// +kubebuilder:validation:Enum=ConsistentHash;LeastRequest;Random;RoundRobin +// +kubebuilder:validation:Enum=ConsistentHash;LeastRequest;Random;RoundRobin;ClientSideWeightedRoundRobin type LoadBalancerType string const ( @@ -63,6 +71,8 @@ const ( RandomLoadBalancerType LoadBalancerType = "Random" // RoundRobinLoadBalancerType load balancer policy. RoundRobinLoadBalancerType LoadBalancerType = "RoundRobin" + // ClientSideWeightedRoundRobinLoadBalancerType load balancer policy. + ClientSideWeightedRoundRobinLoadBalancerType LoadBalancerType = "ClientSideWeightedRoundRobin" ) // ConsistentHash defines the configuration related to the consistent hash @@ -134,6 +144,45 @@ type Cookie struct { Attributes map[string]string `json:"attributes,omitempty"` } +// ClientSideWeightedRoundRobin defines configuration for Envoy's Client-Side Weighted Round Robin policy. +// See Envoy proto: envoy.extensions.load_balancing_policies.client_side_weighted_round_robin.v3.ClientSideWeightedRoundRobin +// Note: SlowStart is not supported for this policy in Envoy Gateway at this time. +type ClientSideWeightedRoundRobin struct { + // Whether to enable out-of-band utilization reporting collection from the endpoints. + // By default, per-request utilization reporting is used. + // +optional + EnableOOBLoadReport *bool `json:"enableOOBLoadReport,omitempty"` + + // Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. + // Default is 10s; server may not provide reports as frequently as requested. + // +optional + OOBReportingPeriod *gwapiv1.Duration `json:"oobReportingPeriod,omitempty"` + + // A given endpoint must report load metrics continuously for at least this long before the endpoint weight will be used. + // Default is 10s. + // +optional + BlackoutPeriod *gwapiv1.Duration `json:"blackoutPeriod,omitempty"` + + // If a given endpoint has not reported load metrics in this long, stop using the reported weight. Defaults to 3m. + // +optional + WeightExpirationPeriod *gwapiv1.Duration `json:"weightExpirationPeriod,omitempty"` + + // How often endpoint weights are recalculated. Values less than 100ms are capped at 100ms. Default 1s. + // +optional + WeightUpdatePeriod *gwapiv1.Duration `json:"weightUpdatePeriod,omitempty"` + + // The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. + // Must be non-negative. Default is 1.0. + // +kubebuilder:validation:Minimum=0 + // +optional + ErrorUtilizationPenalty *float32 `json:"errorUtilizationPenalty,omitempty"` + + // Metric names used to compute utilization if application_utilization is not set. + // For map fields in ORCA proto, use the form ".", e.g., "named_metrics.foo". + // +optional + MetricNamesForComputingUtilization []string `json:"metricNamesForComputingUtilization,omitempty"` +} + // ConsistentHashType defines the type of input to hash on. // +kubebuilder:validation:Enum=SourceIP;Header;Headers;Cookie type ConsistentHashType string diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index 2dd26de206..5ee347d0ad 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -990,6 +990,56 @@ func (in *ClientIPDetectionSettings) DeepCopy() *ClientIPDetectionSettings { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClientSideWeightedRoundRobin) DeepCopyInto(out *ClientSideWeightedRoundRobin) { + *out = *in + if in.EnableOOBLoadReport != nil { + in, out := &in.EnableOOBLoadReport, &out.EnableOOBLoadReport + *out = new(bool) + **out = **in + } + if in.OOBReportingPeriod != nil { + in, out := &in.OOBReportingPeriod, &out.OOBReportingPeriod + *out = new(v1.Duration) + **out = **in + } + if in.BlackoutPeriod != nil { + in, out := &in.BlackoutPeriod, &out.BlackoutPeriod + *out = new(v1.Duration) + **out = **in + } + if in.WeightExpirationPeriod != nil { + in, out := &in.WeightExpirationPeriod, &out.WeightExpirationPeriod + *out = new(v1.Duration) + **out = **in + } + if in.WeightUpdatePeriod != nil { + in, out := &in.WeightUpdatePeriod, &out.WeightUpdatePeriod + *out = new(v1.Duration) + **out = **in + } + if in.ErrorUtilizationPenalty != nil { + in, out := &in.ErrorUtilizationPenalty, &out.ErrorUtilizationPenalty + *out = new(float32) + **out = **in + } + if in.MetricNamesForComputingUtilization != nil { + in, out := &in.MetricNamesForComputingUtilization, &out.MetricNamesForComputingUtilization + *out = make([]string, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClientSideWeightedRoundRobin. +func (in *ClientSideWeightedRoundRobin) DeepCopy() *ClientSideWeightedRoundRobin { + if in == nil { + return nil + } + out := new(ClientSideWeightedRoundRobin) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ClientTLSSettings) DeepCopyInto(out *ClientTLSSettings) { *out = *in @@ -4769,6 +4819,11 @@ func (in *LoadBalancer) DeepCopyInto(out *LoadBalancer) { *out = new(ConsistentHash) (*in).DeepCopyInto(*out) } + if in.ClientSideWeightedRoundRobin != nil { + in, out := &in.ClientSideWeightedRoundRobin, &out.ClientSideWeightedRoundRobin + *out = new(ClientSideWeightedRoundRobin) + (*in).DeepCopyInto(*out) + } if in.EndpointOverride != nil { in, out := &in.EndpointOverride, &out.EndpointOverride *out = new(EndpointOverride) diff --git a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml index be726b9460..f31a99f755 100644 --- a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml +++ b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml @@ -677,6 +677,53 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + clientSideWeightedRoundRobin: + description: |- + ClientSideWeightedRoundRobin defines the configuration when the load balancer type is + set to ClientSideWeightedRoundRobin. + properties: + blackoutPeriod: + description: |- + A given endpoint must report load metrics continuously for at least this long before the endpoint weight will be used. + Default is 10s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + enableOOBLoadReport: + description: |- + Whether to enable out-of-band utilization reporting collection from the endpoints. + By default, per-request utilization reporting is used. + type: boolean + errorUtilizationPenalty: + description: |- + The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. + Must be non-negative. Default is 1.0. + minimum: 0 + type: number + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + For map fields in ORCA proto, use the form ".", e.g., "named_metrics.foo". + items: + type: string + type: array + oobReportingPeriod: + description: |- + Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. + Default is 10s; server may not provide reports as frequently as requested. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightExpirationPeriod: + description: If a given endpoint has not reported load metrics + in this long, stop using the reported weight. Defaults to + 3m. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightUpdatePeriod: + description: How often endpoint weights are recalculated. + Values less than 100ms are capped at 100ms. Default 1s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + type: object consistentHash: description: |- ConsistentHash defines the configuration when the load balancer type is @@ -822,12 +869,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the configuration related to the @@ -873,14 +922,18 @@ spec: field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' + - message: If LoadBalancer type is ClientSideWeightedRoundRobin, clientSideWeightedRoundRobin + field needs to be set. + rule: 'self.type == ''ClientSideWeightedRoundRobin'' ? has(self.clientSideWeightedRoundRobin) + : !has(self.clientSideWeightedRoundRobin)' - message: Currently SlowStart is only supported for RoundRobin and LeastRequest load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) - : true ' + rule: 'self.type in [''Random'', ''ConsistentHash'', ''ClientSideWeightedRoundRobin''] + ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. - rule: 'self.type == ''ConsistentHash'' ? !has(self.zoneAware) : - true ' + rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] + ? !has(self.zoneAware) : true ' mergeType: description: |- MergeType determines how this configuration is merged with existing BackendTrafficPolicy diff --git a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml index b5880e0e09..b9c489c95a 100644 --- a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml +++ b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml @@ -716,6 +716,54 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + clientSideWeightedRoundRobin: + description: |- + ClientSideWeightedRoundRobin defines the configuration when the load balancer type is + set to ClientSideWeightedRoundRobin. + properties: + blackoutPeriod: + description: |- + A given endpoint must report load metrics continuously for at least this long before the endpoint weight will be used. + Default is 10s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + enableOOBLoadReport: + description: |- + Whether to enable out-of-band utilization reporting collection from the endpoints. + By default, per-request utilization reporting is used. + type: boolean + errorUtilizationPenalty: + description: |- + The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. + Must be non-negative. Default is 1.0. + minimum: 0 + type: number + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + For map fields in ORCA proto, use the form ".", e.g., "named_metrics.foo". + items: + type: string + type: array + oobReportingPeriod: + description: |- + Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. + Default is 10s; server may not provide reports as frequently as requested. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightExpirationPeriod: + description: If a given endpoint has not reported + load metrics in this long, stop using the reported + weight. Defaults to 3m. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightUpdatePeriod: + description: How often endpoint weights are recalculated. + Values less than 100ms are capped at 100ms. Default + 1s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + type: object consistentHash: description: |- ConsistentHash defines the configuration when the load balancer type is @@ -866,12 +914,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the configuration related @@ -919,14 +969,18 @@ spec: field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' + - message: If LoadBalancer type is ClientSideWeightedRoundRobin, + clientSideWeightedRoundRobin field needs to be set. + rule: 'self.type == ''ClientSideWeightedRoundRobin'' ? + has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' - message: Currently SlowStart is only supported for RoundRobin and LeastRequest load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash''] ? - !has(self.slowStart) : true ' + rule: 'self.type in [''Random'', ''ConsistentHash'', ''ClientSideWeightedRoundRobin''] + ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. - rule: 'self.type == ''ConsistentHash'' ? !has(self.zoneAware) - : true ' + rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] + ? !has(self.zoneAware) : true ' proxyProtocol: description: ProxyProtocol enables the Proxy Protocol when communicating with the backend. diff --git a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyproxies.yaml b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyproxies.yaml index c75d4d6f62..1bdb7b175f 100644 --- a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyproxies.yaml +++ b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyproxies.yaml @@ -11709,6 +11709,57 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + clientSideWeightedRoundRobin: + description: |- + ClientSideWeightedRoundRobin defines the configuration when the load balancer type is + set to ClientSideWeightedRoundRobin. + properties: + blackoutPeriod: + description: |- + A given endpoint must report load metrics continuously for at least this long before the endpoint weight will be used. + Default is 10s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + enableOOBLoadReport: + description: |- + Whether to enable out-of-band utilization reporting collection from the endpoints. + By default, per-request utilization reporting is used. + type: boolean + errorUtilizationPenalty: + description: |- + The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. + Must be non-negative. Default is 1.0. + minimum: 0 + type: number + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + For map fields in ORCA proto, use the form ".", e.g., "named_metrics.foo". + items: + type: string + type: array + oobReportingPeriod: + description: |- + Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. + Default is 10s; server may not provide reports as frequently as requested. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightExpirationPeriod: + description: If a given endpoint + has not reported load metrics + in this long, stop using the + reported weight. Defaults to + 3m. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightUpdatePeriod: + description: How often endpoint + weights are recalculated. Values + less than 100ms are capped at + 100ms. Default 1s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + type: object consistentHash: description: |- ConsistentHash defines the configuration when the load balancer type is @@ -11871,12 +11922,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the @@ -11930,15 +11983,23 @@ spec: consistentHash field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' + - message: If LoadBalancer type is ClientSideWeightedRoundRobin, + clientSideWeightedRoundRobin field + needs to be set. + rule: 'self.type == ''ClientSideWeightedRoundRobin'' + ? has(self.clientSideWeightedRoundRobin) + : !has(self.clientSideWeightedRoundRobin)' - message: Currently SlowStart is only supported for RoundRobin and LeastRequest load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash''] + rule: 'self.type in [''Random'', ''ConsistentHash'', + ''ClientSideWeightedRoundRobin''] ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. - rule: 'self.type == ''ConsistentHash'' + rule: 'self.type in [''ConsistentHash'', + ''ClientSideWeightedRoundRobin''] ? !has(self.zoneAware) : true ' proxyProtocol: description: ProxyProtocol enables the @@ -12916,6 +12977,57 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + clientSideWeightedRoundRobin: + description: |- + ClientSideWeightedRoundRobin defines the configuration when the load balancer type is + set to ClientSideWeightedRoundRobin. + properties: + blackoutPeriod: + description: |- + A given endpoint must report load metrics continuously for at least this long before the endpoint weight will be used. + Default is 10s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + enableOOBLoadReport: + description: |- + Whether to enable out-of-band utilization reporting collection from the endpoints. + By default, per-request utilization reporting is used. + type: boolean + errorUtilizationPenalty: + description: |- + The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. + Must be non-negative. Default is 1.0. + minimum: 0 + type: number + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + For map fields in ORCA proto, use the form ".", e.g., "named_metrics.foo". + items: + type: string + type: array + oobReportingPeriod: + description: |- + Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. + Default is 10s; server may not provide reports as frequently as requested. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightExpirationPeriod: + description: If a given endpoint + has not reported load metrics + in this long, stop using the + reported weight. Defaults to + 3m. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightUpdatePeriod: + description: How often endpoint + weights are recalculated. Values + less than 100ms are capped at + 100ms. Default 1s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + type: object consistentHash: description: |- ConsistentHash defines the configuration when the load balancer type is @@ -13078,12 +13190,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the @@ -13137,15 +13251,23 @@ spec: consistentHash field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' + - message: If LoadBalancer type is ClientSideWeightedRoundRobin, + clientSideWeightedRoundRobin field + needs to be set. + rule: 'self.type == ''ClientSideWeightedRoundRobin'' + ? has(self.clientSideWeightedRoundRobin) + : !has(self.clientSideWeightedRoundRobin)' - message: Currently SlowStart is only supported for RoundRobin and LeastRequest load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash''] + rule: 'self.type in [''Random'', ''ConsistentHash'', + ''ClientSideWeightedRoundRobin''] ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. - rule: 'self.type == ''ConsistentHash'' + rule: 'self.type in [''ConsistentHash'', + ''ClientSideWeightedRoundRobin''] ? !has(self.zoneAware) : true ' proxyProtocol: description: ProxyProtocol enables the @@ -14217,6 +14339,56 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + clientSideWeightedRoundRobin: + description: |- + ClientSideWeightedRoundRobin defines the configuration when the load balancer type is + set to ClientSideWeightedRoundRobin. + properties: + blackoutPeriod: + description: |- + A given endpoint must report load metrics continuously for at least this long before the endpoint weight will be used. + Default is 10s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + enableOOBLoadReport: + description: |- + Whether to enable out-of-band utilization reporting collection from the endpoints. + By default, per-request utilization reporting is used. + type: boolean + errorUtilizationPenalty: + description: |- + The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. + Must be non-negative. Default is 1.0. + minimum: 0 + type: number + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + For map fields in ORCA proto, use the form ".", e.g., "named_metrics.foo". + items: + type: string + type: array + oobReportingPeriod: + description: |- + Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. + Default is 10s; server may not provide reports as frequently as requested. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightExpirationPeriod: + description: If a given endpoint has + not reported load metrics in this + long, stop using the reported weight. + Defaults to 3m. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightUpdatePeriod: + description: How often endpoint weights + are recalculated. Values less than + 100ms are capped at 100ms. Default + 1s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + type: object consistentHash: description: |- ConsistentHash defines the configuration when the load balancer type is @@ -14373,12 +14545,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the configuration @@ -14431,15 +14605,22 @@ spec: consistentHash field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' + - message: If LoadBalancer type is ClientSideWeightedRoundRobin, + clientSideWeightedRoundRobin field needs + to be set. + rule: 'self.type == ''ClientSideWeightedRoundRobin'' + ? has(self.clientSideWeightedRoundRobin) + : !has(self.clientSideWeightedRoundRobin)' - message: Currently SlowStart is only supported for RoundRobin and LeastRequest load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash''] - ? !has(self.slowStart) : true ' + rule: 'self.type in [''Random'', ''ConsistentHash'', + ''ClientSideWeightedRoundRobin''] ? !has(self.slowStart) + : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. - rule: 'self.type == ''ConsistentHash'' ? !has(self.zoneAware) - : true ' + rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] + ? !has(self.zoneAware) : true ' proxyProtocol: description: ProxyProtocol enables the Proxy Protocol when communicating with the backend. @@ -15425,6 +15606,54 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + clientSideWeightedRoundRobin: + description: |- + ClientSideWeightedRoundRobin defines the configuration when the load balancer type is + set to ClientSideWeightedRoundRobin. + properties: + blackoutPeriod: + description: |- + A given endpoint must report load metrics continuously for at least this long before the endpoint weight will be used. + Default is 10s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + enableOOBLoadReport: + description: |- + Whether to enable out-of-band utilization reporting collection from the endpoints. + By default, per-request utilization reporting is used. + type: boolean + errorUtilizationPenalty: + description: |- + The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. + Must be non-negative. Default is 1.0. + minimum: 0 + type: number + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + For map fields in ORCA proto, use the form ".", e.g., "named_metrics.foo". + items: + type: string + type: array + oobReportingPeriod: + description: |- + Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. + Default is 10s; server may not provide reports as frequently as requested. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightExpirationPeriod: + description: If a given endpoint has not reported + load metrics in this long, stop using the + reported weight. Defaults to 3m. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightUpdatePeriod: + description: How often endpoint weights are + recalculated. Values less than 100ms are + capped at 100ms. Default 1s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + type: object consistentHash: description: |- ConsistentHash defines the configuration when the load balancer type is @@ -15578,12 +15807,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the configuration @@ -15634,14 +15865,20 @@ spec: consistentHash field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' + - message: If LoadBalancer type is ClientSideWeightedRoundRobin, + clientSideWeightedRoundRobin field needs to be + set. + rule: 'self.type == ''ClientSideWeightedRoundRobin'' + ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' - message: Currently SlowStart is only supported for RoundRobin and LeastRequest load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash''] - ? !has(self.slowStart) : true ' + rule: 'self.type in [''Random'', ''ConsistentHash'', + ''ClientSideWeightedRoundRobin''] ? !has(self.slowStart) + : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. - rule: 'self.type == ''ConsistentHash'' ? !has(self.zoneAware) - : true ' + rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] + ? !has(self.zoneAware) : true ' proxyProtocol: description: ProxyProtocol enables the Proxy Protocol when communicating with the backend. diff --git a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_securitypolicies.yaml b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_securitypolicies.yaml index edeec41016..3a20570c01 100644 --- a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_securitypolicies.yaml +++ b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_securitypolicies.yaml @@ -1234,6 +1234,54 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + clientSideWeightedRoundRobin: + description: |- + ClientSideWeightedRoundRobin defines the configuration when the load balancer type is + set to ClientSideWeightedRoundRobin. + properties: + blackoutPeriod: + description: |- + A given endpoint must report load metrics continuously for at least this long before the endpoint weight will be used. + Default is 10s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + enableOOBLoadReport: + description: |- + Whether to enable out-of-band utilization reporting collection from the endpoints. + By default, per-request utilization reporting is used. + type: boolean + errorUtilizationPenalty: + description: |- + The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. + Must be non-negative. Default is 1.0. + minimum: 0 + type: number + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + For map fields in ORCA proto, use the form ".", e.g., "named_metrics.foo". + items: + type: string + type: array + oobReportingPeriod: + description: |- + Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. + Default is 10s; server may not provide reports as frequently as requested. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightExpirationPeriod: + description: If a given endpoint has not reported + load metrics in this long, stop using the reported + weight. Defaults to 3m. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightUpdatePeriod: + description: How often endpoint weights are recalculated. + Values less than 100ms are capped at 100ms. + Default 1s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + type: object consistentHash: description: |- ConsistentHash defines the configuration when the load balancer type is @@ -1385,12 +1433,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the configuration related @@ -1440,14 +1490,19 @@ spec: field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' + - message: If LoadBalancer type is ClientSideWeightedRoundRobin, + clientSideWeightedRoundRobin field needs to be set. + rule: 'self.type == ''ClientSideWeightedRoundRobin'' + ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' - message: Currently SlowStart is only supported for RoundRobin and LeastRequest load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash''] - ? !has(self.slowStart) : true ' + rule: 'self.type in [''Random'', ''ConsistentHash'', + ''ClientSideWeightedRoundRobin''] ? !has(self.slowStart) + : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. - rule: 'self.type == ''ConsistentHash'' ? !has(self.zoneAware) - : true ' + rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] + ? !has(self.zoneAware) : true ' proxyProtocol: description: ProxyProtocol enables the Proxy Protocol when communicating with the backend. @@ -2331,6 +2386,54 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + clientSideWeightedRoundRobin: + description: |- + ClientSideWeightedRoundRobin defines the configuration when the load balancer type is + set to ClientSideWeightedRoundRobin. + properties: + blackoutPeriod: + description: |- + A given endpoint must report load metrics continuously for at least this long before the endpoint weight will be used. + Default is 10s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + enableOOBLoadReport: + description: |- + Whether to enable out-of-band utilization reporting collection from the endpoints. + By default, per-request utilization reporting is used. + type: boolean + errorUtilizationPenalty: + description: |- + The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. + Must be non-negative. Default is 1.0. + minimum: 0 + type: number + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + For map fields in ORCA proto, use the form ".", e.g., "named_metrics.foo". + items: + type: string + type: array + oobReportingPeriod: + description: |- + Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. + Default is 10s; server may not provide reports as frequently as requested. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightExpirationPeriod: + description: If a given endpoint has not reported + load metrics in this long, stop using the reported + weight. Defaults to 3m. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightUpdatePeriod: + description: How often endpoint weights are recalculated. + Values less than 100ms are capped at 100ms. + Default 1s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + type: object consistentHash: description: |- ConsistentHash defines the configuration when the load balancer type is @@ -2482,12 +2585,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the configuration related @@ -2537,14 +2642,19 @@ spec: field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' + - message: If LoadBalancer type is ClientSideWeightedRoundRobin, + clientSideWeightedRoundRobin field needs to be set. + rule: 'self.type == ''ClientSideWeightedRoundRobin'' + ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' - message: Currently SlowStart is only supported for RoundRobin and LeastRequest load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash''] - ? !has(self.slowStart) : true ' + rule: 'self.type in [''Random'', ''ConsistentHash'', + ''ClientSideWeightedRoundRobin''] ? !has(self.slowStart) + : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. - rule: 'self.type == ''ConsistentHash'' ? !has(self.zoneAware) - : true ' + rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] + ? !has(self.zoneAware) : true ' proxyProtocol: description: ProxyProtocol enables the Proxy Protocol when communicating with the backend. @@ -3639,6 +3749,55 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + clientSideWeightedRoundRobin: + description: |- + ClientSideWeightedRoundRobin defines the configuration when the load balancer type is + set to ClientSideWeightedRoundRobin. + properties: + blackoutPeriod: + description: |- + A given endpoint must report load metrics continuously for at least this long before the endpoint weight will be used. + Default is 10s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + enableOOBLoadReport: + description: |- + Whether to enable out-of-band utilization reporting collection from the endpoints. + By default, per-request utilization reporting is used. + type: boolean + errorUtilizationPenalty: + description: |- + The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. + Must be non-negative. Default is 1.0. + minimum: 0 + type: number + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + For map fields in ORCA proto, use the form ".", e.g., "named_metrics.foo". + items: + type: string + type: array + oobReportingPeriod: + description: |- + Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. + Default is 10s; server may not provide reports as frequently as requested. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightExpirationPeriod: + description: If a given endpoint has not + reported load metrics in this long, stop + using the reported weight. Defaults to + 3m. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightUpdatePeriod: + description: How often endpoint weights + are recalculated. Values less than 100ms + are capped at 100ms. Default 1s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + type: object consistentHash: description: |- ConsistentHash defines the configuration when the load balancer type is @@ -3793,12 +3952,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the configuration @@ -3849,15 +4010,21 @@ spec: consistentHash field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' + - message: If LoadBalancer type is ClientSideWeightedRoundRobin, + clientSideWeightedRoundRobin field needs to + be set. + rule: 'self.type == ''ClientSideWeightedRoundRobin'' + ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' - message: Currently SlowStart is only supported for RoundRobin and LeastRequest load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash''] - ? !has(self.slowStart) : true ' + rule: 'self.type in [''Random'', ''ConsistentHash'', + ''ClientSideWeightedRoundRobin''] ? !has(self.slowStart) + : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. - rule: 'self.type == ''ConsistentHash'' ? !has(self.zoneAware) - : true ' + rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] + ? !has(self.zoneAware) : true ' proxyProtocol: description: ProxyProtocol enables the Proxy Protocol when communicating with the backend. @@ -5005,6 +5172,54 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + clientSideWeightedRoundRobin: + description: |- + ClientSideWeightedRoundRobin defines the configuration when the load balancer type is + set to ClientSideWeightedRoundRobin. + properties: + blackoutPeriod: + description: |- + A given endpoint must report load metrics continuously for at least this long before the endpoint weight will be used. + Default is 10s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + enableOOBLoadReport: + description: |- + Whether to enable out-of-band utilization reporting collection from the endpoints. + By default, per-request utilization reporting is used. + type: boolean + errorUtilizationPenalty: + description: |- + The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. + Must be non-negative. Default is 1.0. + minimum: 0 + type: number + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + For map fields in ORCA proto, use the form ".", e.g., "named_metrics.foo". + items: + type: string + type: array + oobReportingPeriod: + description: |- + Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. + Default is 10s; server may not provide reports as frequently as requested. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightExpirationPeriod: + description: If a given endpoint has not reported + load metrics in this long, stop using the reported + weight. Defaults to 3m. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightUpdatePeriod: + description: How often endpoint weights are recalculated. + Values less than 100ms are capped at 100ms. + Default 1s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + type: object consistentHash: description: |- ConsistentHash defines the configuration when the load balancer type is @@ -5156,12 +5371,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the configuration related @@ -5211,14 +5428,19 @@ spec: field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' + - message: If LoadBalancer type is ClientSideWeightedRoundRobin, + clientSideWeightedRoundRobin field needs to be set. + rule: 'self.type == ''ClientSideWeightedRoundRobin'' + ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' - message: Currently SlowStart is only supported for RoundRobin and LeastRequest load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash''] - ? !has(self.slowStart) : true ' + rule: 'self.type in [''Random'', ''ConsistentHash'', + ''ClientSideWeightedRoundRobin''] ? !has(self.slowStart) + : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. - rule: 'self.type == ''ConsistentHash'' ? !has(self.zoneAware) - : true ' + rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] + ? !has(self.zoneAware) : true ' proxyProtocol: description: ProxyProtocol enables the Proxy Protocol when communicating with the backend. diff --git a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml index f0fa3b569c..97c885b347 100644 --- a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml +++ b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml @@ -676,6 +676,53 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + clientSideWeightedRoundRobin: + description: |- + ClientSideWeightedRoundRobin defines the configuration when the load balancer type is + set to ClientSideWeightedRoundRobin. + properties: + blackoutPeriod: + description: |- + A given endpoint must report load metrics continuously for at least this long before the endpoint weight will be used. + Default is 10s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + enableOOBLoadReport: + description: |- + Whether to enable out-of-band utilization reporting collection from the endpoints. + By default, per-request utilization reporting is used. + type: boolean + errorUtilizationPenalty: + description: |- + The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. + Must be non-negative. Default is 1.0. + minimum: 0 + type: number + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + For map fields in ORCA proto, use the form ".", e.g., "named_metrics.foo". + items: + type: string + type: array + oobReportingPeriod: + description: |- + Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. + Default is 10s; server may not provide reports as frequently as requested. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightExpirationPeriod: + description: If a given endpoint has not reported load metrics + in this long, stop using the reported weight. Defaults to + 3m. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightUpdatePeriod: + description: How often endpoint weights are recalculated. + Values less than 100ms are capped at 100ms. Default 1s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + type: object consistentHash: description: |- ConsistentHash defines the configuration when the load balancer type is @@ -821,12 +868,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the configuration related to the @@ -872,14 +921,18 @@ spec: field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' + - message: If LoadBalancer type is ClientSideWeightedRoundRobin, clientSideWeightedRoundRobin + field needs to be set. + rule: 'self.type == ''ClientSideWeightedRoundRobin'' ? has(self.clientSideWeightedRoundRobin) + : !has(self.clientSideWeightedRoundRobin)' - message: Currently SlowStart is only supported for RoundRobin and LeastRequest load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) - : true ' + rule: 'self.type in [''Random'', ''ConsistentHash'', ''ClientSideWeightedRoundRobin''] + ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. - rule: 'self.type == ''ConsistentHash'' ? !has(self.zoneAware) : - true ' + rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] + ? !has(self.zoneAware) : true ' mergeType: description: |- MergeType determines how this configuration is merged with existing BackendTrafficPolicy diff --git a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml index 1447f8ca6b..148a3aab38 100644 --- a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml +++ b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml @@ -715,6 +715,54 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + clientSideWeightedRoundRobin: + description: |- + ClientSideWeightedRoundRobin defines the configuration when the load balancer type is + set to ClientSideWeightedRoundRobin. + properties: + blackoutPeriod: + description: |- + A given endpoint must report load metrics continuously for at least this long before the endpoint weight will be used. + Default is 10s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + enableOOBLoadReport: + description: |- + Whether to enable out-of-band utilization reporting collection from the endpoints. + By default, per-request utilization reporting is used. + type: boolean + errorUtilizationPenalty: + description: |- + The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. + Must be non-negative. Default is 1.0. + minimum: 0 + type: number + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + For map fields in ORCA proto, use the form ".", e.g., "named_metrics.foo". + items: + type: string + type: array + oobReportingPeriod: + description: |- + Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. + Default is 10s; server may not provide reports as frequently as requested. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightExpirationPeriod: + description: If a given endpoint has not reported + load metrics in this long, stop using the reported + weight. Defaults to 3m. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightUpdatePeriod: + description: How often endpoint weights are recalculated. + Values less than 100ms are capped at 100ms. Default + 1s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + type: object consistentHash: description: |- ConsistentHash defines the configuration when the load balancer type is @@ -865,12 +913,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the configuration related @@ -918,14 +968,18 @@ spec: field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' + - message: If LoadBalancer type is ClientSideWeightedRoundRobin, + clientSideWeightedRoundRobin field needs to be set. + rule: 'self.type == ''ClientSideWeightedRoundRobin'' ? + has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' - message: Currently SlowStart is only supported for RoundRobin and LeastRequest load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash''] ? - !has(self.slowStart) : true ' + rule: 'self.type in [''Random'', ''ConsistentHash'', ''ClientSideWeightedRoundRobin''] + ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. - rule: 'self.type == ''ConsistentHash'' ? !has(self.zoneAware) - : true ' + rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] + ? !has(self.zoneAware) : true ' proxyProtocol: description: ProxyProtocol enables the Proxy Protocol when communicating with the backend. diff --git a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyproxies.yaml b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyproxies.yaml index 2d329615a2..83f21b6754 100644 --- a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyproxies.yaml +++ b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyproxies.yaml @@ -11708,6 +11708,57 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + clientSideWeightedRoundRobin: + description: |- + ClientSideWeightedRoundRobin defines the configuration when the load balancer type is + set to ClientSideWeightedRoundRobin. + properties: + blackoutPeriod: + description: |- + A given endpoint must report load metrics continuously for at least this long before the endpoint weight will be used. + Default is 10s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + enableOOBLoadReport: + description: |- + Whether to enable out-of-band utilization reporting collection from the endpoints. + By default, per-request utilization reporting is used. + type: boolean + errorUtilizationPenalty: + description: |- + The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. + Must be non-negative. Default is 1.0. + minimum: 0 + type: number + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + For map fields in ORCA proto, use the form ".", e.g., "named_metrics.foo". + items: + type: string + type: array + oobReportingPeriod: + description: |- + Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. + Default is 10s; server may not provide reports as frequently as requested. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightExpirationPeriod: + description: If a given endpoint + has not reported load metrics + in this long, stop using the + reported weight. Defaults to + 3m. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightUpdatePeriod: + description: How often endpoint + weights are recalculated. Values + less than 100ms are capped at + 100ms. Default 1s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + type: object consistentHash: description: |- ConsistentHash defines the configuration when the load balancer type is @@ -11870,12 +11921,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the @@ -11929,15 +11982,23 @@ spec: consistentHash field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' + - message: If LoadBalancer type is ClientSideWeightedRoundRobin, + clientSideWeightedRoundRobin field + needs to be set. + rule: 'self.type == ''ClientSideWeightedRoundRobin'' + ? has(self.clientSideWeightedRoundRobin) + : !has(self.clientSideWeightedRoundRobin)' - message: Currently SlowStart is only supported for RoundRobin and LeastRequest load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash''] + rule: 'self.type in [''Random'', ''ConsistentHash'', + ''ClientSideWeightedRoundRobin''] ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. - rule: 'self.type == ''ConsistentHash'' + rule: 'self.type in [''ConsistentHash'', + ''ClientSideWeightedRoundRobin''] ? !has(self.zoneAware) : true ' proxyProtocol: description: ProxyProtocol enables the @@ -12915,6 +12976,57 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + clientSideWeightedRoundRobin: + description: |- + ClientSideWeightedRoundRobin defines the configuration when the load balancer type is + set to ClientSideWeightedRoundRobin. + properties: + blackoutPeriod: + description: |- + A given endpoint must report load metrics continuously for at least this long before the endpoint weight will be used. + Default is 10s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + enableOOBLoadReport: + description: |- + Whether to enable out-of-band utilization reporting collection from the endpoints. + By default, per-request utilization reporting is used. + type: boolean + errorUtilizationPenalty: + description: |- + The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. + Must be non-negative. Default is 1.0. + minimum: 0 + type: number + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + For map fields in ORCA proto, use the form ".", e.g., "named_metrics.foo". + items: + type: string + type: array + oobReportingPeriod: + description: |- + Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. + Default is 10s; server may not provide reports as frequently as requested. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightExpirationPeriod: + description: If a given endpoint + has not reported load metrics + in this long, stop using the + reported weight. Defaults to + 3m. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightUpdatePeriod: + description: How often endpoint + weights are recalculated. Values + less than 100ms are capped at + 100ms. Default 1s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + type: object consistentHash: description: |- ConsistentHash defines the configuration when the load balancer type is @@ -13077,12 +13189,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the @@ -13136,15 +13250,23 @@ spec: consistentHash field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' + - message: If LoadBalancer type is ClientSideWeightedRoundRobin, + clientSideWeightedRoundRobin field + needs to be set. + rule: 'self.type == ''ClientSideWeightedRoundRobin'' + ? has(self.clientSideWeightedRoundRobin) + : !has(self.clientSideWeightedRoundRobin)' - message: Currently SlowStart is only supported for RoundRobin and LeastRequest load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash''] + rule: 'self.type in [''Random'', ''ConsistentHash'', + ''ClientSideWeightedRoundRobin''] ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. - rule: 'self.type == ''ConsistentHash'' + rule: 'self.type in [''ConsistentHash'', + ''ClientSideWeightedRoundRobin''] ? !has(self.zoneAware) : true ' proxyProtocol: description: ProxyProtocol enables the @@ -14216,6 +14338,56 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + clientSideWeightedRoundRobin: + description: |- + ClientSideWeightedRoundRobin defines the configuration when the load balancer type is + set to ClientSideWeightedRoundRobin. + properties: + blackoutPeriod: + description: |- + A given endpoint must report load metrics continuously for at least this long before the endpoint weight will be used. + Default is 10s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + enableOOBLoadReport: + description: |- + Whether to enable out-of-band utilization reporting collection from the endpoints. + By default, per-request utilization reporting is used. + type: boolean + errorUtilizationPenalty: + description: |- + The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. + Must be non-negative. Default is 1.0. + minimum: 0 + type: number + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + For map fields in ORCA proto, use the form ".", e.g., "named_metrics.foo". + items: + type: string + type: array + oobReportingPeriod: + description: |- + Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. + Default is 10s; server may not provide reports as frequently as requested. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightExpirationPeriod: + description: If a given endpoint has + not reported load metrics in this + long, stop using the reported weight. + Defaults to 3m. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightUpdatePeriod: + description: How often endpoint weights + are recalculated. Values less than + 100ms are capped at 100ms. Default + 1s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + type: object consistentHash: description: |- ConsistentHash defines the configuration when the load balancer type is @@ -14372,12 +14544,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the configuration @@ -14430,15 +14604,22 @@ spec: consistentHash field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' + - message: If LoadBalancer type is ClientSideWeightedRoundRobin, + clientSideWeightedRoundRobin field needs + to be set. + rule: 'self.type == ''ClientSideWeightedRoundRobin'' + ? has(self.clientSideWeightedRoundRobin) + : !has(self.clientSideWeightedRoundRobin)' - message: Currently SlowStart is only supported for RoundRobin and LeastRequest load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash''] - ? !has(self.slowStart) : true ' + rule: 'self.type in [''Random'', ''ConsistentHash'', + ''ClientSideWeightedRoundRobin''] ? !has(self.slowStart) + : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. - rule: 'self.type == ''ConsistentHash'' ? !has(self.zoneAware) - : true ' + rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] + ? !has(self.zoneAware) : true ' proxyProtocol: description: ProxyProtocol enables the Proxy Protocol when communicating with the backend. @@ -15424,6 +15605,54 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + clientSideWeightedRoundRobin: + description: |- + ClientSideWeightedRoundRobin defines the configuration when the load balancer type is + set to ClientSideWeightedRoundRobin. + properties: + blackoutPeriod: + description: |- + A given endpoint must report load metrics continuously for at least this long before the endpoint weight will be used. + Default is 10s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + enableOOBLoadReport: + description: |- + Whether to enable out-of-band utilization reporting collection from the endpoints. + By default, per-request utilization reporting is used. + type: boolean + errorUtilizationPenalty: + description: |- + The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. + Must be non-negative. Default is 1.0. + minimum: 0 + type: number + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + For map fields in ORCA proto, use the form ".", e.g., "named_metrics.foo". + items: + type: string + type: array + oobReportingPeriod: + description: |- + Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. + Default is 10s; server may not provide reports as frequently as requested. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightExpirationPeriod: + description: If a given endpoint has not reported + load metrics in this long, stop using the + reported weight. Defaults to 3m. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightUpdatePeriod: + description: How often endpoint weights are + recalculated. Values less than 100ms are + capped at 100ms. Default 1s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + type: object consistentHash: description: |- ConsistentHash defines the configuration when the load balancer type is @@ -15577,12 +15806,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the configuration @@ -15633,14 +15864,20 @@ spec: consistentHash field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' + - message: If LoadBalancer type is ClientSideWeightedRoundRobin, + clientSideWeightedRoundRobin field needs to be + set. + rule: 'self.type == ''ClientSideWeightedRoundRobin'' + ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' - message: Currently SlowStart is only supported for RoundRobin and LeastRequest load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash''] - ? !has(self.slowStart) : true ' + rule: 'self.type in [''Random'', ''ConsistentHash'', + ''ClientSideWeightedRoundRobin''] ? !has(self.slowStart) + : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. - rule: 'self.type == ''ConsistentHash'' ? !has(self.zoneAware) - : true ' + rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] + ? !has(self.zoneAware) : true ' proxyProtocol: description: ProxyProtocol enables the Proxy Protocol when communicating with the backend. diff --git a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_securitypolicies.yaml b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_securitypolicies.yaml index 6f0a7e170a..65f2a63199 100644 --- a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_securitypolicies.yaml +++ b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_securitypolicies.yaml @@ -1233,6 +1233,54 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + clientSideWeightedRoundRobin: + description: |- + ClientSideWeightedRoundRobin defines the configuration when the load balancer type is + set to ClientSideWeightedRoundRobin. + properties: + blackoutPeriod: + description: |- + A given endpoint must report load metrics continuously for at least this long before the endpoint weight will be used. + Default is 10s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + enableOOBLoadReport: + description: |- + Whether to enable out-of-band utilization reporting collection from the endpoints. + By default, per-request utilization reporting is used. + type: boolean + errorUtilizationPenalty: + description: |- + The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. + Must be non-negative. Default is 1.0. + minimum: 0 + type: number + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + For map fields in ORCA proto, use the form ".", e.g., "named_metrics.foo". + items: + type: string + type: array + oobReportingPeriod: + description: |- + Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. + Default is 10s; server may not provide reports as frequently as requested. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightExpirationPeriod: + description: If a given endpoint has not reported + load metrics in this long, stop using the reported + weight. Defaults to 3m. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightUpdatePeriod: + description: How often endpoint weights are recalculated. + Values less than 100ms are capped at 100ms. + Default 1s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + type: object consistentHash: description: |- ConsistentHash defines the configuration when the load balancer type is @@ -1384,12 +1432,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the configuration related @@ -1439,14 +1489,19 @@ spec: field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' + - message: If LoadBalancer type is ClientSideWeightedRoundRobin, + clientSideWeightedRoundRobin field needs to be set. + rule: 'self.type == ''ClientSideWeightedRoundRobin'' + ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' - message: Currently SlowStart is only supported for RoundRobin and LeastRequest load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash''] - ? !has(self.slowStart) : true ' + rule: 'self.type in [''Random'', ''ConsistentHash'', + ''ClientSideWeightedRoundRobin''] ? !has(self.slowStart) + : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. - rule: 'self.type == ''ConsistentHash'' ? !has(self.zoneAware) - : true ' + rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] + ? !has(self.zoneAware) : true ' proxyProtocol: description: ProxyProtocol enables the Proxy Protocol when communicating with the backend. @@ -2330,6 +2385,54 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + clientSideWeightedRoundRobin: + description: |- + ClientSideWeightedRoundRobin defines the configuration when the load balancer type is + set to ClientSideWeightedRoundRobin. + properties: + blackoutPeriod: + description: |- + A given endpoint must report load metrics continuously for at least this long before the endpoint weight will be used. + Default is 10s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + enableOOBLoadReport: + description: |- + Whether to enable out-of-band utilization reporting collection from the endpoints. + By default, per-request utilization reporting is used. + type: boolean + errorUtilizationPenalty: + description: |- + The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. + Must be non-negative. Default is 1.0. + minimum: 0 + type: number + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + For map fields in ORCA proto, use the form ".", e.g., "named_metrics.foo". + items: + type: string + type: array + oobReportingPeriod: + description: |- + Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. + Default is 10s; server may not provide reports as frequently as requested. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightExpirationPeriod: + description: If a given endpoint has not reported + load metrics in this long, stop using the reported + weight. Defaults to 3m. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightUpdatePeriod: + description: How often endpoint weights are recalculated. + Values less than 100ms are capped at 100ms. + Default 1s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + type: object consistentHash: description: |- ConsistentHash defines the configuration when the load balancer type is @@ -2481,12 +2584,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the configuration related @@ -2536,14 +2641,19 @@ spec: field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' + - message: If LoadBalancer type is ClientSideWeightedRoundRobin, + clientSideWeightedRoundRobin field needs to be set. + rule: 'self.type == ''ClientSideWeightedRoundRobin'' + ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' - message: Currently SlowStart is only supported for RoundRobin and LeastRequest load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash''] - ? !has(self.slowStart) : true ' + rule: 'self.type in [''Random'', ''ConsistentHash'', + ''ClientSideWeightedRoundRobin''] ? !has(self.slowStart) + : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. - rule: 'self.type == ''ConsistentHash'' ? !has(self.zoneAware) - : true ' + rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] + ? !has(self.zoneAware) : true ' proxyProtocol: description: ProxyProtocol enables the Proxy Protocol when communicating with the backend. @@ -3638,6 +3748,55 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + clientSideWeightedRoundRobin: + description: |- + ClientSideWeightedRoundRobin defines the configuration when the load balancer type is + set to ClientSideWeightedRoundRobin. + properties: + blackoutPeriod: + description: |- + A given endpoint must report load metrics continuously for at least this long before the endpoint weight will be used. + Default is 10s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + enableOOBLoadReport: + description: |- + Whether to enable out-of-band utilization reporting collection from the endpoints. + By default, per-request utilization reporting is used. + type: boolean + errorUtilizationPenalty: + description: |- + The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. + Must be non-negative. Default is 1.0. + minimum: 0 + type: number + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + For map fields in ORCA proto, use the form ".", e.g., "named_metrics.foo". + items: + type: string + type: array + oobReportingPeriod: + description: |- + Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. + Default is 10s; server may not provide reports as frequently as requested. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightExpirationPeriod: + description: If a given endpoint has not + reported load metrics in this long, stop + using the reported weight. Defaults to + 3m. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightUpdatePeriod: + description: How often endpoint weights + are recalculated. Values less than 100ms + are capped at 100ms. Default 1s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + type: object consistentHash: description: |- ConsistentHash defines the configuration when the load balancer type is @@ -3792,12 +3951,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the configuration @@ -3848,15 +4009,21 @@ spec: consistentHash field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' + - message: If LoadBalancer type is ClientSideWeightedRoundRobin, + clientSideWeightedRoundRobin field needs to + be set. + rule: 'self.type == ''ClientSideWeightedRoundRobin'' + ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' - message: Currently SlowStart is only supported for RoundRobin and LeastRequest load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash''] - ? !has(self.slowStart) : true ' + rule: 'self.type in [''Random'', ''ConsistentHash'', + ''ClientSideWeightedRoundRobin''] ? !has(self.slowStart) + : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. - rule: 'self.type == ''ConsistentHash'' ? !has(self.zoneAware) - : true ' + rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] + ? !has(self.zoneAware) : true ' proxyProtocol: description: ProxyProtocol enables the Proxy Protocol when communicating with the backend. @@ -5004,6 +5171,54 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + clientSideWeightedRoundRobin: + description: |- + ClientSideWeightedRoundRobin defines the configuration when the load balancer type is + set to ClientSideWeightedRoundRobin. + properties: + blackoutPeriod: + description: |- + A given endpoint must report load metrics continuously for at least this long before the endpoint weight will be used. + Default is 10s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + enableOOBLoadReport: + description: |- + Whether to enable out-of-band utilization reporting collection from the endpoints. + By default, per-request utilization reporting is used. + type: boolean + errorUtilizationPenalty: + description: |- + The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. + Must be non-negative. Default is 1.0. + minimum: 0 + type: number + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + For map fields in ORCA proto, use the form ".", e.g., "named_metrics.foo". + items: + type: string + type: array + oobReportingPeriod: + description: |- + Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. + Default is 10s; server may not provide reports as frequently as requested. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightExpirationPeriod: + description: If a given endpoint has not reported + load metrics in this long, stop using the reported + weight. Defaults to 3m. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightUpdatePeriod: + description: How often endpoint weights are recalculated. + Values less than 100ms are capped at 100ms. + Default 1s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + type: object consistentHash: description: |- ConsistentHash defines the configuration when the load balancer type is @@ -5155,12 +5370,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the configuration related @@ -5210,14 +5427,19 @@ spec: field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' + - message: If LoadBalancer type is ClientSideWeightedRoundRobin, + clientSideWeightedRoundRobin field needs to be set. + rule: 'self.type == ''ClientSideWeightedRoundRobin'' + ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' - message: Currently SlowStart is only supported for RoundRobin and LeastRequest load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash''] - ? !has(self.slowStart) : true ' + rule: 'self.type in [''Random'', ''ConsistentHash'', + ''ClientSideWeightedRoundRobin''] ? !has(self.slowStart) + : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. - rule: 'self.type == ''ConsistentHash'' ? !has(self.zoneAware) - : true ' + rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] + ? !has(self.zoneAware) : true ' proxyProtocol: description: ProxyProtocol enables the Proxy Protocol when communicating with the backend. diff --git a/internal/gatewayapi/clustersettings.go b/internal/gatewayapi/clustersettings.go index 3acf56882d..9a948eee9a 100644 --- a/internal/gatewayapi/clustersettings.go +++ b/internal/gatewayapi/clustersettings.go @@ -340,6 +340,42 @@ func buildLoadBalancer(policy *egv1a1.ClusterSettings) (*ir.LoadBalancer, error) Window: ir.MetaV1DurationPtr(d), } } + case egv1a1.ClientSideWeightedRoundRobinLoadBalancerType: + lb = &ir.LoadBalancer{ + ClientSideWeightedRoundRobin: &ir.ClientSideWeightedRoundRobin{}, + } + cswrr := policy.LoadBalancer.ClientSideWeightedRoundRobin + if cswrr != nil { + if cswrr.EnableOOBLoadReport != nil { + lb.ClientSideWeightedRoundRobin.EnableOOBLoadReport = cswrr.EnableOOBLoadReport + } + if cswrr.OOBReportingPeriod != nil { + if d, err := time.ParseDuration(string(*cswrr.OOBReportingPeriod)); err == nil { + lb.ClientSideWeightedRoundRobin.OOBReportingPeriod = ir.MetaV1DurationPtr(d) + } + } + if cswrr.BlackoutPeriod != nil { + if d, err := time.ParseDuration(string(*cswrr.BlackoutPeriod)); err == nil { + lb.ClientSideWeightedRoundRobin.BlackoutPeriod = ir.MetaV1DurationPtr(d) + } + } + if cswrr.WeightExpirationPeriod != nil { + if d, err := time.ParseDuration(string(*cswrr.WeightExpirationPeriod)); err == nil { + lb.ClientSideWeightedRoundRobin.WeightExpirationPeriod = ir.MetaV1DurationPtr(d) + } + } + if cswrr.WeightUpdatePeriod != nil { + if d, err := time.ParseDuration(string(*cswrr.WeightUpdatePeriod)); err == nil { + lb.ClientSideWeightedRoundRobin.WeightUpdatePeriod = ir.MetaV1DurationPtr(d) + } + } + if cswrr.ErrorUtilizationPenalty != nil { + lb.ClientSideWeightedRoundRobin.ErrorUtilizationPenalty = cswrr.ErrorUtilizationPenalty + } + if len(cswrr.MetricNamesForComputingUtilization) > 0 { + lb.ClientSideWeightedRoundRobin.MetricNamesForComputingUtilization = append([]string(nil), cswrr.MetricNamesForComputingUtilization...) + } + } } // Add ZoneAware loadbalancer settings diff --git a/internal/ir/xds.go b/internal/ir/xds.go index 2e801c4dec..b1afc14c2f 100644 --- a/internal/ir/xds.go +++ b/internal/ir/xds.go @@ -2561,6 +2561,8 @@ type LoadBalancer struct { Random *Random `json:"random,omitempty" yaml:"random,omitempty"` // ConsistentHash load balancer policy ConsistentHash *ConsistentHash `json:"consistentHash,omitempty" yaml:"consistentHash,omitempty"` + // ClientSideWeightedRoundRobin load balancer policy + ClientSideWeightedRoundRobin *ClientSideWeightedRoundRobin `json:"clientSideWeightedRoundRobin,omitempty" yaml:"clientSideWeightedRoundRobin,omitempty"` // PreferLocal defines the configuration related to the distribution of requests between locality zones. PreferLocal *PreferLocalZone `json:"preferLocal,omitempty" yaml:"preferLocal,omitempty"` // EndpointOverride defines the configuration for endpoint override. @@ -2586,6 +2588,9 @@ func (l *LoadBalancer) Validate() error { if l.ConsistentHash != nil { matchCount++ } + if l.ClientSideWeightedRoundRobin != nil { + matchCount++ + } if matchCount != 1 { errs = errors.Join(errs, ErrLoadBalancerInvalid) } @@ -2613,6 +2618,18 @@ type LeastRequest struct { // +k8s:deepcopy-gen=true type Random struct{} +// ClientSideWeightedRoundRobin load balancer settings +// +k8s:deepcopy-gen=true +type ClientSideWeightedRoundRobin struct { + EnableOOBLoadReport *bool `json:"enableOOBLoadReport,omitempty" yaml:"enableOOBLoadReport,omitempty"` + OOBReportingPeriod *metav1.Duration `json:"oobReportingPeriod,omitempty" yaml:"oobReportingPeriod,omitempty"` + BlackoutPeriod *metav1.Duration `json:"blackoutPeriod,omitempty" yaml:"blackoutPeriod,omitempty"` + WeightExpirationPeriod *metav1.Duration `json:"weightExpirationPeriod,omitempty" yaml:"weightExpirationPeriod,omitempty"` + WeightUpdatePeriod *metav1.Duration `json:"weightUpdatePeriod,omitempty" yaml:"weightUpdatePeriod,omitempty"` + ErrorUtilizationPenalty *float32 `json:"errorUtilizationPenalty,omitempty" yaml:"errorUtilizationPenalty,omitempty"` + MetricNamesForComputingUtilization []string `json:"metricNamesForComputingUtilization,omitempty" yaml:"metricNamesForComputingUtilization,omitempty"` +} + // ConsistentHash load balancer settings // +k8s:deepcopy-gen=true type ConsistentHash struct { @@ -3315,4 +3332,6 @@ const ( RandomLoadBalancer LoadBalancerType = "Random" // ConsistentHashLoadBalancer is the consistent hash load balancer type. ConsistentHashLoadBalancer LoadBalancerType = "ConsistentHash" + // ClientSideWeightedRoundRobinLoadBalancer is the client-side weighted round robin load balancer type. + ClientSideWeightedRoundRobinLoadBalancer LoadBalancerType = "ClientSideWeightedRoundRobin" ) diff --git a/internal/ir/zz_generated.deepcopy.go b/internal/ir/zz_generated.deepcopy.go index f1e4d5addc..d41caef7c2 100644 --- a/internal/ir/zz_generated.deepcopy.go +++ b/internal/ir/zz_generated.deepcopy.go @@ -563,6 +563,56 @@ func (in *ClientIPDetectionSettings) DeepCopy() *ClientIPDetectionSettings { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClientSideWeightedRoundRobin) DeepCopyInto(out *ClientSideWeightedRoundRobin) { + *out = *in + if in.EnableOOBLoadReport != nil { + in, out := &in.EnableOOBLoadReport, &out.EnableOOBLoadReport + *out = new(bool) + **out = **in + } + if in.OOBReportingPeriod != nil { + in, out := &in.OOBReportingPeriod, &out.OOBReportingPeriod + *out = new(v1.Duration) + **out = **in + } + if in.BlackoutPeriod != nil { + in, out := &in.BlackoutPeriod, &out.BlackoutPeriod + *out = new(v1.Duration) + **out = **in + } + if in.WeightExpirationPeriod != nil { + in, out := &in.WeightExpirationPeriod, &out.WeightExpirationPeriod + *out = new(v1.Duration) + **out = **in + } + if in.WeightUpdatePeriod != nil { + in, out := &in.WeightUpdatePeriod, &out.WeightUpdatePeriod + *out = new(v1.Duration) + **out = **in + } + if in.ErrorUtilizationPenalty != nil { + in, out := &in.ErrorUtilizationPenalty, &out.ErrorUtilizationPenalty + *out = new(float32) + **out = **in + } + if in.MetricNamesForComputingUtilization != nil { + in, out := &in.MetricNamesForComputingUtilization, &out.MetricNamesForComputingUtilization + *out = make([]string, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClientSideWeightedRoundRobin. +func (in *ClientSideWeightedRoundRobin) DeepCopy() *ClientSideWeightedRoundRobin { + if in == nil { + return nil + } + out := new(ClientSideWeightedRoundRobin) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ClientTimeout) DeepCopyInto(out *ClientTimeout) { *out = *in @@ -2416,6 +2466,11 @@ func (in *LoadBalancer) DeepCopyInto(out *LoadBalancer) { *out = new(ConsistentHash) (*in).DeepCopyInto(*out) } + if in.ClientSideWeightedRoundRobin != nil { + in, out := &in.ClientSideWeightedRoundRobin, &out.ClientSideWeightedRoundRobin + *out = new(ClientSideWeightedRoundRobin) + (*in).DeepCopyInto(*out) + } if in.PreferLocal != nil { in, out := &in.PreferLocal, &out.PreferLocal *out = new(PreferLocalZone) diff --git a/internal/xds/translator/cluster.go b/internal/xds/translator/cluster.go index f35c85be7e..a8b0e1cfd0 100644 --- a/internal/xds/translator/cluster.go +++ b/internal/xds/translator/cluster.go @@ -19,6 +19,7 @@ import ( codecv3 "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/http/upstream_codec/v3" hcmv3 "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/http_connection_manager/v3" preservecasev3 "github.com/envoyproxy/go-control-plane/envoy/extensions/http/header_formatters/preserve_case/v3" + cswrrv3 "github.com/envoyproxy/go-control-plane/envoy/extensions/load_balancing_policies/client_side_weighted_round_robin/v3" cluster_providedv3 "github.com/envoyproxy/go-control-plane/envoy/extensions/load_balancing_policies/cluster_provided/v3" commonv3 "github.com/envoyproxy/go-control-plane/envoy/extensions/load_balancing_policies/common/v3" least_requestv3 "github.com/envoyproxy/go-control-plane/envoy/extensions/load_balancing_policies/least_request/v3" @@ -399,6 +400,44 @@ func buildXdsCluster(args *xdsClusterArgs) (*buildClusterResult, error) { }, }}, } + case args.loadBalancer.ClientSideWeightedRoundRobin != nil: + cluster.LbPolicy = clusterv3.Cluster_CLUSTER_PROVIDED + cswrr := &cswrrv3.ClientSideWeightedRoundRobin{} + if v := args.loadBalancer.ClientSideWeightedRoundRobin; v != nil { + if v.EnableOOBLoadReport != nil { + cswrr.EnableOobLoadReport = wrapperspb.Bool(*v.EnableOOBLoadReport) + } + if v.OOBReportingPeriod != nil && v.OOBReportingPeriod.Duration > 0 { + cswrr.OobReportingPeriod = durationpb.New(v.OOBReportingPeriod.Duration) + } + if v.BlackoutPeriod != nil && v.BlackoutPeriod.Duration > 0 { + cswrr.BlackoutPeriod = durationpb.New(v.BlackoutPeriod.Duration) + } + if v.WeightExpirationPeriod != nil && v.WeightExpirationPeriod.Duration > 0 { + cswrr.WeightExpirationPeriod = durationpb.New(v.WeightExpirationPeriod.Duration) + } + if v.WeightUpdatePeriod != nil && v.WeightUpdatePeriod.Duration > 0 { + cswrr.WeightUpdatePeriod = durationpb.New(v.WeightUpdatePeriod.Duration) + } + if v.ErrorUtilizationPenalty != nil { + cswrr.ErrorUtilizationPenalty = wrapperspb.Float(float32(*v.ErrorUtilizationPenalty)) + } + if len(v.MetricNamesForComputingUtilization) > 0 { + cswrr.MetricNamesForComputingUtilization = append([]string(nil), v.MetricNamesForComputingUtilization...) + } + } + typedCSWRR, err := proto.ToAnyWithValidation(cswrr) + if err != nil { + return nil, err + } + cluster.LoadBalancingPolicy = &clusterv3.LoadBalancingPolicy{ + Policies: []*clusterv3.LoadBalancingPolicy_Policy{{ + TypedExtensionConfig: &corev3.TypedExtensionConfig{ + Name: "envoy.load_balancing_policies.client_side_weighted_round_robin", + TypedConfig: typedCSWRR, + }, + }}, + } } if args.healthCheck != nil && args.healthCheck.Active != nil { @@ -1335,6 +1374,8 @@ func buildEndpointOverrideLoadBalancingPolicy(loadBalancer *ir.LoadBalancer) (*c fallbackType = ir.RandomLoadBalancer case loadBalancer.ConsistentHash != nil: fallbackType = ir.ConsistentHashLoadBalancer + case loadBalancer.ClientSideWeightedRoundRobin != nil: + fallbackType = ir.ClientSideWeightedRoundRobinLoadBalancer default: // Default to LeastRequest if no specific type is set fallbackType = ir.LeastRequestLoadBalancer @@ -1430,6 +1471,21 @@ func buildFallbackLoadBalancingPolicy(fallbackType ir.LoadBalancerType) (*cluste }, }, }, nil + case ir.ClientSideWeightedRoundRobinLoadBalancer: + fallbackPolicyAny, err := anypb.New(&cswrrv3.ClientSideWeightedRoundRobin{}) + if err != nil { + return nil, fmt.Errorf("failed to marshal ClientSideWeightedRoundRobin policy: %w", err) + } + return &clusterv3.LoadBalancingPolicy{ + Policies: []*clusterv3.LoadBalancingPolicy_Policy{ + { + TypedExtensionConfig: &corev3.TypedExtensionConfig{ + Name: "envoy.load_balancing_policies.client_side_weighted_round_robin", + TypedConfig: fallbackPolicyAny, + }, + }, + }, + }, nil default: return nil, fmt.Errorf("unsupported fallback policy: %s", fallbackType) } diff --git a/internal/xds/translator/cluster_test.go b/internal/xds/translator/cluster_test.go index 6127fded2e..663d70621d 100644 --- a/internal/xds/translator/cluster_test.go +++ b/internal/xds/translator/cluster_test.go @@ -159,3 +159,32 @@ func TestBuildXdsOutlierDetection(t *testing.T) { func requireCmpNoDiff(t *testing.T, expected, actual interface{}) { require.Empty(t, cmp.Diff(expected, actual, protocmp.Transform())) } + +func TestBuildCluster_WithClientSideWeightedRoundRobin(t *testing.T) { + args := &xdsClusterArgs{ + name: "test-cluster-cswrr", + endpointType: EndpointTypeStatic, + settings: []*ir.DestinationSetting{{ + Endpoints: []*ir.DestinationEndpoint{{Host: "127.0.0.1", Port: 8080}}, + }}, + loadBalancer: &ir.LoadBalancer{ClientSideWeightedRoundRobin: &ir.ClientSideWeightedRoundRobin{}}, + } + + result, err := buildXdsCluster(args) + require.NoError(t, err) + require.NotNil(t, result) + cluster := result.cluster + require.NotNil(t, cluster) + + // LbPolicy should be CLUSTER_PROVIDED when using typed LoadBalancingPolicy + require.Equal(t, clusterv3.Cluster_CLUSTER_PROVIDED, cluster.LbPolicy) + require.NotNil(t, cluster.LoadBalancingPolicy) + require.Len(t, cluster.LoadBalancingPolicy.Policies, 1) + + policy := cluster.LoadBalancingPolicy.Policies[0] + require.NotNil(t, policy) + require.NotNil(t, policy.TypedExtensionConfig) + require.Equal(t, "envoy.load_balancing_policies.client_side_weighted_round_robin", policy.TypedExtensionConfig.Name) + require.NotNil(t, policy.TypedExtensionConfig.TypedConfig) + require.Equal(t, "type.googleapis.com/envoy.extensions.load_balancing_policies.client_side_weighted_round_robin.v3.ClientSideWeightedRoundRobin", policy.TypedExtensionConfig.TypedConfig.TypeUrl) +} diff --git a/site/content/en/latest/api/extension_types.md b/site/content/en/latest/api/extension_types.md index 1d1086fb7d..dab1c8364e 100644 --- a/site/content/en/latest/api/extension_types.md +++ b/site/content/en/latest/api/extension_types.md @@ -705,6 +705,28 @@ _Appears in:_ | `customHeader` | _[CustomHeaderExtensionSettings](#customheaderextensionsettings)_ | false | | CustomHeader provides configuration for determining the client IP address for a request based on
a trusted custom HTTP header. This uses the custom_header original IP detection extension.
Refer to https://www.envoyproxy.io/docs/envoy/latest/api-v3/extensions/http/original_ip_detection/custom_header/v3/custom_header.proto
for more details. | +#### ClientSideWeightedRoundRobin + + + +ClientSideWeightedRoundRobin defines configuration for Envoy's Client-Side Weighted Round Robin policy. +See Envoy proto: envoy.extensions.load_balancing_policies.client_side_weighted_round_robin.v3.ClientSideWeightedRoundRobin +Note: SlowStart is not supported for this policy in Envoy Gateway at this time. + +_Appears in:_ +- [LoadBalancer](#loadbalancer) + +| Field | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| `enableOOBLoadReport` | _boolean_ | false | | Whether to enable out-of-band utilization reporting collection from the endpoints.
By default, per-request utilization reporting is used. | +| `oobReportingPeriod` | _[Duration](https://gateway-api.sigs.k8s.io/reference/1.4/spec/#duration)_ | false | | Load reporting interval to request from the server. Used only when enableOOBLoadReport is true.
Default is 10s; server may not provide reports as frequently as requested. | +| `blackoutPeriod` | _[Duration](https://gateway-api.sigs.k8s.io/reference/1.4/spec/#duration)_ | false | | A given endpoint must report load metrics continuously for at least this long before the endpoint weight will be used.
Default is 10s. | +| `weightExpirationPeriod` | _[Duration](https://gateway-api.sigs.k8s.io/reference/1.4/spec/#duration)_ | false | | If a given endpoint has not reported load metrics in this long, stop using the reported weight. Defaults to 3m. | +| `weightUpdatePeriod` | _[Duration](https://gateway-api.sigs.k8s.io/reference/1.4/spec/#duration)_ | false | | How often endpoint weights are recalculated. Values less than 100ms are capped at 100ms. Default 1s. | +| `errorUtilizationPenalty` | _float_ | false | | The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps.
Must be non-negative. Default is 1.0. | +| `metricNamesForComputingUtilization` | _string array_ | false | | Metric names used to compute utilization if application_utilization is not set.
For map fields in ORCA proto, use the form ".", e.g., "named_metrics.foo". | + + #### ClientTLSSettings @@ -3234,8 +3256,9 @@ _Appears in:_ | Field | Type | Required | Default | Description | | --- | --- | --- | --- | --- | -| `type` | _[LoadBalancerType](#loadbalancertype)_ | true | | Type decides the type of Load Balancer policy.
Valid LoadBalancerType values are
"ConsistentHash",
"LeastRequest",
"Random",
"RoundRobin". | +| `type` | _[LoadBalancerType](#loadbalancertype)_ | true | | Type decides the type of Load Balancer policy.
Valid LoadBalancerType values are
"ConsistentHash",
"LeastRequest",
"Random",
"RoundRobin",
"ClientSideWeightedRoundRobin". | | `consistentHash` | _[ConsistentHash](#consistenthash)_ | false | | ConsistentHash defines the configuration when the load balancer type is
set to ConsistentHash | +| `clientSideWeightedRoundRobin` | _[ClientSideWeightedRoundRobin](#clientsideweightedroundrobin)_ | false | | ClientSideWeightedRoundRobin defines the configuration when the load balancer type is
set to ClientSideWeightedRoundRobin. | | `endpointOverride` | _[EndpointOverride](#endpointoverride)_ | false | | EndpointOverride defines the configuration for endpoint override.
When specified, the load balancer will attempt to route requests to endpoints
based on the override information extracted from request headers or metadata.
If the override endpoints are not available, the configured load balancer policy will be used as fallback. | | `slowStart` | _[SlowStart](#slowstart)_ | false | | SlowStart defines the configuration related to the slow start load balancer policy.
If set, during slow start window, traffic sent to the newly added hosts will gradually increase.
Currently this is only supported for RoundRobin and LeastRequest load balancers | | `zoneAware` | _[ZoneAware](#zoneaware)_ | false | | ZoneAware defines the configuration related to the distribution of requests between locality zones. | @@ -3256,6 +3279,7 @@ _Appears in:_ | `LeastRequest` | LeastRequestLoadBalancerType load balancer policy.
| | `Random` | RandomLoadBalancerType load balancer policy.
| | `RoundRobin` | RoundRobinLoadBalancerType load balancer policy.
| +| `ClientSideWeightedRoundRobin` | ClientSideWeightedRoundRobinLoadBalancerType load balancer policy.
| #### LocalJWKS diff --git a/site/content/en/latest/concepts/load-balancing.md b/site/content/en/latest/concepts/load-balancing.md index a644ecefdb..c7f0be2045 100644 --- a/site/content/en/latest/concepts/load-balancing.md +++ b/site/content/en/latest/concepts/load-balancing.md @@ -23,6 +23,7 @@ Envoy Gateway supports several load balancing strategies that determine how traf - **Random** – Chooses a backend at random to balance load - **Least Request** – Sends the request to the backend with the fewest active requests (this is the default) - **Consistent Hash** – Routes requests based on a hash (e.g., client IP or header), which helps keep repeat requests going to the same backend (useful for session affinity) +- **Client-Side Weighted Round Robin (CS-WRR)** – Uses client-observed load reports (e.g., ORCA metrics) to dynamically weight endpoints; if no metrics are available, it behaves similar to even-weight round robin If no load balancing strategy is specified, Envoy Gateway uses **Least Request** by default. diff --git a/test/e2e/testdata/load_balancing_client_side_weighted_round_robin.yaml b/test/e2e/testdata/load_balancing_client_side_weighted_round_robin.yaml new file mode 100644 index 0000000000..5ca148b2f7 --- /dev/null +++ b/test/e2e/testdata/load_balancing_client_side_weighted_round_robin.yaml @@ -0,0 +1,80 @@ +apiVersion: v1 +kind: Service +metadata: + name: lb-backend-cswrr + namespace: gateway-conformance-infra +spec: + selector: + app: lb-backend-cswrr + ports: + - protocol: TCP + port: 8080 + targetPort: 3000 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: lb-backend-cswrr + namespace: gateway-conformance-infra + labels: + app: lb-backend-cswrr +spec: + replicas: 3 + selector: + matchLabels: + app: lb-backend-cswrr + template: + metadata: + labels: + app: lb-backend-cswrr + spec: + containers: + - name: backend + image: gcr.io/k8s-staging-gateway-api/echo-basic:v20231214-v1.0.0-140-gf544a46e + imagePullPolicy: IfNotPresent + env: + - name: POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name + - name: NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace + - name: SERVICE_NAME + value: lb-backend-cswrr + resources: + requests: + cpu: 10m +--- +apiVersion: gateway.envoyproxy.io/v1alpha1 +kind: BackendTrafficPolicy +metadata: + name: client-side-wrr-lb-policy + namespace: gateway-conformance-infra +spec: + targetRefs: + - group: gateway.networking.k8s.io + kind: HTTPRoute + name: client-side-wrr-lb-route + loadBalancer: + type: ClientSideWeightedRoundRobin + clientSideWeightedRoundRobin: + enableOOBLoadReport: false +--- +apiVersion: gateway.networking.k8s.io/v1 +kind: HTTPRoute +metadata: + name: client-side-wrr-lb-route + namespace: gateway-conformance-infra +spec: + parentRefs: + - name: same-namespace + rules: + - matches: + - path: + type: PathPrefix + value: /cswrr + backendRefs: + - name: lb-backend-cswrr + port: 8080 diff --git a/test/e2e/tests/load_balancing.go b/test/e2e/tests/load_balancing.go index 2e9bc7a840..b61b1edad1 100644 --- a/test/e2e/tests/load_balancing.go +++ b/test/e2e/tests/load_balancing.go @@ -44,9 +44,67 @@ func init() { ConsistentHashCookieLoadBalancingTest, EndpointOverrideLoadBalancingTest, MultiHeaderConsistentHashHeaderLoadBalancingTest, + ClientSideWeightedRoundRobinLoadBalancingTest, ) } +var ClientSideWeightedRoundRobinLoadBalancingTest = suite.ConformanceTest{ + ShortName: "ClientSideWeightedRoundRobinLoadBalancing", + Description: "Test for client-side weighted round robin load balancing type", + Manifests: []string{"testdata/load_balancing_client_side_weighted_round_robin.yaml"}, + Test: func(t *testing.T, suite *suite.ConformanceTestSuite) { + const ( + sendRequests = 90 + replicas = 3 + offset = 6 + ) + + ns := "gateway-conformance-infra" + routeNN := types.NamespacedName{Name: "client-side-wrr-lb-route", Namespace: ns} + gwNN := types.NamespacedName{Name: "same-namespace", Namespace: ns} + + ancestorRef := gwapiv1.ParentReference{ + Group: gatewayapi.GroupPtr(gwapiv1.GroupName), + Kind: gatewayapi.KindPtr(resource.KindGateway), + Namespace: gatewayapi.NamespacePtr(gwNN.Namespace), + Name: gwapiv1.ObjectName(gwNN.Name), + } + BackendTrafficPolicyMustBeAccepted(t, suite.Client, types.NamespacedName{Name: "client-side-wrr-lb-policy", Namespace: ns}, suite.ControllerName, ancestorRef) + WaitForPods(t, suite.Client, ns, map[string]string{"app": "lb-backend-cswrr"}, corev1.PodRunning, &PodReady) + + gwAddr := kubernetes.GatewayAndRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN), &gwapiv1.HTTPRoute{}, false, routeNN) + + t.Run("traffic should be split roughly evenly (defaults to equal weights without ORCA)", func(t *testing.T) { + expectedResponse := http.ExpectedResponse{ + Request: http.Request{ + Path: "/cswrr", + }, + Response: http.Response{ + StatusCodes: []int{200}, + }, + Namespace: ns, + } + req := http.MakeRequest(t, &expectedResponse, gwAddr, "HTTP", "http") + + compareFunc := func(trafficMap map[string]int) bool { + even := sendRequests / replicas + for _, count := range trafficMap { + if !AlmostEquals(count, even, offset) { + return false + } + } + return true + } + + if err := wait.PollUntilContextTimeout(context.TODO(), time.Second, 30*time.Second, true, func(_ context.Context) (bool, error) { + return runTrafficTest(t, suite, &req, &expectedResponse, sendRequests, compareFunc), nil + }); err != nil { + tlog.Errorf(t, "failed to run client-side weighted round robin load balancing test: %v", err) + } + }) + }, +} + var RoundRobinLoadBalancingTest = suite.ConformanceTest{ ShortName: "RoundRobinLoadBalancing", Description: "Test for round robin load balancing type", diff --git a/test/helm/gateway-crds-helm/all.out.yaml b/test/helm/gateway-crds-helm/all.out.yaml index 63dc101fdd..5ef8dd6e29 100644 --- a/test/helm/gateway-crds-helm/all.out.yaml +++ b/test/helm/gateway-crds-helm/all.out.yaml @@ -21810,6 +21810,53 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + clientSideWeightedRoundRobin: + description: |- + ClientSideWeightedRoundRobin defines the configuration when the load balancer type is + set to ClientSideWeightedRoundRobin. + properties: + blackoutPeriod: + description: |- + A given endpoint must report load metrics continuously for at least this long before the endpoint weight will be used. + Default is 10s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + enableOOBLoadReport: + description: |- + Whether to enable out-of-band utilization reporting collection from the endpoints. + By default, per-request utilization reporting is used. + type: boolean + errorUtilizationPenalty: + description: |- + The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. + Must be non-negative. Default is 1.0. + minimum: 0 + type: number + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + For map fields in ORCA proto, use the form ".", e.g., "named_metrics.foo". + items: + type: string + type: array + oobReportingPeriod: + description: |- + Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. + Default is 10s; server may not provide reports as frequently as requested. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightExpirationPeriod: + description: If a given endpoint has not reported load metrics + in this long, stop using the reported weight. Defaults to + 3m. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightUpdatePeriod: + description: How often endpoint weights are recalculated. + Values less than 100ms are capped at 100ms. Default 1s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + type: object consistentHash: description: |- ConsistentHash defines the configuration when the load balancer type is @@ -21955,12 +22002,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the configuration related to the @@ -22006,14 +22055,18 @@ spec: field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' + - message: If LoadBalancer type is ClientSideWeightedRoundRobin, clientSideWeightedRoundRobin + field needs to be set. + rule: 'self.type == ''ClientSideWeightedRoundRobin'' ? has(self.clientSideWeightedRoundRobin) + : !has(self.clientSideWeightedRoundRobin)' - message: Currently SlowStart is only supported for RoundRobin and LeastRequest load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) - : true ' + rule: 'self.type in [''Random'', ''ConsistentHash'', ''ClientSideWeightedRoundRobin''] + ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. - rule: 'self.type == ''ConsistentHash'' ? !has(self.zoneAware) : - true ' + rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] + ? !has(self.zoneAware) : true ' mergeType: description: |- MergeType determines how this configuration is merged with existing BackendTrafficPolicy @@ -26339,6 +26392,54 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + clientSideWeightedRoundRobin: + description: |- + ClientSideWeightedRoundRobin defines the configuration when the load balancer type is + set to ClientSideWeightedRoundRobin. + properties: + blackoutPeriod: + description: |- + A given endpoint must report load metrics continuously for at least this long before the endpoint weight will be used. + Default is 10s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + enableOOBLoadReport: + description: |- + Whether to enable out-of-band utilization reporting collection from the endpoints. + By default, per-request utilization reporting is used. + type: boolean + errorUtilizationPenalty: + description: |- + The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. + Must be non-negative. Default is 1.0. + minimum: 0 + type: number + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + For map fields in ORCA proto, use the form ".", e.g., "named_metrics.foo". + items: + type: string + type: array + oobReportingPeriod: + description: |- + Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. + Default is 10s; server may not provide reports as frequently as requested. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightExpirationPeriod: + description: If a given endpoint has not reported + load metrics in this long, stop using the reported + weight. Defaults to 3m. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightUpdatePeriod: + description: How often endpoint weights are recalculated. + Values less than 100ms are capped at 100ms. Default + 1s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + type: object consistentHash: description: |- ConsistentHash defines the configuration when the load balancer type is @@ -26489,12 +26590,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the configuration related @@ -26542,14 +26645,18 @@ spec: field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' + - message: If LoadBalancer type is ClientSideWeightedRoundRobin, + clientSideWeightedRoundRobin field needs to be set. + rule: 'self.type == ''ClientSideWeightedRoundRobin'' ? + has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' - message: Currently SlowStart is only supported for RoundRobin and LeastRequest load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash''] ? - !has(self.slowStart) : true ' + rule: 'self.type in [''Random'', ''ConsistentHash'', ''ClientSideWeightedRoundRobin''] + ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. - rule: 'self.type == ''ConsistentHash'' ? !has(self.zoneAware) - : true ' + rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] + ? !has(self.zoneAware) : true ' proxyProtocol: description: ProxyProtocol enables the Proxy Protocol when communicating with the backend. @@ -39966,6 +40073,57 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + clientSideWeightedRoundRobin: + description: |- + ClientSideWeightedRoundRobin defines the configuration when the load balancer type is + set to ClientSideWeightedRoundRobin. + properties: + blackoutPeriod: + description: |- + A given endpoint must report load metrics continuously for at least this long before the endpoint weight will be used. + Default is 10s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + enableOOBLoadReport: + description: |- + Whether to enable out-of-band utilization reporting collection from the endpoints. + By default, per-request utilization reporting is used. + type: boolean + errorUtilizationPenalty: + description: |- + The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. + Must be non-negative. Default is 1.0. + minimum: 0 + type: number + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + For map fields in ORCA proto, use the form ".", e.g., "named_metrics.foo". + items: + type: string + type: array + oobReportingPeriod: + description: |- + Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. + Default is 10s; server may not provide reports as frequently as requested. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightExpirationPeriod: + description: If a given endpoint + has not reported load metrics + in this long, stop using the + reported weight. Defaults to + 3m. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightUpdatePeriod: + description: How often endpoint + weights are recalculated. Values + less than 100ms are capped at + 100ms. Default 1s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + type: object consistentHash: description: |- ConsistentHash defines the configuration when the load balancer type is @@ -40128,12 +40286,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the @@ -40187,15 +40347,23 @@ spec: consistentHash field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' + - message: If LoadBalancer type is ClientSideWeightedRoundRobin, + clientSideWeightedRoundRobin field + needs to be set. + rule: 'self.type == ''ClientSideWeightedRoundRobin'' + ? has(self.clientSideWeightedRoundRobin) + : !has(self.clientSideWeightedRoundRobin)' - message: Currently SlowStart is only supported for RoundRobin and LeastRequest load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash''] + rule: 'self.type in [''Random'', ''ConsistentHash'', + ''ClientSideWeightedRoundRobin''] ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. - rule: 'self.type == ''ConsistentHash'' + rule: 'self.type in [''ConsistentHash'', + ''ClientSideWeightedRoundRobin''] ? !has(self.zoneAware) : true ' proxyProtocol: description: ProxyProtocol enables the @@ -41173,6 +41341,57 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + clientSideWeightedRoundRobin: + description: |- + ClientSideWeightedRoundRobin defines the configuration when the load balancer type is + set to ClientSideWeightedRoundRobin. + properties: + blackoutPeriod: + description: |- + A given endpoint must report load metrics continuously for at least this long before the endpoint weight will be used. + Default is 10s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + enableOOBLoadReport: + description: |- + Whether to enable out-of-band utilization reporting collection from the endpoints. + By default, per-request utilization reporting is used. + type: boolean + errorUtilizationPenalty: + description: |- + The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. + Must be non-negative. Default is 1.0. + minimum: 0 + type: number + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + For map fields in ORCA proto, use the form ".", e.g., "named_metrics.foo". + items: + type: string + type: array + oobReportingPeriod: + description: |- + Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. + Default is 10s; server may not provide reports as frequently as requested. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightExpirationPeriod: + description: If a given endpoint + has not reported load metrics + in this long, stop using the + reported weight. Defaults to + 3m. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightUpdatePeriod: + description: How often endpoint + weights are recalculated. Values + less than 100ms are capped at + 100ms. Default 1s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + type: object consistentHash: description: |- ConsistentHash defines the configuration when the load balancer type is @@ -41335,12 +41554,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the @@ -41394,15 +41615,23 @@ spec: consistentHash field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' + - message: If LoadBalancer type is ClientSideWeightedRoundRobin, + clientSideWeightedRoundRobin field + needs to be set. + rule: 'self.type == ''ClientSideWeightedRoundRobin'' + ? has(self.clientSideWeightedRoundRobin) + : !has(self.clientSideWeightedRoundRobin)' - message: Currently SlowStart is only supported for RoundRobin and LeastRequest load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash''] + rule: 'self.type in [''Random'', ''ConsistentHash'', + ''ClientSideWeightedRoundRobin''] ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. - rule: 'self.type == ''ConsistentHash'' + rule: 'self.type in [''ConsistentHash'', + ''ClientSideWeightedRoundRobin''] ? !has(self.zoneAware) : true ' proxyProtocol: description: ProxyProtocol enables the @@ -42474,6 +42703,56 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + clientSideWeightedRoundRobin: + description: |- + ClientSideWeightedRoundRobin defines the configuration when the load balancer type is + set to ClientSideWeightedRoundRobin. + properties: + blackoutPeriod: + description: |- + A given endpoint must report load metrics continuously for at least this long before the endpoint weight will be used. + Default is 10s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + enableOOBLoadReport: + description: |- + Whether to enable out-of-band utilization reporting collection from the endpoints. + By default, per-request utilization reporting is used. + type: boolean + errorUtilizationPenalty: + description: |- + The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. + Must be non-negative. Default is 1.0. + minimum: 0 + type: number + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + For map fields in ORCA proto, use the form ".", e.g., "named_metrics.foo". + items: + type: string + type: array + oobReportingPeriod: + description: |- + Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. + Default is 10s; server may not provide reports as frequently as requested. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightExpirationPeriod: + description: If a given endpoint has + not reported load metrics in this + long, stop using the reported weight. + Defaults to 3m. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightUpdatePeriod: + description: How often endpoint weights + are recalculated. Values less than + 100ms are capped at 100ms. Default + 1s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + type: object consistentHash: description: |- ConsistentHash defines the configuration when the load balancer type is @@ -42630,12 +42909,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the configuration @@ -42688,15 +42969,22 @@ spec: consistentHash field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' + - message: If LoadBalancer type is ClientSideWeightedRoundRobin, + clientSideWeightedRoundRobin field needs + to be set. + rule: 'self.type == ''ClientSideWeightedRoundRobin'' + ? has(self.clientSideWeightedRoundRobin) + : !has(self.clientSideWeightedRoundRobin)' - message: Currently SlowStart is only supported for RoundRobin and LeastRequest load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash''] - ? !has(self.slowStart) : true ' + rule: 'self.type in [''Random'', ''ConsistentHash'', + ''ClientSideWeightedRoundRobin''] ? !has(self.slowStart) + : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. - rule: 'self.type == ''ConsistentHash'' ? !has(self.zoneAware) - : true ' + rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] + ? !has(self.zoneAware) : true ' proxyProtocol: description: ProxyProtocol enables the Proxy Protocol when communicating with the backend. @@ -43682,6 +43970,54 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + clientSideWeightedRoundRobin: + description: |- + ClientSideWeightedRoundRobin defines the configuration when the load balancer type is + set to ClientSideWeightedRoundRobin. + properties: + blackoutPeriod: + description: |- + A given endpoint must report load metrics continuously for at least this long before the endpoint weight will be used. + Default is 10s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + enableOOBLoadReport: + description: |- + Whether to enable out-of-band utilization reporting collection from the endpoints. + By default, per-request utilization reporting is used. + type: boolean + errorUtilizationPenalty: + description: |- + The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. + Must be non-negative. Default is 1.0. + minimum: 0 + type: number + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + For map fields in ORCA proto, use the form ".", e.g., "named_metrics.foo". + items: + type: string + type: array + oobReportingPeriod: + description: |- + Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. + Default is 10s; server may not provide reports as frequently as requested. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightExpirationPeriod: + description: If a given endpoint has not reported + load metrics in this long, stop using the + reported weight. Defaults to 3m. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightUpdatePeriod: + description: How often endpoint weights are + recalculated. Values less than 100ms are + capped at 100ms. Default 1s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + type: object consistentHash: description: |- ConsistentHash defines the configuration when the load balancer type is @@ -43835,12 +44171,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the configuration @@ -43891,14 +44229,20 @@ spec: consistentHash field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' + - message: If LoadBalancer type is ClientSideWeightedRoundRobin, + clientSideWeightedRoundRobin field needs to be + set. + rule: 'self.type == ''ClientSideWeightedRoundRobin'' + ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' - message: Currently SlowStart is only supported for RoundRobin and LeastRequest load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash''] - ? !has(self.slowStart) : true ' + rule: 'self.type in [''Random'', ''ConsistentHash'', + ''ClientSideWeightedRoundRobin''] ? !has(self.slowStart) + : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. - rule: 'self.type == ''ConsistentHash'' ? !has(self.zoneAware) - : true ' + rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] + ? !has(self.zoneAware) : true ' proxyProtocol: description: ProxyProtocol enables the Proxy Protocol when communicating with the backend. @@ -45863,6 +46207,54 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + clientSideWeightedRoundRobin: + description: |- + ClientSideWeightedRoundRobin defines the configuration when the load balancer type is + set to ClientSideWeightedRoundRobin. + properties: + blackoutPeriod: + description: |- + A given endpoint must report load metrics continuously for at least this long before the endpoint weight will be used. + Default is 10s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + enableOOBLoadReport: + description: |- + Whether to enable out-of-band utilization reporting collection from the endpoints. + By default, per-request utilization reporting is used. + type: boolean + errorUtilizationPenalty: + description: |- + The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. + Must be non-negative. Default is 1.0. + minimum: 0 + type: number + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + For map fields in ORCA proto, use the form ".", e.g., "named_metrics.foo". + items: + type: string + type: array + oobReportingPeriod: + description: |- + Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. + Default is 10s; server may not provide reports as frequently as requested. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightExpirationPeriod: + description: If a given endpoint has not reported + load metrics in this long, stop using the reported + weight. Defaults to 3m. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightUpdatePeriod: + description: How often endpoint weights are recalculated. + Values less than 100ms are capped at 100ms. + Default 1s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + type: object consistentHash: description: |- ConsistentHash defines the configuration when the load balancer type is @@ -46014,12 +46406,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the configuration related @@ -46069,14 +46463,19 @@ spec: field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' + - message: If LoadBalancer type is ClientSideWeightedRoundRobin, + clientSideWeightedRoundRobin field needs to be set. + rule: 'self.type == ''ClientSideWeightedRoundRobin'' + ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' - message: Currently SlowStart is only supported for RoundRobin and LeastRequest load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash''] - ? !has(self.slowStart) : true ' + rule: 'self.type in [''Random'', ''ConsistentHash'', + ''ClientSideWeightedRoundRobin''] ? !has(self.slowStart) + : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. - rule: 'self.type == ''ConsistentHash'' ? !has(self.zoneAware) - : true ' + rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] + ? !has(self.zoneAware) : true ' proxyProtocol: description: ProxyProtocol enables the Proxy Protocol when communicating with the backend. @@ -46960,6 +47359,54 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + clientSideWeightedRoundRobin: + description: |- + ClientSideWeightedRoundRobin defines the configuration when the load balancer type is + set to ClientSideWeightedRoundRobin. + properties: + blackoutPeriod: + description: |- + A given endpoint must report load metrics continuously for at least this long before the endpoint weight will be used. + Default is 10s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + enableOOBLoadReport: + description: |- + Whether to enable out-of-band utilization reporting collection from the endpoints. + By default, per-request utilization reporting is used. + type: boolean + errorUtilizationPenalty: + description: |- + The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. + Must be non-negative. Default is 1.0. + minimum: 0 + type: number + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + For map fields in ORCA proto, use the form ".", e.g., "named_metrics.foo". + items: + type: string + type: array + oobReportingPeriod: + description: |- + Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. + Default is 10s; server may not provide reports as frequently as requested. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightExpirationPeriod: + description: If a given endpoint has not reported + load metrics in this long, stop using the reported + weight. Defaults to 3m. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightUpdatePeriod: + description: How often endpoint weights are recalculated. + Values less than 100ms are capped at 100ms. + Default 1s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + type: object consistentHash: description: |- ConsistentHash defines the configuration when the load balancer type is @@ -47111,12 +47558,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the configuration related @@ -47166,14 +47615,19 @@ spec: field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' + - message: If LoadBalancer type is ClientSideWeightedRoundRobin, + clientSideWeightedRoundRobin field needs to be set. + rule: 'self.type == ''ClientSideWeightedRoundRobin'' + ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' - message: Currently SlowStart is only supported for RoundRobin and LeastRequest load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash''] - ? !has(self.slowStart) : true ' + rule: 'self.type in [''Random'', ''ConsistentHash'', + ''ClientSideWeightedRoundRobin''] ? !has(self.slowStart) + : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. - rule: 'self.type == ''ConsistentHash'' ? !has(self.zoneAware) - : true ' + rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] + ? !has(self.zoneAware) : true ' proxyProtocol: description: ProxyProtocol enables the Proxy Protocol when communicating with the backend. @@ -48268,6 +48722,55 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + clientSideWeightedRoundRobin: + description: |- + ClientSideWeightedRoundRobin defines the configuration when the load balancer type is + set to ClientSideWeightedRoundRobin. + properties: + blackoutPeriod: + description: |- + A given endpoint must report load metrics continuously for at least this long before the endpoint weight will be used. + Default is 10s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + enableOOBLoadReport: + description: |- + Whether to enable out-of-band utilization reporting collection from the endpoints. + By default, per-request utilization reporting is used. + type: boolean + errorUtilizationPenalty: + description: |- + The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. + Must be non-negative. Default is 1.0. + minimum: 0 + type: number + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + For map fields in ORCA proto, use the form ".", e.g., "named_metrics.foo". + items: + type: string + type: array + oobReportingPeriod: + description: |- + Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. + Default is 10s; server may not provide reports as frequently as requested. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightExpirationPeriod: + description: If a given endpoint has not + reported load metrics in this long, stop + using the reported weight. Defaults to + 3m. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightUpdatePeriod: + description: How often endpoint weights + are recalculated. Values less than 100ms + are capped at 100ms. Default 1s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + type: object consistentHash: description: |- ConsistentHash defines the configuration when the load balancer type is @@ -48422,12 +48925,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the configuration @@ -48478,15 +48983,21 @@ spec: consistentHash field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' + - message: If LoadBalancer type is ClientSideWeightedRoundRobin, + clientSideWeightedRoundRobin field needs to + be set. + rule: 'self.type == ''ClientSideWeightedRoundRobin'' + ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' - message: Currently SlowStart is only supported for RoundRobin and LeastRequest load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash''] - ? !has(self.slowStart) : true ' + rule: 'self.type in [''Random'', ''ConsistentHash'', + ''ClientSideWeightedRoundRobin''] ? !has(self.slowStart) + : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. - rule: 'self.type == ''ConsistentHash'' ? !has(self.zoneAware) - : true ' + rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] + ? !has(self.zoneAware) : true ' proxyProtocol: description: ProxyProtocol enables the Proxy Protocol when communicating with the backend. @@ -49634,6 +50145,54 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + clientSideWeightedRoundRobin: + description: |- + ClientSideWeightedRoundRobin defines the configuration when the load balancer type is + set to ClientSideWeightedRoundRobin. + properties: + blackoutPeriod: + description: |- + A given endpoint must report load metrics continuously for at least this long before the endpoint weight will be used. + Default is 10s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + enableOOBLoadReport: + description: |- + Whether to enable out-of-band utilization reporting collection from the endpoints. + By default, per-request utilization reporting is used. + type: boolean + errorUtilizationPenalty: + description: |- + The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. + Must be non-negative. Default is 1.0. + minimum: 0 + type: number + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + For map fields in ORCA proto, use the form ".", e.g., "named_metrics.foo". + items: + type: string + type: array + oobReportingPeriod: + description: |- + Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. + Default is 10s; server may not provide reports as frequently as requested. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightExpirationPeriod: + description: If a given endpoint has not reported + load metrics in this long, stop using the reported + weight. Defaults to 3m. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightUpdatePeriod: + description: How often endpoint weights are recalculated. + Values less than 100ms are capped at 100ms. + Default 1s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + type: object consistentHash: description: |- ConsistentHash defines the configuration when the load balancer type is @@ -49785,12 +50344,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the configuration related @@ -49840,14 +50401,19 @@ spec: field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' + - message: If LoadBalancer type is ClientSideWeightedRoundRobin, + clientSideWeightedRoundRobin field needs to be set. + rule: 'self.type == ''ClientSideWeightedRoundRobin'' + ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' - message: Currently SlowStart is only supported for RoundRobin and LeastRequest load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash''] - ? !has(self.slowStart) : true ' + rule: 'self.type in [''Random'', ''ConsistentHash'', + ''ClientSideWeightedRoundRobin''] ? !has(self.slowStart) + : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. - rule: 'self.type == ''ConsistentHash'' ? !has(self.zoneAware) - : true ' + rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] + ? !has(self.zoneAware) : true ' proxyProtocol: description: ProxyProtocol enables the Proxy Protocol when communicating with the backend. diff --git a/test/helm/gateway-crds-helm/envoy-gateway-crds.out.yaml b/test/helm/gateway-crds-helm/envoy-gateway-crds.out.yaml index ae2d5c6e12..add04c7d38 100644 --- a/test/helm/gateway-crds-helm/envoy-gateway-crds.out.yaml +++ b/test/helm/gateway-crds-helm/envoy-gateway-crds.out.yaml @@ -1154,6 +1154,53 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + clientSideWeightedRoundRobin: + description: |- + ClientSideWeightedRoundRobin defines the configuration when the load balancer type is + set to ClientSideWeightedRoundRobin. + properties: + blackoutPeriod: + description: |- + A given endpoint must report load metrics continuously for at least this long before the endpoint weight will be used. + Default is 10s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + enableOOBLoadReport: + description: |- + Whether to enable out-of-band utilization reporting collection from the endpoints. + By default, per-request utilization reporting is used. + type: boolean + errorUtilizationPenalty: + description: |- + The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. + Must be non-negative. Default is 1.0. + minimum: 0 + type: number + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + For map fields in ORCA proto, use the form ".", e.g., "named_metrics.foo". + items: + type: string + type: array + oobReportingPeriod: + description: |- + Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. + Default is 10s; server may not provide reports as frequently as requested. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightExpirationPeriod: + description: If a given endpoint has not reported load metrics + in this long, stop using the reported weight. Defaults to + 3m. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightUpdatePeriod: + description: How often endpoint weights are recalculated. + Values less than 100ms are capped at 100ms. Default 1s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + type: object consistentHash: description: |- ConsistentHash defines the configuration when the load balancer type is @@ -1299,12 +1346,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the configuration related to the @@ -1350,14 +1399,18 @@ spec: field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' + - message: If LoadBalancer type is ClientSideWeightedRoundRobin, clientSideWeightedRoundRobin + field needs to be set. + rule: 'self.type == ''ClientSideWeightedRoundRobin'' ? has(self.clientSideWeightedRoundRobin) + : !has(self.clientSideWeightedRoundRobin)' - message: Currently SlowStart is only supported for RoundRobin and LeastRequest load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) - : true ' + rule: 'self.type in [''Random'', ''ConsistentHash'', ''ClientSideWeightedRoundRobin''] + ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. - rule: 'self.type == ''ConsistentHash'' ? !has(self.zoneAware) : - true ' + rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] + ? !has(self.zoneAware) : true ' mergeType: description: |- MergeType determines how this configuration is merged with existing BackendTrafficPolicy @@ -5683,6 +5736,54 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + clientSideWeightedRoundRobin: + description: |- + ClientSideWeightedRoundRobin defines the configuration when the load balancer type is + set to ClientSideWeightedRoundRobin. + properties: + blackoutPeriod: + description: |- + A given endpoint must report load metrics continuously for at least this long before the endpoint weight will be used. + Default is 10s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + enableOOBLoadReport: + description: |- + Whether to enable out-of-band utilization reporting collection from the endpoints. + By default, per-request utilization reporting is used. + type: boolean + errorUtilizationPenalty: + description: |- + The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. + Must be non-negative. Default is 1.0. + minimum: 0 + type: number + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + For map fields in ORCA proto, use the form ".", e.g., "named_metrics.foo". + items: + type: string + type: array + oobReportingPeriod: + description: |- + Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. + Default is 10s; server may not provide reports as frequently as requested. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightExpirationPeriod: + description: If a given endpoint has not reported + load metrics in this long, stop using the reported + weight. Defaults to 3m. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightUpdatePeriod: + description: How often endpoint weights are recalculated. + Values less than 100ms are capped at 100ms. Default + 1s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + type: object consistentHash: description: |- ConsistentHash defines the configuration when the load balancer type is @@ -5833,12 +5934,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the configuration related @@ -5886,14 +5989,18 @@ spec: field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' + - message: If LoadBalancer type is ClientSideWeightedRoundRobin, + clientSideWeightedRoundRobin field needs to be set. + rule: 'self.type == ''ClientSideWeightedRoundRobin'' ? + has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' - message: Currently SlowStart is only supported for RoundRobin and LeastRequest load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash''] ? - !has(self.slowStart) : true ' + rule: 'self.type in [''Random'', ''ConsistentHash'', ''ClientSideWeightedRoundRobin''] + ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. - rule: 'self.type == ''ConsistentHash'' ? !has(self.zoneAware) - : true ' + rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] + ? !has(self.zoneAware) : true ' proxyProtocol: description: ProxyProtocol enables the Proxy Protocol when communicating with the backend. @@ -19310,6 +19417,57 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + clientSideWeightedRoundRobin: + description: |- + ClientSideWeightedRoundRobin defines the configuration when the load balancer type is + set to ClientSideWeightedRoundRobin. + properties: + blackoutPeriod: + description: |- + A given endpoint must report load metrics continuously for at least this long before the endpoint weight will be used. + Default is 10s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + enableOOBLoadReport: + description: |- + Whether to enable out-of-band utilization reporting collection from the endpoints. + By default, per-request utilization reporting is used. + type: boolean + errorUtilizationPenalty: + description: |- + The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. + Must be non-negative. Default is 1.0. + minimum: 0 + type: number + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + For map fields in ORCA proto, use the form ".", e.g., "named_metrics.foo". + items: + type: string + type: array + oobReportingPeriod: + description: |- + Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. + Default is 10s; server may not provide reports as frequently as requested. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightExpirationPeriod: + description: If a given endpoint + has not reported load metrics + in this long, stop using the + reported weight. Defaults to + 3m. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightUpdatePeriod: + description: How often endpoint + weights are recalculated. Values + less than 100ms are capped at + 100ms. Default 1s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + type: object consistentHash: description: |- ConsistentHash defines the configuration when the load balancer type is @@ -19472,12 +19630,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the @@ -19531,15 +19691,23 @@ spec: consistentHash field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' + - message: If LoadBalancer type is ClientSideWeightedRoundRobin, + clientSideWeightedRoundRobin field + needs to be set. + rule: 'self.type == ''ClientSideWeightedRoundRobin'' + ? has(self.clientSideWeightedRoundRobin) + : !has(self.clientSideWeightedRoundRobin)' - message: Currently SlowStart is only supported for RoundRobin and LeastRequest load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash''] + rule: 'self.type in [''Random'', ''ConsistentHash'', + ''ClientSideWeightedRoundRobin''] ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. - rule: 'self.type == ''ConsistentHash'' + rule: 'self.type in [''ConsistentHash'', + ''ClientSideWeightedRoundRobin''] ? !has(self.zoneAware) : true ' proxyProtocol: description: ProxyProtocol enables the @@ -20517,6 +20685,57 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + clientSideWeightedRoundRobin: + description: |- + ClientSideWeightedRoundRobin defines the configuration when the load balancer type is + set to ClientSideWeightedRoundRobin. + properties: + blackoutPeriod: + description: |- + A given endpoint must report load metrics continuously for at least this long before the endpoint weight will be used. + Default is 10s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + enableOOBLoadReport: + description: |- + Whether to enable out-of-band utilization reporting collection from the endpoints. + By default, per-request utilization reporting is used. + type: boolean + errorUtilizationPenalty: + description: |- + The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. + Must be non-negative. Default is 1.0. + minimum: 0 + type: number + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + For map fields in ORCA proto, use the form ".", e.g., "named_metrics.foo". + items: + type: string + type: array + oobReportingPeriod: + description: |- + Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. + Default is 10s; server may not provide reports as frequently as requested. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightExpirationPeriod: + description: If a given endpoint + has not reported load metrics + in this long, stop using the + reported weight. Defaults to + 3m. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightUpdatePeriod: + description: How often endpoint + weights are recalculated. Values + less than 100ms are capped at + 100ms. Default 1s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + type: object consistentHash: description: |- ConsistentHash defines the configuration when the load balancer type is @@ -20679,12 +20898,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the @@ -20738,15 +20959,23 @@ spec: consistentHash field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' + - message: If LoadBalancer type is ClientSideWeightedRoundRobin, + clientSideWeightedRoundRobin field + needs to be set. + rule: 'self.type == ''ClientSideWeightedRoundRobin'' + ? has(self.clientSideWeightedRoundRobin) + : !has(self.clientSideWeightedRoundRobin)' - message: Currently SlowStart is only supported for RoundRobin and LeastRequest load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash''] + rule: 'self.type in [''Random'', ''ConsistentHash'', + ''ClientSideWeightedRoundRobin''] ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. - rule: 'self.type == ''ConsistentHash'' + rule: 'self.type in [''ConsistentHash'', + ''ClientSideWeightedRoundRobin''] ? !has(self.zoneAware) : true ' proxyProtocol: description: ProxyProtocol enables the @@ -21818,6 +22047,56 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + clientSideWeightedRoundRobin: + description: |- + ClientSideWeightedRoundRobin defines the configuration when the load balancer type is + set to ClientSideWeightedRoundRobin. + properties: + blackoutPeriod: + description: |- + A given endpoint must report load metrics continuously for at least this long before the endpoint weight will be used. + Default is 10s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + enableOOBLoadReport: + description: |- + Whether to enable out-of-band utilization reporting collection from the endpoints. + By default, per-request utilization reporting is used. + type: boolean + errorUtilizationPenalty: + description: |- + The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. + Must be non-negative. Default is 1.0. + minimum: 0 + type: number + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + For map fields in ORCA proto, use the form ".", e.g., "named_metrics.foo". + items: + type: string + type: array + oobReportingPeriod: + description: |- + Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. + Default is 10s; server may not provide reports as frequently as requested. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightExpirationPeriod: + description: If a given endpoint has + not reported load metrics in this + long, stop using the reported weight. + Defaults to 3m. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightUpdatePeriod: + description: How often endpoint weights + are recalculated. Values less than + 100ms are capped at 100ms. Default + 1s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + type: object consistentHash: description: |- ConsistentHash defines the configuration when the load balancer type is @@ -21974,12 +22253,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the configuration @@ -22032,15 +22313,22 @@ spec: consistentHash field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' + - message: If LoadBalancer type is ClientSideWeightedRoundRobin, + clientSideWeightedRoundRobin field needs + to be set. + rule: 'self.type == ''ClientSideWeightedRoundRobin'' + ? has(self.clientSideWeightedRoundRobin) + : !has(self.clientSideWeightedRoundRobin)' - message: Currently SlowStart is only supported for RoundRobin and LeastRequest load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash''] - ? !has(self.slowStart) : true ' + rule: 'self.type in [''Random'', ''ConsistentHash'', + ''ClientSideWeightedRoundRobin''] ? !has(self.slowStart) + : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. - rule: 'self.type == ''ConsistentHash'' ? !has(self.zoneAware) - : true ' + rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] + ? !has(self.zoneAware) : true ' proxyProtocol: description: ProxyProtocol enables the Proxy Protocol when communicating with the backend. @@ -23026,6 +23314,54 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + clientSideWeightedRoundRobin: + description: |- + ClientSideWeightedRoundRobin defines the configuration when the load balancer type is + set to ClientSideWeightedRoundRobin. + properties: + blackoutPeriod: + description: |- + A given endpoint must report load metrics continuously for at least this long before the endpoint weight will be used. + Default is 10s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + enableOOBLoadReport: + description: |- + Whether to enable out-of-band utilization reporting collection from the endpoints. + By default, per-request utilization reporting is used. + type: boolean + errorUtilizationPenalty: + description: |- + The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. + Must be non-negative. Default is 1.0. + minimum: 0 + type: number + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + For map fields in ORCA proto, use the form ".", e.g., "named_metrics.foo". + items: + type: string + type: array + oobReportingPeriod: + description: |- + Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. + Default is 10s; server may not provide reports as frequently as requested. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightExpirationPeriod: + description: If a given endpoint has not reported + load metrics in this long, stop using the + reported weight. Defaults to 3m. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightUpdatePeriod: + description: How often endpoint weights are + recalculated. Values less than 100ms are + capped at 100ms. Default 1s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + type: object consistentHash: description: |- ConsistentHash defines the configuration when the load balancer type is @@ -23179,12 +23515,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the configuration @@ -23235,14 +23573,20 @@ spec: consistentHash field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' + - message: If LoadBalancer type is ClientSideWeightedRoundRobin, + clientSideWeightedRoundRobin field needs to be + set. + rule: 'self.type == ''ClientSideWeightedRoundRobin'' + ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' - message: Currently SlowStart is only supported for RoundRobin and LeastRequest load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash''] - ? !has(self.slowStart) : true ' + rule: 'self.type in [''Random'', ''ConsistentHash'', + ''ClientSideWeightedRoundRobin''] ? !has(self.slowStart) + : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. - rule: 'self.type == ''ConsistentHash'' ? !has(self.zoneAware) - : true ' + rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] + ? !has(self.zoneAware) : true ' proxyProtocol: description: ProxyProtocol enables the Proxy Protocol when communicating with the backend. @@ -25207,6 +25551,54 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + clientSideWeightedRoundRobin: + description: |- + ClientSideWeightedRoundRobin defines the configuration when the load balancer type is + set to ClientSideWeightedRoundRobin. + properties: + blackoutPeriod: + description: |- + A given endpoint must report load metrics continuously for at least this long before the endpoint weight will be used. + Default is 10s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + enableOOBLoadReport: + description: |- + Whether to enable out-of-band utilization reporting collection from the endpoints. + By default, per-request utilization reporting is used. + type: boolean + errorUtilizationPenalty: + description: |- + The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. + Must be non-negative. Default is 1.0. + minimum: 0 + type: number + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + For map fields in ORCA proto, use the form ".", e.g., "named_metrics.foo". + items: + type: string + type: array + oobReportingPeriod: + description: |- + Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. + Default is 10s; server may not provide reports as frequently as requested. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightExpirationPeriod: + description: If a given endpoint has not reported + load metrics in this long, stop using the reported + weight. Defaults to 3m. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightUpdatePeriod: + description: How often endpoint weights are recalculated. + Values less than 100ms are capped at 100ms. + Default 1s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + type: object consistentHash: description: |- ConsistentHash defines the configuration when the load balancer type is @@ -25358,12 +25750,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the configuration related @@ -25413,14 +25807,19 @@ spec: field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' + - message: If LoadBalancer type is ClientSideWeightedRoundRobin, + clientSideWeightedRoundRobin field needs to be set. + rule: 'self.type == ''ClientSideWeightedRoundRobin'' + ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' - message: Currently SlowStart is only supported for RoundRobin and LeastRequest load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash''] - ? !has(self.slowStart) : true ' + rule: 'self.type in [''Random'', ''ConsistentHash'', + ''ClientSideWeightedRoundRobin''] ? !has(self.slowStart) + : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. - rule: 'self.type == ''ConsistentHash'' ? !has(self.zoneAware) - : true ' + rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] + ? !has(self.zoneAware) : true ' proxyProtocol: description: ProxyProtocol enables the Proxy Protocol when communicating with the backend. @@ -26304,6 +26703,54 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + clientSideWeightedRoundRobin: + description: |- + ClientSideWeightedRoundRobin defines the configuration when the load balancer type is + set to ClientSideWeightedRoundRobin. + properties: + blackoutPeriod: + description: |- + A given endpoint must report load metrics continuously for at least this long before the endpoint weight will be used. + Default is 10s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + enableOOBLoadReport: + description: |- + Whether to enable out-of-band utilization reporting collection from the endpoints. + By default, per-request utilization reporting is used. + type: boolean + errorUtilizationPenalty: + description: |- + The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. + Must be non-negative. Default is 1.0. + minimum: 0 + type: number + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + For map fields in ORCA proto, use the form ".", e.g., "named_metrics.foo". + items: + type: string + type: array + oobReportingPeriod: + description: |- + Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. + Default is 10s; server may not provide reports as frequently as requested. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightExpirationPeriod: + description: If a given endpoint has not reported + load metrics in this long, stop using the reported + weight. Defaults to 3m. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightUpdatePeriod: + description: How often endpoint weights are recalculated. + Values less than 100ms are capped at 100ms. + Default 1s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + type: object consistentHash: description: |- ConsistentHash defines the configuration when the load balancer type is @@ -26455,12 +26902,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the configuration related @@ -26510,14 +26959,19 @@ spec: field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' + - message: If LoadBalancer type is ClientSideWeightedRoundRobin, + clientSideWeightedRoundRobin field needs to be set. + rule: 'self.type == ''ClientSideWeightedRoundRobin'' + ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' - message: Currently SlowStart is only supported for RoundRobin and LeastRequest load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash''] - ? !has(self.slowStart) : true ' + rule: 'self.type in [''Random'', ''ConsistentHash'', + ''ClientSideWeightedRoundRobin''] ? !has(self.slowStart) + : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. - rule: 'self.type == ''ConsistentHash'' ? !has(self.zoneAware) - : true ' + rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] + ? !has(self.zoneAware) : true ' proxyProtocol: description: ProxyProtocol enables the Proxy Protocol when communicating with the backend. @@ -27612,6 +28066,55 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + clientSideWeightedRoundRobin: + description: |- + ClientSideWeightedRoundRobin defines the configuration when the load balancer type is + set to ClientSideWeightedRoundRobin. + properties: + blackoutPeriod: + description: |- + A given endpoint must report load metrics continuously for at least this long before the endpoint weight will be used. + Default is 10s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + enableOOBLoadReport: + description: |- + Whether to enable out-of-band utilization reporting collection from the endpoints. + By default, per-request utilization reporting is used. + type: boolean + errorUtilizationPenalty: + description: |- + The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. + Must be non-negative. Default is 1.0. + minimum: 0 + type: number + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + For map fields in ORCA proto, use the form ".", e.g., "named_metrics.foo". + items: + type: string + type: array + oobReportingPeriod: + description: |- + Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. + Default is 10s; server may not provide reports as frequently as requested. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightExpirationPeriod: + description: If a given endpoint has not + reported load metrics in this long, stop + using the reported weight. Defaults to + 3m. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightUpdatePeriod: + description: How often endpoint weights + are recalculated. Values less than 100ms + are capped at 100ms. Default 1s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + type: object consistentHash: description: |- ConsistentHash defines the configuration when the load balancer type is @@ -27766,12 +28269,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the configuration @@ -27822,15 +28327,21 @@ spec: consistentHash field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' + - message: If LoadBalancer type is ClientSideWeightedRoundRobin, + clientSideWeightedRoundRobin field needs to + be set. + rule: 'self.type == ''ClientSideWeightedRoundRobin'' + ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' - message: Currently SlowStart is only supported for RoundRobin and LeastRequest load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash''] - ? !has(self.slowStart) : true ' + rule: 'self.type in [''Random'', ''ConsistentHash'', + ''ClientSideWeightedRoundRobin''] ? !has(self.slowStart) + : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. - rule: 'self.type == ''ConsistentHash'' ? !has(self.zoneAware) - : true ' + rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] + ? !has(self.zoneAware) : true ' proxyProtocol: description: ProxyProtocol enables the Proxy Protocol when communicating with the backend. @@ -28978,6 +29489,54 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + clientSideWeightedRoundRobin: + description: |- + ClientSideWeightedRoundRobin defines the configuration when the load balancer type is + set to ClientSideWeightedRoundRobin. + properties: + blackoutPeriod: + description: |- + A given endpoint must report load metrics continuously for at least this long before the endpoint weight will be used. + Default is 10s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + enableOOBLoadReport: + description: |- + Whether to enable out-of-band utilization reporting collection from the endpoints. + By default, per-request utilization reporting is used. + type: boolean + errorUtilizationPenalty: + description: |- + The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. + Must be non-negative. Default is 1.0. + minimum: 0 + type: number + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + For map fields in ORCA proto, use the form ".", e.g., "named_metrics.foo". + items: + type: string + type: array + oobReportingPeriod: + description: |- + Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. + Default is 10s; server may not provide reports as frequently as requested. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightExpirationPeriod: + description: If a given endpoint has not reported + load metrics in this long, stop using the reported + weight. Defaults to 3m. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + weightUpdatePeriod: + description: How often endpoint weights are recalculated. + Values less than 100ms are capped at 100ms. + Default 1s. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + type: object consistentHash: description: |- ConsistentHash defines the configuration when the load balancer type is @@ -29129,12 +29688,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the configuration related @@ -29184,14 +29745,19 @@ spec: field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' + - message: If LoadBalancer type is ClientSideWeightedRoundRobin, + clientSideWeightedRoundRobin field needs to be set. + rule: 'self.type == ''ClientSideWeightedRoundRobin'' + ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' - message: Currently SlowStart is only supported for RoundRobin and LeastRequest load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash''] - ? !has(self.slowStart) : true ' + rule: 'self.type in [''Random'', ''ConsistentHash'', + ''ClientSideWeightedRoundRobin''] ? !has(self.slowStart) + : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. - rule: 'self.type == ''ConsistentHash'' ? !has(self.zoneAware) - : true ' + rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] + ? !has(self.zoneAware) : true ' proxyProtocol: description: ProxyProtocol enables the Proxy Protocol when communicating with the backend. From a9d01f02d6612dce969f528551618152e2be1bdb Mon Sep 17 00:00:00 2001 From: "anurag.ag" Date: Sun, 2 Nov 2025 08:54:06 +0530 Subject: [PATCH 02/23] Adds / Updates test cases for client wrr Signed-off-by: anurag.ag --- .../gatewayapi/clustersettings_cswrr_test.go | 62 ++++++++ ...endtrafficpolicy-with-loadbalancer.in.yaml | 38 +++++ ...ndtrafficpolicy-with-loadbalancer.out.yaml | 113 ++++++++++++++- internal/ir/xds_test.go | 9 ++ internal/xds/translator/cluster.go | 1 - internal/xds/translator/cluster_test.go | 2 - .../testdata/in/xds-ir/load-balancer.yaml | 37 +++++ .../out/xds-ir/load-balancer.clusters.yaml | 55 +++++++ .../out/xds-ir/load-balancer.endpoints.yaml | 24 ++++ .../out/xds-ir/load-balancer.routes.yaml | 14 ++ .../backendtrafficpolicy_test.go | 134 +++++++++++++++++- ...cing_client_side_weighted_round_robin.yaml | 68 +++++---- test/e2e/tests/load_balancing.go | 114 +++++++++++++++ .../FuzzGatewayAPIToXDS/traffic_policy | 17 +++ 14 files changed, 651 insertions(+), 37 deletions(-) create mode 100644 internal/gatewayapi/clustersettings_cswrr_test.go diff --git a/internal/gatewayapi/clustersettings_cswrr_test.go b/internal/gatewayapi/clustersettings_cswrr_test.go new file mode 100644 index 0000000000..0537eda3a7 --- /dev/null +++ b/internal/gatewayapi/clustersettings_cswrr_test.go @@ -0,0 +1,62 @@ +// Copyright Envoy Gateway Authors +// SPDX-License-Identifier: Apache-2.0 +// The full text of the Apache license is available in the LICENSE file at +// the root of the repo. + +package gatewayapi + +import ( + "testing" + "time" + + "github.com/stretchr/testify/require" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + gwapiv1 "sigs.k8s.io/gateway-api/apis/v1" + + egv1a1 "github.com/envoyproxy/gateway/api/v1alpha1" + "github.com/envoyproxy/gateway/internal/ir" +) + +func TestBuildLoadBalancer_ClientSideWeightedRoundRobin(t *testing.T) { + cswrr := &egv1a1.ClientSideWeightedRoundRobin{ + EnableOOBLoadReport: ptrBool(true), + OOBReportingPeriod: ptrDuration("5s"), + BlackoutPeriod: ptrDuration("10s"), + WeightExpirationPeriod: ptrDuration("3m"), + WeightUpdatePeriod: ptrDuration("1s"), + ErrorUtilizationPenalty: ptrFloat32(1.5), + MetricNamesForComputingUtilization: []string{"named_metrics.foo", "cpu_utilization"}, + } + + policy := &egv1a1.ClusterSettings{ + LoadBalancer: &egv1a1.LoadBalancer{ + Type: egv1a1.ClientSideWeightedRoundRobinLoadBalancerType, + ClientSideWeightedRoundRobin: cswrr, + }, + } + + lb, err := buildLoadBalancer(policy) + require.NoError(t, err) + require.NotNil(t, lb) + require.NotNil(t, lb.ClientSideWeightedRoundRobin) + + got := lb.ClientSideWeightedRoundRobin + require.Equal(t, cswrr.EnableOOBLoadReport, got.EnableOOBLoadReport) + require.Equal(t, toMetaV1Duration(t, "5s"), got.OOBReportingPeriod) + require.Equal(t, toMetaV1Duration(t, "10s"), got.BlackoutPeriod) + require.Equal(t, toMetaV1Duration(t, "3m"), got.WeightExpirationPeriod) + require.Equal(t, toMetaV1Duration(t, "1s"), got.WeightUpdatePeriod) + require.NotNil(t, got.ErrorUtilizationPenalty) + require.InDelta(t, 1.5, *got.ErrorUtilizationPenalty, 0.0001) + require.Equal(t, []string{"named_metrics.foo", "cpu_utilization"}, got.MetricNamesForComputingUtilization) +} + +func ptrBool(v bool) *bool { return &v } +func ptrFloat32(v float32) *float32 { return &v } +func ptrDuration(d string) *gwapiv1.Duration { v := gwapiv1.Duration(d); return &v } + +func toMetaV1Duration(t *testing.T, d string) *metav1.Duration { + dur, err := time.ParseDuration(d) + require.NoError(t, err) + return ir.MetaV1DurationPtr(dur) +} diff --git a/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer.in.yaml b/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer.in.yaml index d722598990..ac32af8b24 100644 --- a/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer.in.yaml +++ b/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer.in.yaml @@ -100,6 +100,25 @@ httpRoutes: backendRefs: - name: service-2 port: 8080 +- apiVersion: gateway.networking.k8s.io/v1 + kind: HTTPRoute + metadata: + namespace: default + name: httproute-4 + spec: + hostnames: + - gateway.envoyproxy.io + parentRefs: + - namespace: envoy-gateway + name: gateway-2 + sectionName: http + rules: + - matches: + - path: + value: "/test4" + backendRefs: + - name: service-2 + port: 8080 backendTrafficPolicies: - apiVersion: gateway.envoyproxy.io/v1alpha1 kind: BackendTrafficPolicy @@ -178,3 +197,22 @@ backendTrafficPolicies: type: Cookie cookie: name: "test" +- apiVersion: gateway.envoyproxy.io/v1alpha1 + kind: BackendTrafficPolicy + metadata: + namespace: default + name: policy-for-route4 + spec: + targetRef: + group: gateway.networking.k8s.io + kind: HTTPRoute + name: httproute-4 + loadBalancer: + type: ClientSideWeightedRoundRobin + clientSideWeightedRoundRobin: + blackoutPeriod: 10s + weightExpirationPeriod: 60s + weightUpdatePeriod: 10s + errorUtilizationPenalty: 1 + metricNamesForComputingUtilization: + - "cpu_utilization" diff --git a/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer.out.yaml b/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer.out.yaml index 5335f36ed8..546f29bbe7 100644 --- a/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer.out.yaml +++ b/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer.out.yaml @@ -89,6 +89,40 @@ backendTrafficPolicies: status: "True" type: Accepted controllerName: gateway.envoyproxy.io/gatewayclass-controller +- apiVersion: gateway.envoyproxy.io/v1alpha1 + kind: BackendTrafficPolicy + metadata: + name: policy-for-route4 + namespace: default + spec: + loadBalancer: + type: ClientSideWeightedRoundRobin + clientSideWeightedRoundRobin: + blackoutPeriod: 10s + weightExpirationPeriod: 60s + weightUpdatePeriod: 10s + errorUtilizationPenalty: 1 + metricNamesForComputingUtilization: + - "cpu_utilization" + targetRef: + group: gateway.networking.k8s.io + kind: HTTPRoute + name: httproute-4 + status: + ancestors: + - ancestorRef: + group: gateway.networking.k8s.io + kind: Gateway + name: gateway-2 + namespace: envoy-gateway + sectionName: http + conditions: + - lastTransitionTime: null + message: Policy has been accepted. + reason: Accepted + status: "True" + type: Accepted + controllerName: gateway.envoyproxy.io/gatewayclass-controller - apiVersion: gateway.envoyproxy.io/v1alpha1 kind: BackendTrafficPolicy metadata: @@ -150,7 +184,7 @@ backendTrafficPolicies: type: Accepted - lastTransitionTime: null message: 'This policy is being overridden by other backendTrafficPolicies - for these routes: [default/httproute-1 default/httproute-2 default/httproute-3]' + for these routes: [default/httproute-1 default/httproute-2 default/httproute-3 default/httproute-4]' reason: Overridden status: "True" type: Overridden @@ -211,7 +245,7 @@ gateways: protocol: HTTP status: listeners: - - attachedRoutes: 3 + - attachedRoutes: 4 conditions: - lastTransitionTime: null message: Sending translated listener configuration to the data plane @@ -379,6 +413,43 @@ httpRoutes: name: gateway-2 namespace: envoy-gateway sectionName: http +- apiVersion: gateway.networking.k8s.io/v1 + kind: HTTPRoute + metadata: + name: httproute-4 + namespace: default + spec: + hostnames: + - gateway.envoyproxy.io + parentRefs: + - name: gateway-2 + namespace: envoy-gateway + sectionName: http + rules: + - backendRefs: + - name: service-2 + port: 8080 + matches: + - path: + value: /test4 + status: + parents: + - conditions: + - lastTransitionTime: null + message: Route is accepted + reason: Accepted + status: "True" + type: Accepted + - lastTransitionTime: null + message: Resolved all the Object references for the Route + reason: ResolvedRefs + status: "True" + type: ResolvedRefs + controllerName: gateway.envoyproxy.io/gatewayclass-controller + parentRef: + name: gateway-2 + namespace: envoy-gateway + sectionName: http infraIR: envoy-gateway/gateway-1: proxy: @@ -600,6 +671,44 @@ xdsIR: consistentHash: cookie: name: test + - destination: + metadata: + kind: HTTPRoute + name: httproute-4 + namespace: default + name: httproute/default/httproute-4/rule/0 + settings: + - addressType: IP + endpoints: + - host: 7.7.7.7 + port: 8080 + metadata: + name: service-2 + namespace: default + sectionName: "8080" + name: httproute/default/httproute-4/rule/0/backend/0 + protocol: HTTP + weight: 1 + hostname: gateway.envoyproxy.io + isHTTP2: false + metadata: + kind: HTTPRoute + name: httproute-4 + namespace: default + name: httproute/default/httproute-4/rule/0/match/0/gateway_envoyproxy_io + pathMatch: + distinct: false + name: "" + prefix: /test4 + traffic: + loadBalancer: + clientSideWeightedRoundRobin: + blackoutPeriod: 10s + weightExpirationPeriod: 60s + weightUpdatePeriod: 10s + errorUtilizationPenalty: 1 + metricNamesForComputingUtilization: + - "cpu_utilization" - destination: metadata: kind: HTTPRoute diff --git a/internal/ir/xds_test.go b/internal/ir/xds_test.go index 378580568d..049a214628 100644 --- a/internal/ir/xds_test.go +++ b/internal/ir/xds_test.go @@ -1337,6 +1337,15 @@ func TestValidateLoadBalancer(t *testing.T) { }, want: ErrLoadBalancerInvalid, }, + { + name: "client side wrr set", + input: LoadBalancer{ + ClientSideWeightedRoundRobin: &ClientSideWeightedRoundRobin{ + EnableOOBLoadReport: ptr.To(false), + MetricNamesForComputingUtilization: []string{"named_metrics.foo"}, + }, + }, + }, } for i := range tests { test := tests[i] diff --git a/internal/xds/translator/cluster.go b/internal/xds/translator/cluster.go index a8b0e1cfd0..4edea5f674 100644 --- a/internal/xds/translator/cluster.go +++ b/internal/xds/translator/cluster.go @@ -401,7 +401,6 @@ func buildXdsCluster(args *xdsClusterArgs) (*buildClusterResult, error) { }}, } case args.loadBalancer.ClientSideWeightedRoundRobin != nil: - cluster.LbPolicy = clusterv3.Cluster_CLUSTER_PROVIDED cswrr := &cswrrv3.ClientSideWeightedRoundRobin{} if v := args.loadBalancer.ClientSideWeightedRoundRobin; v != nil { if v.EnableOOBLoadReport != nil { diff --git a/internal/xds/translator/cluster_test.go b/internal/xds/translator/cluster_test.go index 663d70621d..89e7a67b6e 100644 --- a/internal/xds/translator/cluster_test.go +++ b/internal/xds/translator/cluster_test.go @@ -176,8 +176,6 @@ func TestBuildCluster_WithClientSideWeightedRoundRobin(t *testing.T) { cluster := result.cluster require.NotNil(t, cluster) - // LbPolicy should be CLUSTER_PROVIDED when using typed LoadBalancingPolicy - require.Equal(t, clusterv3.Cluster_CLUSTER_PROVIDED, cluster.LbPolicy) require.NotNil(t, cluster.LoadBalancingPolicy) require.Len(t, cluster.LoadBalancingPolicy.Policies, 1) diff --git a/internal/xds/translator/testdata/in/xds-ir/load-balancer.yaml b/internal/xds/translator/testdata/in/xds-ir/load-balancer.yaml index 58f30c05b6..2852cb34a5 100644 --- a/internal/xds/translator/testdata/in/xds-ir/load-balancer.yaml +++ b/internal/xds/translator/testdata/in/xds-ir/load-balancer.yaml @@ -202,3 +202,40 @@ http: - host: "1.2.3.4" port: 50000 name: "fourteenth-route-dest/backend/0" + - name: "fifteenth-route" + hostname: "*" + traffic: + loadBalancer: + clientSideWeightedRoundRobin: + blackoutPeriod: 30s + weightExpirationPeriod: 60s + weightUpdatePeriod: 10s + errorUtilizationPenalty: 1 + metricNamesForComputingUtilization: + - "cpu_utilization" + destination: + name: "fifteenth-route-dest" + settings: + - endpoints: + - host: "1.2.3.4" + port: 50000 + name: "fifteenth-route-dest/backend/0" + - name: "sixteenth-route" + hostname: "*" + traffic: + loadBalancer: + clientSideWeightedRoundRobin: + enableOobLoadReport: true + oobReportingPeriod: 20s + blackoutPeriod: 30s + weightExpirationPeriod: 60s + weightUpdatePeriod: 10s + metricNamesForComputingUtilization: + - "named_metric.foo" + destination: + name: "sixteenth-route-dest" + settings: + - endpoints: + - host: "1.2.3.4" + port: 50000 + name: "sixteenth-route-dest/backend/0" diff --git a/internal/xds/translator/testdata/out/xds-ir/load-balancer.clusters.yaml b/internal/xds/translator/testdata/out/xds-ir/load-balancer.clusters.yaml index c1b5f6ae9a..9ac223213b 100644 --- a/internal/xds/translator/testdata/out/xds-ir/load-balancer.clusters.yaml +++ b/internal/xds/translator/testdata/out/xds-ir/load-balancer.clusters.yaml @@ -343,3 +343,58 @@ name: fourteenth-route-dest perConnectionBufferLimitBytes: 32768 type: EDS +- circuitBreakers: + thresholds: + - maxRetries: 1024 + commonLbConfig: {} + connectTimeout: 10s + dnsLookupFamily: V4_PREFERRED + edsClusterConfig: + edsConfig: + ads: {} + resourceApiVersion: V3 + serviceName: fifteenth-route-dest + ignoreHealthOnHostRemoval: true + loadBalancingPolicy: + policies: + - typedExtensionConfig: + name: envoy.load_balancing_policies.client_side_weighted_round_robin + typedConfig: + '@type': type.googleapis.com/envoy.extensions.load_balancing_policies.client_side_weighted_round_robin.v3.ClientSideWeightedRoundRobin + blackoutPeriod: 30s + errorUtilizationPenalty: 1 + metricNamesForComputingUtilization: + - cpu_utilization + weightExpirationPeriod: 60s + weightUpdatePeriod: 10s + name: fifteenth-route-dest + perConnectionBufferLimitBytes: 32768 + type: EDS +- circuitBreakers: + thresholds: + - maxRetries: 1024 + commonLbConfig: {} + connectTimeout: 10s + dnsLookupFamily: V4_PREFERRED + edsClusterConfig: + edsConfig: + ads: {} + resourceApiVersion: V3 + serviceName: sixteenth-route-dest + ignoreHealthOnHostRemoval: true + loadBalancingPolicy: + policies: + - typedExtensionConfig: + name: envoy.load_balancing_policies.client_side_weighted_round_robin + typedConfig: + '@type': type.googleapis.com/envoy.extensions.load_balancing_policies.client_side_weighted_round_robin.v3.ClientSideWeightedRoundRobin + blackoutPeriod: 30s + enableOobLoadReport: true + metricNamesForComputingUtilization: + - named_metric.foo + oobReportingPeriod: 20s + weightExpirationPeriod: 60s + weightUpdatePeriod: 10s + name: sixteenth-route-dest + perConnectionBufferLimitBytes: 32768 + type: EDS diff --git a/internal/xds/translator/testdata/out/xds-ir/load-balancer.endpoints.yaml b/internal/xds/translator/testdata/out/xds-ir/load-balancer.endpoints.yaml index 5a4034e5e0..1819eceda9 100644 --- a/internal/xds/translator/testdata/out/xds-ir/load-balancer.endpoints.yaml +++ b/internal/xds/translator/testdata/out/xds-ir/load-balancer.endpoints.yaml @@ -166,3 +166,27 @@ loadBalancingWeight: 1 locality: region: fourteenth-route-dest/backend/0 +- clusterName: fifteenth-route-dest + endpoints: + - lbEndpoints: + - endpoint: + address: + socketAddress: + address: 1.2.3.4 + portValue: 50000 + loadBalancingWeight: 1 + loadBalancingWeight: 1 + locality: + region: fifteenth-route-dest/backend/0 +- clusterName: sixteenth-route-dest + endpoints: + - lbEndpoints: + - endpoint: + address: + socketAddress: + address: 1.2.3.4 + portValue: 50000 + loadBalancingWeight: 1 + loadBalancingWeight: 1 + locality: + region: sixteenth-route-dest/backend/0 diff --git a/internal/xds/translator/testdata/out/xds-ir/load-balancer.routes.yaml b/internal/xds/translator/testdata/out/xds-ir/load-balancer.routes.yaml index 2a39a63524..31f8e3a7fa 100644 --- a/internal/xds/translator/testdata/out/xds-ir/load-balancer.routes.yaml +++ b/internal/xds/translator/testdata/out/xds-ir/load-balancer.routes.yaml @@ -123,3 +123,17 @@ headerName: bar upgradeConfigs: - upgradeType: websocket + - match: + prefix: / + name: fifteenth-route + route: + cluster: fifteenth-route-dest + upgradeConfigs: + - upgradeType: websocket + - match: + prefix: / + name: sixteenth-route + route: + cluster: sixteenth-route-dest + upgradeConfigs: + - upgradeType: websocket diff --git a/test/cel-validation/backendtrafficpolicy_test.go b/test/cel-validation/backendtrafficpolicy_test.go index ca95df0bf2..54692dd126 100644 --- a/test/cel-validation/backendtrafficpolicy_test.go +++ b/test/cel-validation/backendtrafficpolicy_test.go @@ -414,7 +414,7 @@ func TestBackendTrafficPolicyTarget(t *testing.T) { wantErrors: []string{}, }, { - desc: "leastRequest with SlowStar is set", + desc: "leastRequest with SlowStart is set", mutate: func(btp *egv1a1.BackendTrafficPolicy) { btp.Spec = egv1a1.BackendTrafficPolicySpec{ PolicyTargetReferences: egv1a1.PolicyTargetReferences{ @@ -517,6 +517,138 @@ func TestBackendTrafficPolicyTarget(t *testing.T) { "spec.loadBalancer: Invalid value: \"object\": Currently SlowStart is only supported for RoundRobin and LeastRequest load balancers.", }, }, + { + desc: "cswrr all fields set", + mutate: func(btp *egv1a1.BackendTrafficPolicy) { + btp.Spec = egv1a1.BackendTrafficPolicySpec{ + PolicyTargetReferences: egv1a1.PolicyTargetReferences{ + TargetRef: &gwapiv1.LocalPolicyTargetReferenceWithSectionName{ + LocalPolicyTargetReference: gwapiv1.LocalPolicyTargetReference{ + Group: gwapiv1.Group("gateway.networking.k8s.io"), + Kind: gwapiv1.Kind("Gateway"), + Name: gwapiv1.ObjectName("eg"), + }, + }, + }, + ClusterSettings: egv1a1.ClusterSettings{ + LoadBalancer: &egv1a1.LoadBalancer{ + Type: egv1a1.ClientSideWeightedRoundRobinLoadBalancerType, + ClientSideWeightedRoundRobin: &egv1a1.ClientSideWeightedRoundRobin{ + EnableOOBLoadReport: ptr.To[bool](false), + OOBReportingPeriod: ptr.To(gwapiv1.Duration("30s")), + BlackoutPeriod: ptr.To(gwapiv1.Duration("10s")), + WeightUpdatePeriod: ptr.To(gwapiv1.Duration("10s")), + WeightExpirationPeriod: ptr.To(gwapiv1.Duration("10s")), + ErrorUtilizationPenalty: ptr.To[float32](0.5), + MetricNamesForComputingUtilization: []string{"metric1", "metric2"}, + }, + }, + }, + } + }, + wantErrors: []string{}, + }, + { + desc: "cswrr field nil when type is ClientSideWeightedRoundRobin", + mutate: func(btp *egv1a1.BackendTrafficPolicy) { + btp.Spec = egv1a1.BackendTrafficPolicySpec{ + PolicyTargetReferences: egv1a1.PolicyTargetReferences{ + TargetRef: &gwapiv1.LocalPolicyTargetReferenceWithSectionName{ + LocalPolicyTargetReference: gwapiv1.LocalPolicyTargetReference{ + Group: gwapiv1.Group("gateway.networking.k8s.io"), + Kind: gwapiv1.Kind("Gateway"), + Name: gwapiv1.ObjectName("eg"), + }, + }, + }, + ClusterSettings: egv1a1.ClusterSettings{ + LoadBalancer: &egv1a1.LoadBalancer{ + Type: egv1a1.ClientSideWeightedRoundRobinLoadBalancerType, + }, + }, + } + }, + wantErrors: []string{ + "spec.loadBalancer: Invalid value: \"object\": If LoadBalancer type is ClientSideWeightedRoundRobin, clientSideWeightedRoundRobin field needs to be set.", + }, + }, + { + desc: "cswrr with SlowStart is set", + mutate: func(btp *egv1a1.BackendTrafficPolicy) { + btp.Spec = egv1a1.BackendTrafficPolicySpec{ + PolicyTargetReferences: egv1a1.PolicyTargetReferences{ + TargetRef: &gwapiv1.LocalPolicyTargetReferenceWithSectionName{ + LocalPolicyTargetReference: gwapiv1.LocalPolicyTargetReference{ + Group: gwapiv1.Group("gateway.networking.k8s.io"), + Kind: gwapiv1.Kind("Gateway"), + Name: gwapiv1.ObjectName("eg"), + }, + }, + }, + ClusterSettings: egv1a1.ClusterSettings{ + LoadBalancer: &egv1a1.LoadBalancer{ + Type: egv1a1.ClientSideWeightedRoundRobinLoadBalancerType, + ClientSideWeightedRoundRobin: &egv1a1.ClientSideWeightedRoundRobin{}, + SlowStart: &egv1a1.SlowStart{Window: ptr.To(gwapiv1.Duration("10ms"))}, + }, + }, + } + }, + wantErrors: []string{ + "spec.loadBalancer: Invalid value: \"object\": Currently SlowStart is only supported for RoundRobin and LeastRequest load balancers.", + }, + }, + { + desc: "cswrr with ZoneAware is set", + mutate: func(btp *egv1a1.BackendTrafficPolicy) { + btp.Spec = egv1a1.BackendTrafficPolicySpec{ + PolicyTargetReferences: egv1a1.PolicyTargetReferences{ + TargetRef: &gwapiv1.LocalPolicyTargetReferenceWithSectionName{ + LocalPolicyTargetReference: gwapiv1.LocalPolicyTargetReference{ + Group: gwapiv1.Group("gateway.networking.k8s.io"), + Kind: gwapiv1.Kind("Gateway"), + Name: gwapiv1.ObjectName("eg"), + }, + }, + }, + ClusterSettings: egv1a1.ClusterSettings{ + LoadBalancer: &egv1a1.LoadBalancer{ + Type: egv1a1.ClientSideWeightedRoundRobinLoadBalancerType, + ClientSideWeightedRoundRobin: &egv1a1.ClientSideWeightedRoundRobin{}, + ZoneAware: &egv1a1.ZoneAware{PreferLocal: &egv1a1.PreferLocalZone{}}, + }, + }, + } + }, + wantErrors: []string{ + "spec.loadBalancer: Invalid value: \"object\": Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers.", + }, + }, + { + desc: "cswrr with negative penalty is invalid", + mutate: func(btp *egv1a1.BackendTrafficPolicy) { + btp.Spec = egv1a1.BackendTrafficPolicySpec{ + PolicyTargetReferences: egv1a1.PolicyTargetReferences{ + TargetRef: &gwapiv1.LocalPolicyTargetReferenceWithSectionName{ + LocalPolicyTargetReference: gwapiv1.LocalPolicyTargetReference{ + Group: gwapiv1.Group("gateway.networking.k8s.io"), + Kind: gwapiv1.Kind("Gateway"), + Name: gwapiv1.ObjectName("eg"), + }, + }, + }, + ClusterSettings: egv1a1.ClusterSettings{ + LoadBalancer: &egv1a1.LoadBalancer{ + Type: egv1a1.ClientSideWeightedRoundRobinLoadBalancerType, + ClientSideWeightedRoundRobin: &egv1a1.ClientSideWeightedRoundRobin{ErrorUtilizationPenalty: ptr.To[float32](-1)}, + }, + }, + } + }, + wantErrors: []string{ + "spec.loadBalancer.clientSideWeightedRoundRobin.errorUtilizationPenalty: Invalid value: -1: must be greater than or equal to 0", + }, + }, { desc: "Using both httpStatus and grpcStatus in abort fault injection", mutate: func(btp *egv1a1.BackendTrafficPolicy) { diff --git a/test/e2e/testdata/load_balancing_client_side_weighted_round_robin.yaml b/test/e2e/testdata/load_balancing_client_side_weighted_round_robin.yaml index 5ca148b2f7..4442cdff00 100644 --- a/test/e2e/testdata/load_balancing_client_side_weighted_round_robin.yaml +++ b/test/e2e/testdata/load_balancing_client_side_weighted_round_robin.yaml @@ -7,9 +7,9 @@ spec: selector: app: lb-backend-cswrr ports: - - protocol: TCP - port: 8080 - targetPort: 3000 + - protocol: TCP + port: 8080 + targetPort: 3000 --- apiVersion: apps/v1 kind: Deployment @@ -29,23 +29,23 @@ spec: app: lb-backend-cswrr spec: containers: - - name: backend - image: gcr.io/k8s-staging-gateway-api/echo-basic:v20231214-v1.0.0-140-gf544a46e - imagePullPolicy: IfNotPresent - env: - - name: POD_NAME - valueFrom: - fieldRef: - fieldPath: metadata.name - - name: NAMESPACE - valueFrom: - fieldRef: - fieldPath: metadata.namespace - - name: SERVICE_NAME - value: lb-backend-cswrr - resources: - requests: - cpu: 10m + - name: backend + image: gcr.io/k8s-staging-gateway-api/echo-basic:v20231214-v1.0.0-140-gf544a46e + imagePullPolicy: IfNotPresent + env: + - name: POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name + - name: NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace + - name: SERVICE_NAME + value: lb-backend-cswrr + resources: + requests: + cpu: 10m --- apiVersion: gateway.envoyproxy.io/v1alpha1 kind: BackendTrafficPolicy @@ -54,13 +54,19 @@ metadata: namespace: gateway-conformance-infra spec: targetRefs: - - group: gateway.networking.k8s.io - kind: HTTPRoute - name: client-side-wrr-lb-route + - group: gateway.networking.k8s.io + kind: HTTPRoute + name: client-side-wrr-lb-route loadBalancer: type: ClientSideWeightedRoundRobin clientSideWeightedRoundRobin: enableOOBLoadReport: false + oobReportingPeriod: 20s + blackoutPeriod: 30s + weightExpirationPeriod: 60s + weightUpdatePeriod: 10s + metricNamesForComputingUtilization: + - "named_metric.foo" --- apiVersion: gateway.networking.k8s.io/v1 kind: HTTPRoute @@ -69,12 +75,12 @@ metadata: namespace: gateway-conformance-infra spec: parentRefs: - - name: same-namespace + - name: same-namespace rules: - - matches: - - path: - type: PathPrefix - value: /cswrr - backendRefs: - - name: lb-backend-cswrr - port: 8080 + - matches: + - path: + type: PathPrefix + value: /cswrr + backendRefs: + - name: lb-backend-cswrr + port: 8080 diff --git a/test/e2e/tests/load_balancing.go b/test/e2e/tests/load_balancing.go index b61b1edad1..cdca88f455 100644 --- a/test/e2e/tests/load_balancing.go +++ b/test/e2e/tests/load_balancing.go @@ -651,3 +651,117 @@ var EndpointOverrideLoadBalancingTest = suite.ConformanceTest{ }) }, } + +var ClientSideWeightedRoundRobinOOBLoadBalancingTest = suite.ConformanceTest{ + ShortName: "ClientSideWeightedRoundRobinOOBLoadBalancing", + Description: "Test for client-side weighted round robin with OOB enabled", + Manifests: []string{"testdata/load_balancing_client_side_weighted_round_robin_oob.yaml"}, + Test: func(t *testing.T, suite *suite.ConformanceTestSuite) { + const ( + sendRequests = 90 + replicas = 3 + offset = 6 + ) + + ns := "gateway-conformance-infra" + routeNN := types.NamespacedName{Name: "client-side-wrr-lb-route-oob", Namespace: ns} + gwNN := types.NamespacedName{Name: "same-namespace", Namespace: ns} + + ancestorRef := gwapiv1.ParentReference{ + Group: gatewayapi.GroupPtr(gwapiv1.GroupName), + Kind: gatewayapi.KindPtr(resource.KindGateway), + Namespace: gatewayapi.NamespacePtr(gwNN.Namespace), + Name: gwapiv1.ObjectName(gwNN.Name), + } + BackendTrafficPolicyMustBeAccepted(t, suite.Client, types.NamespacedName{Name: "client-side-wrr-lb-policy-oob", Namespace: ns}, suite.ControllerName, ancestorRef) + WaitForPods(t, suite.Client, ns, map[string]string{"app": "lb-backend-cswrr-oob"}, corev1.PodRunning, &PodReady) + + gwAddr := kubernetes.GatewayAndRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN), &gwapiv1.HTTPRoute{}, false, routeNN) + + t.Run("traffic should be roughly even with OOB enabled (no ORCA signals)", func(t *testing.T) { + expectedResponse := http.ExpectedResponse{ + Request: http.Request{ + Path: "/cswrroob", + }, + Response: http.Response{ + StatusCodes: []int{200}, + }, + Namespace: ns, + } + req := http.MakeRequest(t, &expectedResponse, gwAddr, "HTTP", "http") + + compareFunc := func(trafficMap map[string]int) bool { + even := sendRequests / replicas + for _, count := range trafficMap { + if !AlmostEquals(count, even, offset) { + return false + } + } + return true + } + + if err := wait.PollUntilContextTimeout(context.TODO(), time.Second, 30*time.Second, true, func(_ context.Context) (bool, error) { + return runTrafficTest(t, suite, &req, &expectedResponse, sendRequests, compareFunc), nil + }); err != nil { + tlog.Errorf(t, "failed to run client-side WRR OOB test: %v", err) + } + }) + }, +} + +var ClientSideWeightedRoundRobinPenaltyLoadBalancingTest = suite.ConformanceTest{ + ShortName: "ClientSideWeightedRoundRobinPenaltyLoadBalancing", + Description: "Test for client-side weighted round robin with penalty and metrics", + Manifests: []string{"testdata/load_balancing_client_side_weighted_round_robin_penalty.yaml"}, + Test: func(t *testing.T, suite *suite.ConformanceTestSuite) { + const ( + sendRequests = 90 + replicas = 3 + offset = 6 + ) + + ns := "gateway-conformance-infra" + routeNN := types.NamespacedName{Name: "client-side-wrr-lb-route-penalty", Namespace: ns} + gwNN := types.NamespacedName{Name: "same-namespace", Namespace: ns} + + ancestorRef := gwapiv1.ParentReference{ + Group: gatewayapi.GroupPtr(gwapiv1.GroupName), + Kind: gatewayapi.KindPtr(resource.KindGateway), + Namespace: gatewayapi.NamespacePtr(gwNN.Namespace), + Name: gwapiv1.ObjectName(gwNN.Name), + } + BackendTrafficPolicyMustBeAccepted(t, suite.Client, types.NamespacedName{Name: "client-side-wrr-lb-policy-penalty", Namespace: ns}, suite.ControllerName, ancestorRef) + WaitForPods(t, suite.Client, ns, map[string]string{"app": "lb-backend-cswrr-penalty"}, corev1.PodRunning, &PodReady) + + gwAddr := kubernetes.GatewayAndRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN), &gwapiv1.HTTPRoute{}, false, routeNN) + + t.Run("traffic should be roughly even without ORCA, even with penalty configured", func(t *testing.T) { + expectedResponse := http.ExpectedResponse{ + Request: http.Request{ + Path: "/cswrrpenalty", + }, + Response: http.Response{ + StatusCodes: []int{200}, + }, + Namespace: ns, + } + req := http.MakeRequest(t, &expectedResponse, gwAddr, "HTTP", "http") + + compareFunc := func(trafficMap map[string]int) bool { + even := sendRequests / replicas + for _, count := range trafficMap { + if !AlmostEquals(count, even, offset) { + return false + } + } + return true + } + + if err := wait.PollUntilContextTimeout(context.TODO(), time.Second, 30*time.Second, true, func(_ context.Context) (bool, error) { + return runTrafficTest(t, suite, &req, &expectedResponse, sendRequests, compareFunc), nil + }); err != nil { + tlog.Errorf(t, "failed to run client-side WRR penalty test: %v", err) + } + }) + }, +} diff --git a/test/fuzz/testdata/FuzzGatewayAPIToXDS/traffic_policy b/test/fuzz/testdata/FuzzGatewayAPIToXDS/traffic_policy index 6cb209e5f1..35727352c8 100644 --- a/test/fuzz/testdata/FuzzGatewayAPIToXDS/traffic_policy +++ b/test/fuzz/testdata/FuzzGatewayAPIToXDS/traffic_policy @@ -45,3 +45,20 @@ spec: timeout: http: requestReceivedTimeout: 50ms +--- +apiVersion: gateway.envoyproxy.io/v1alpha1 +kind: BackendTrafficPolicy +metadata: + name: cswrr-lb-policy + namespace: gateway-conformance-infra +spec: + targetRefs: + - group: gateway.networking.k8s.io + kind: HTTPRoute + name: cswrr-lb-route + loadBalancer: + type: ClientSideWeightedRoundRobin + clientSideWeightedRoundRobin: + enableOOBLoadReport: true + oobReportingPeriod: 5s + errorUtilizationPenalty: 1.2 From 63e8b2fc3b969e29c532675437551689abfe5b84 Mon Sep 17 00:00:00 2001 From: "anurag.ag" Date: Mon, 3 Nov 2025 19:55:57 +0530 Subject: [PATCH 03/23] Fix: gen-check ci, coverage-check Signed-off-by: anurag.ag --- ...kendtrafficpolicy-with-loadbalancer.out.yaml | 17 +++++++++-------- .../cel-validation/backendtrafficpolicy_test.go | 2 +- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer.out.yaml b/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer.out.yaml index 546f29bbe7..6c9b86ba01 100644 --- a/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer.out.yaml +++ b/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer.out.yaml @@ -96,14 +96,14 @@ backendTrafficPolicies: namespace: default spec: loadBalancer: - type: ClientSideWeightedRoundRobin clientSideWeightedRoundRobin: blackoutPeriod: 10s - weightExpirationPeriod: 60s - weightUpdatePeriod: 10s errorUtilizationPenalty: 1 metricNamesForComputingUtilization: - - "cpu_utilization" + - cpu_utilization + weightExpirationPeriod: 60s + weightUpdatePeriod: 10s + type: ClientSideWeightedRoundRobin targetRef: group: gateway.networking.k8s.io kind: HTTPRoute @@ -184,7 +184,8 @@ backendTrafficPolicies: type: Accepted - lastTransitionTime: null message: 'This policy is being overridden by other backendTrafficPolicies - for these routes: [default/httproute-1 default/httproute-2 default/httproute-3 default/httproute-4]' + for these routes: [default/httproute-1 default/httproute-2 default/httproute-3 + default/httproute-4]' reason: Overridden status: "True" type: Overridden @@ -704,11 +705,11 @@ xdsIR: loadBalancer: clientSideWeightedRoundRobin: blackoutPeriod: 10s - weightExpirationPeriod: 60s - weightUpdatePeriod: 10s errorUtilizationPenalty: 1 metricNamesForComputingUtilization: - - "cpu_utilization" + - cpu_utilization + weightExpirationPeriod: 1m0s + weightUpdatePeriod: 10s - destination: metadata: kind: HTTPRoute diff --git a/test/cel-validation/backendtrafficpolicy_test.go b/test/cel-validation/backendtrafficpolicy_test.go index 54692dd126..96d0064517 100644 --- a/test/cel-validation/backendtrafficpolicy_test.go +++ b/test/cel-validation/backendtrafficpolicy_test.go @@ -646,7 +646,7 @@ func TestBackendTrafficPolicyTarget(t *testing.T) { } }, wantErrors: []string{ - "spec.loadBalancer.clientSideWeightedRoundRobin.errorUtilizationPenalty: Invalid value: -1: must be greater than or equal to 0", + "Invalid value: -1: spec.loadBalancer.clientSideWeightedRoundRobin.errorUtilizationPenalty in body should be greater than or equal to 0", }, }, { From 522534bcb45542b60c3795f909c73eb44e851226 Mon Sep 17 00:00:00 2001 From: "anurag.ag" Date: Tue, 4 Nov 2025 00:43:52 +0530 Subject: [PATCH 04/23] Remove `enableOOBLoadReport` and `oobReportingPeriod` fields from gateway CRDs and related configurations. Update associated test data and documentation. Signed-off-by: anurag.ag --- api/v1alpha1/loadbalancer_types.go | 4 +- ....envoyproxy.io_backendtrafficpolicies.yaml | 11 -- ....envoyproxy.io_envoyextensionpolicies.yaml | 11 -- .../gateway.envoyproxy.io_envoyproxies.yaml | 44 ------- ...ateway.envoyproxy.io_securitypolicies.yaml | 44 ------- ....envoyproxy.io_backendtrafficpolicies.yaml | 11 -- ....envoyproxy.io_envoyextensionpolicies.yaml | 11 -- .../gateway.envoyproxy.io_envoyproxies.yaml | 44 ------- ...ateway.envoyproxy.io_securitypolicies.yaml | 44 ------- .../testdata/in/xds-ir/load-balancer.yaml | 2 - .../out/xds-ir/load-balancer.clusters.yaml | 2 - site/content/en/latest/api/extension_types.md | 2 - ...cing_client_side_weighted_round_robin.yaml | 2 - .../FuzzGatewayAPIToXDS/traffic_policy | 2 - test/helm/gateway-crds-helm/all.out.yaml | 110 ------------------ .../envoy-gateway-crds.out.yaml | 110 ------------------ 16 files changed, 2 insertions(+), 452 deletions(-) diff --git a/api/v1alpha1/loadbalancer_types.go b/api/v1alpha1/loadbalancer_types.go index 7bc2f18b11..39eb25428a 100644 --- a/api/v1alpha1/loadbalancer_types.go +++ b/api/v1alpha1/loadbalancer_types.go @@ -151,12 +151,12 @@ type ClientSideWeightedRoundRobin struct { // Whether to enable out-of-band utilization reporting collection from the endpoints. // By default, per-request utilization reporting is used. // +optional - EnableOOBLoadReport *bool `json:"enableOOBLoadReport,omitempty"` + EnableOOBLoadReport *bool `json:"-"` // Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. // Default is 10s; server may not provide reports as frequently as requested. // +optional - OOBReportingPeriod *gwapiv1.Duration `json:"oobReportingPeriod,omitempty"` + OOBReportingPeriod *gwapiv1.Duration `json:"-"` // A given endpoint must report load metrics continuously for at least this long before the endpoint weight will be used. // Default is 10s. diff --git a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml index f31a99f755..4b3276f9d5 100644 --- a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml +++ b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml @@ -688,11 +688,6 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - enableOOBLoadReport: - description: |- - Whether to enable out-of-band utilization reporting collection from the endpoints. - By default, per-request utilization reporting is used. - type: boolean errorUtilizationPenalty: description: |- The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. @@ -706,12 +701,6 @@ spec: items: type: string type: array - oobReportingPeriod: - description: |- - Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. - Default is 10s; server may not provide reports as frequently as requested. - pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ - type: string weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop using the reported weight. Defaults to diff --git a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml index b9c489c95a..47e7eacad4 100644 --- a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml +++ b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml @@ -727,11 +727,6 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - enableOOBLoadReport: - description: |- - Whether to enable out-of-band utilization reporting collection from the endpoints. - By default, per-request utilization reporting is used. - type: boolean errorUtilizationPenalty: description: |- The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. @@ -745,12 +740,6 @@ spec: items: type: string type: array - oobReportingPeriod: - description: |- - Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. - Default is 10s; server may not provide reports as frequently as requested. - pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ - type: string weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop using the reported diff --git a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyproxies.yaml b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyproxies.yaml index 1bdb7b175f..e24d360ed7 100644 --- a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyproxies.yaml +++ b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyproxies.yaml @@ -11720,11 +11720,6 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - enableOOBLoadReport: - description: |- - Whether to enable out-of-band utilization reporting collection from the endpoints. - By default, per-request utilization reporting is used. - type: boolean errorUtilizationPenalty: description: |- The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. @@ -11738,12 +11733,6 @@ spec: items: type: string type: array - oobReportingPeriod: - description: |- - Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. - Default is 10s; server may not provide reports as frequently as requested. - pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ - type: string weightExpirationPeriod: description: If a given endpoint has not reported load metrics @@ -12988,11 +12977,6 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - enableOOBLoadReport: - description: |- - Whether to enable out-of-band utilization reporting collection from the endpoints. - By default, per-request utilization reporting is used. - type: boolean errorUtilizationPenalty: description: |- The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. @@ -13006,12 +12990,6 @@ spec: items: type: string type: array - oobReportingPeriod: - description: |- - Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. - Default is 10s; server may not provide reports as frequently as requested. - pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ - type: string weightExpirationPeriod: description: If a given endpoint has not reported load metrics @@ -14350,11 +14328,6 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - enableOOBLoadReport: - description: |- - Whether to enable out-of-band utilization reporting collection from the endpoints. - By default, per-request utilization reporting is used. - type: boolean errorUtilizationPenalty: description: |- The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. @@ -14368,12 +14341,6 @@ spec: items: type: string type: array - oobReportingPeriod: - description: |- - Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. - Default is 10s; server may not provide reports as frequently as requested. - pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ - type: string weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this @@ -15617,11 +15584,6 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - enableOOBLoadReport: - description: |- - Whether to enable out-of-band utilization reporting collection from the endpoints. - By default, per-request utilization reporting is used. - type: boolean errorUtilizationPenalty: description: |- The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. @@ -15635,12 +15597,6 @@ spec: items: type: string type: array - oobReportingPeriod: - description: |- - Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. - Default is 10s; server may not provide reports as frequently as requested. - pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ - type: string weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop using the diff --git a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_securitypolicies.yaml b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_securitypolicies.yaml index 3a20570c01..cf081eeb67 100644 --- a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_securitypolicies.yaml +++ b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_securitypolicies.yaml @@ -1245,11 +1245,6 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - enableOOBLoadReport: - description: |- - Whether to enable out-of-band utilization reporting collection from the endpoints. - By default, per-request utilization reporting is used. - type: boolean errorUtilizationPenalty: description: |- The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. @@ -1263,12 +1258,6 @@ spec: items: type: string type: array - oobReportingPeriod: - description: |- - Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. - Default is 10s; server may not provide reports as frequently as requested. - pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ - type: string weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop using the reported @@ -2397,11 +2386,6 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - enableOOBLoadReport: - description: |- - Whether to enable out-of-band utilization reporting collection from the endpoints. - By default, per-request utilization reporting is used. - type: boolean errorUtilizationPenalty: description: |- The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. @@ -2415,12 +2399,6 @@ spec: items: type: string type: array - oobReportingPeriod: - description: |- - Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. - Default is 10s; server may not provide reports as frequently as requested. - pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ - type: string weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop using the reported @@ -3760,11 +3738,6 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - enableOOBLoadReport: - description: |- - Whether to enable out-of-band utilization reporting collection from the endpoints. - By default, per-request utilization reporting is used. - type: boolean errorUtilizationPenalty: description: |- The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. @@ -3778,12 +3751,6 @@ spec: items: type: string type: array - oobReportingPeriod: - description: |- - Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. - Default is 10s; server may not provide reports as frequently as requested. - pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ - type: string weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop @@ -5183,11 +5150,6 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - enableOOBLoadReport: - description: |- - Whether to enable out-of-band utilization reporting collection from the endpoints. - By default, per-request utilization reporting is used. - type: boolean errorUtilizationPenalty: description: |- The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. @@ -5201,12 +5163,6 @@ spec: items: type: string type: array - oobReportingPeriod: - description: |- - Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. - Default is 10s; server may not provide reports as frequently as requested. - pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ - type: string weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop using the reported diff --git a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml index 97c885b347..429fdf8699 100644 --- a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml +++ b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml @@ -687,11 +687,6 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - enableOOBLoadReport: - description: |- - Whether to enable out-of-band utilization reporting collection from the endpoints. - By default, per-request utilization reporting is used. - type: boolean errorUtilizationPenalty: description: |- The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. @@ -705,12 +700,6 @@ spec: items: type: string type: array - oobReportingPeriod: - description: |- - Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. - Default is 10s; server may not provide reports as frequently as requested. - pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ - type: string weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop using the reported weight. Defaults to diff --git a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml index 148a3aab38..ea2d259477 100644 --- a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml +++ b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml @@ -726,11 +726,6 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - enableOOBLoadReport: - description: |- - Whether to enable out-of-band utilization reporting collection from the endpoints. - By default, per-request utilization reporting is used. - type: boolean errorUtilizationPenalty: description: |- The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. @@ -744,12 +739,6 @@ spec: items: type: string type: array - oobReportingPeriod: - description: |- - Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. - Default is 10s; server may not provide reports as frequently as requested. - pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ - type: string weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop using the reported diff --git a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyproxies.yaml b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyproxies.yaml index 83f21b6754..44b1ebc176 100644 --- a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyproxies.yaml +++ b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyproxies.yaml @@ -11719,11 +11719,6 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - enableOOBLoadReport: - description: |- - Whether to enable out-of-band utilization reporting collection from the endpoints. - By default, per-request utilization reporting is used. - type: boolean errorUtilizationPenalty: description: |- The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. @@ -11737,12 +11732,6 @@ spec: items: type: string type: array - oobReportingPeriod: - description: |- - Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. - Default is 10s; server may not provide reports as frequently as requested. - pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ - type: string weightExpirationPeriod: description: If a given endpoint has not reported load metrics @@ -12987,11 +12976,6 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - enableOOBLoadReport: - description: |- - Whether to enable out-of-band utilization reporting collection from the endpoints. - By default, per-request utilization reporting is used. - type: boolean errorUtilizationPenalty: description: |- The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. @@ -13005,12 +12989,6 @@ spec: items: type: string type: array - oobReportingPeriod: - description: |- - Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. - Default is 10s; server may not provide reports as frequently as requested. - pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ - type: string weightExpirationPeriod: description: If a given endpoint has not reported load metrics @@ -14349,11 +14327,6 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - enableOOBLoadReport: - description: |- - Whether to enable out-of-band utilization reporting collection from the endpoints. - By default, per-request utilization reporting is used. - type: boolean errorUtilizationPenalty: description: |- The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. @@ -14367,12 +14340,6 @@ spec: items: type: string type: array - oobReportingPeriod: - description: |- - Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. - Default is 10s; server may not provide reports as frequently as requested. - pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ - type: string weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this @@ -15616,11 +15583,6 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - enableOOBLoadReport: - description: |- - Whether to enable out-of-band utilization reporting collection from the endpoints. - By default, per-request utilization reporting is used. - type: boolean errorUtilizationPenalty: description: |- The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. @@ -15634,12 +15596,6 @@ spec: items: type: string type: array - oobReportingPeriod: - description: |- - Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. - Default is 10s; server may not provide reports as frequently as requested. - pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ - type: string weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop using the diff --git a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_securitypolicies.yaml b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_securitypolicies.yaml index 65f2a63199..dc7eab9ffc 100644 --- a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_securitypolicies.yaml +++ b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_securitypolicies.yaml @@ -1244,11 +1244,6 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - enableOOBLoadReport: - description: |- - Whether to enable out-of-band utilization reporting collection from the endpoints. - By default, per-request utilization reporting is used. - type: boolean errorUtilizationPenalty: description: |- The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. @@ -1262,12 +1257,6 @@ spec: items: type: string type: array - oobReportingPeriod: - description: |- - Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. - Default is 10s; server may not provide reports as frequently as requested. - pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ - type: string weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop using the reported @@ -2396,11 +2385,6 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - enableOOBLoadReport: - description: |- - Whether to enable out-of-band utilization reporting collection from the endpoints. - By default, per-request utilization reporting is used. - type: boolean errorUtilizationPenalty: description: |- The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. @@ -2414,12 +2398,6 @@ spec: items: type: string type: array - oobReportingPeriod: - description: |- - Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. - Default is 10s; server may not provide reports as frequently as requested. - pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ - type: string weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop using the reported @@ -3759,11 +3737,6 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - enableOOBLoadReport: - description: |- - Whether to enable out-of-band utilization reporting collection from the endpoints. - By default, per-request utilization reporting is used. - type: boolean errorUtilizationPenalty: description: |- The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. @@ -3777,12 +3750,6 @@ spec: items: type: string type: array - oobReportingPeriod: - description: |- - Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. - Default is 10s; server may not provide reports as frequently as requested. - pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ - type: string weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop @@ -5182,11 +5149,6 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - enableOOBLoadReport: - description: |- - Whether to enable out-of-band utilization reporting collection from the endpoints. - By default, per-request utilization reporting is used. - type: boolean errorUtilizationPenalty: description: |- The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. @@ -5200,12 +5162,6 @@ spec: items: type: string type: array - oobReportingPeriod: - description: |- - Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. - Default is 10s; server may not provide reports as frequently as requested. - pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ - type: string weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop using the reported diff --git a/internal/xds/translator/testdata/in/xds-ir/load-balancer.yaml b/internal/xds/translator/testdata/in/xds-ir/load-balancer.yaml index 2852cb34a5..c559eeb5a5 100644 --- a/internal/xds/translator/testdata/in/xds-ir/load-balancer.yaml +++ b/internal/xds/translator/testdata/in/xds-ir/load-balancer.yaml @@ -225,8 +225,6 @@ http: traffic: loadBalancer: clientSideWeightedRoundRobin: - enableOobLoadReport: true - oobReportingPeriod: 20s blackoutPeriod: 30s weightExpirationPeriod: 60s weightUpdatePeriod: 10s diff --git a/internal/xds/translator/testdata/out/xds-ir/load-balancer.clusters.yaml b/internal/xds/translator/testdata/out/xds-ir/load-balancer.clusters.yaml index 9ac223213b..4698944d91 100644 --- a/internal/xds/translator/testdata/out/xds-ir/load-balancer.clusters.yaml +++ b/internal/xds/translator/testdata/out/xds-ir/load-balancer.clusters.yaml @@ -389,10 +389,8 @@ typedConfig: '@type': type.googleapis.com/envoy.extensions.load_balancing_policies.client_side_weighted_round_robin.v3.ClientSideWeightedRoundRobin blackoutPeriod: 30s - enableOobLoadReport: true metricNamesForComputingUtilization: - named_metric.foo - oobReportingPeriod: 20s weightExpirationPeriod: 60s weightUpdatePeriod: 10s name: sixteenth-route-dest diff --git a/site/content/en/latest/api/extension_types.md b/site/content/en/latest/api/extension_types.md index dab1c8364e..18069a3b76 100644 --- a/site/content/en/latest/api/extension_types.md +++ b/site/content/en/latest/api/extension_types.md @@ -718,8 +718,6 @@ _Appears in:_ | Field | Type | Required | Default | Description | | --- | --- | --- | --- | --- | -| `enableOOBLoadReport` | _boolean_ | false | | Whether to enable out-of-band utilization reporting collection from the endpoints.
By default, per-request utilization reporting is used. | -| `oobReportingPeriod` | _[Duration](https://gateway-api.sigs.k8s.io/reference/1.4/spec/#duration)_ | false | | Load reporting interval to request from the server. Used only when enableOOBLoadReport is true.
Default is 10s; server may not provide reports as frequently as requested. | | `blackoutPeriod` | _[Duration](https://gateway-api.sigs.k8s.io/reference/1.4/spec/#duration)_ | false | | A given endpoint must report load metrics continuously for at least this long before the endpoint weight will be used.
Default is 10s. | | `weightExpirationPeriod` | _[Duration](https://gateway-api.sigs.k8s.io/reference/1.4/spec/#duration)_ | false | | If a given endpoint has not reported load metrics in this long, stop using the reported weight. Defaults to 3m. | | `weightUpdatePeriod` | _[Duration](https://gateway-api.sigs.k8s.io/reference/1.4/spec/#duration)_ | false | | How often endpoint weights are recalculated. Values less than 100ms are capped at 100ms. Default 1s. | diff --git a/test/e2e/testdata/load_balancing_client_side_weighted_round_robin.yaml b/test/e2e/testdata/load_balancing_client_side_weighted_round_robin.yaml index 4442cdff00..a5774ad49f 100644 --- a/test/e2e/testdata/load_balancing_client_side_weighted_round_robin.yaml +++ b/test/e2e/testdata/load_balancing_client_side_weighted_round_robin.yaml @@ -60,8 +60,6 @@ spec: loadBalancer: type: ClientSideWeightedRoundRobin clientSideWeightedRoundRobin: - enableOOBLoadReport: false - oobReportingPeriod: 20s blackoutPeriod: 30s weightExpirationPeriod: 60s weightUpdatePeriod: 10s diff --git a/test/fuzz/testdata/FuzzGatewayAPIToXDS/traffic_policy b/test/fuzz/testdata/FuzzGatewayAPIToXDS/traffic_policy index 35727352c8..c48b013e57 100644 --- a/test/fuzz/testdata/FuzzGatewayAPIToXDS/traffic_policy +++ b/test/fuzz/testdata/FuzzGatewayAPIToXDS/traffic_policy @@ -59,6 +59,4 @@ spec: loadBalancer: type: ClientSideWeightedRoundRobin clientSideWeightedRoundRobin: - enableOOBLoadReport: true - oobReportingPeriod: 5s errorUtilizationPenalty: 1.2 diff --git a/test/helm/gateway-crds-helm/all.out.yaml b/test/helm/gateway-crds-helm/all.out.yaml index 5ef8dd6e29..0c42834c2d 100644 --- a/test/helm/gateway-crds-helm/all.out.yaml +++ b/test/helm/gateway-crds-helm/all.out.yaml @@ -21821,11 +21821,6 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - enableOOBLoadReport: - description: |- - Whether to enable out-of-band utilization reporting collection from the endpoints. - By default, per-request utilization reporting is used. - type: boolean errorUtilizationPenalty: description: |- The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. @@ -21839,12 +21834,6 @@ spec: items: type: string type: array - oobReportingPeriod: - description: |- - Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. - Default is 10s; server may not provide reports as frequently as requested. - pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ - type: string weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop using the reported weight. Defaults to @@ -26403,11 +26392,6 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - enableOOBLoadReport: - description: |- - Whether to enable out-of-band utilization reporting collection from the endpoints. - By default, per-request utilization reporting is used. - type: boolean errorUtilizationPenalty: description: |- The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. @@ -26421,12 +26405,6 @@ spec: items: type: string type: array - oobReportingPeriod: - description: |- - Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. - Default is 10s; server may not provide reports as frequently as requested. - pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ - type: string weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop using the reported @@ -40084,11 +40062,6 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - enableOOBLoadReport: - description: |- - Whether to enable out-of-band utilization reporting collection from the endpoints. - By default, per-request utilization reporting is used. - type: boolean errorUtilizationPenalty: description: |- The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. @@ -40102,12 +40075,6 @@ spec: items: type: string type: array - oobReportingPeriod: - description: |- - Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. - Default is 10s; server may not provide reports as frequently as requested. - pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ - type: string weightExpirationPeriod: description: If a given endpoint has not reported load metrics @@ -41352,11 +41319,6 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - enableOOBLoadReport: - description: |- - Whether to enable out-of-band utilization reporting collection from the endpoints. - By default, per-request utilization reporting is used. - type: boolean errorUtilizationPenalty: description: |- The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. @@ -41370,12 +41332,6 @@ spec: items: type: string type: array - oobReportingPeriod: - description: |- - Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. - Default is 10s; server may not provide reports as frequently as requested. - pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ - type: string weightExpirationPeriod: description: If a given endpoint has not reported load metrics @@ -42714,11 +42670,6 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - enableOOBLoadReport: - description: |- - Whether to enable out-of-band utilization reporting collection from the endpoints. - By default, per-request utilization reporting is used. - type: boolean errorUtilizationPenalty: description: |- The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. @@ -42732,12 +42683,6 @@ spec: items: type: string type: array - oobReportingPeriod: - description: |- - Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. - Default is 10s; server may not provide reports as frequently as requested. - pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ - type: string weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this @@ -43981,11 +43926,6 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - enableOOBLoadReport: - description: |- - Whether to enable out-of-band utilization reporting collection from the endpoints. - By default, per-request utilization reporting is used. - type: boolean errorUtilizationPenalty: description: |- The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. @@ -43999,12 +43939,6 @@ spec: items: type: string type: array - oobReportingPeriod: - description: |- - Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. - Default is 10s; server may not provide reports as frequently as requested. - pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ - type: string weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop using the @@ -46218,11 +46152,6 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - enableOOBLoadReport: - description: |- - Whether to enable out-of-band utilization reporting collection from the endpoints. - By default, per-request utilization reporting is used. - type: boolean errorUtilizationPenalty: description: |- The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. @@ -46236,12 +46165,6 @@ spec: items: type: string type: array - oobReportingPeriod: - description: |- - Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. - Default is 10s; server may not provide reports as frequently as requested. - pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ - type: string weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop using the reported @@ -47370,11 +47293,6 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - enableOOBLoadReport: - description: |- - Whether to enable out-of-band utilization reporting collection from the endpoints. - By default, per-request utilization reporting is used. - type: boolean errorUtilizationPenalty: description: |- The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. @@ -47388,12 +47306,6 @@ spec: items: type: string type: array - oobReportingPeriod: - description: |- - Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. - Default is 10s; server may not provide reports as frequently as requested. - pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ - type: string weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop using the reported @@ -48733,11 +48645,6 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - enableOOBLoadReport: - description: |- - Whether to enable out-of-band utilization reporting collection from the endpoints. - By default, per-request utilization reporting is used. - type: boolean errorUtilizationPenalty: description: |- The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. @@ -48751,12 +48658,6 @@ spec: items: type: string type: array - oobReportingPeriod: - description: |- - Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. - Default is 10s; server may not provide reports as frequently as requested. - pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ - type: string weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop @@ -50156,11 +50057,6 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - enableOOBLoadReport: - description: |- - Whether to enable out-of-band utilization reporting collection from the endpoints. - By default, per-request utilization reporting is used. - type: boolean errorUtilizationPenalty: description: |- The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. @@ -50174,12 +50070,6 @@ spec: items: type: string type: array - oobReportingPeriod: - description: |- - Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. - Default is 10s; server may not provide reports as frequently as requested. - pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ - type: string weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop using the reported diff --git a/test/helm/gateway-crds-helm/envoy-gateway-crds.out.yaml b/test/helm/gateway-crds-helm/envoy-gateway-crds.out.yaml index add04c7d38..e0c29aee68 100644 --- a/test/helm/gateway-crds-helm/envoy-gateway-crds.out.yaml +++ b/test/helm/gateway-crds-helm/envoy-gateway-crds.out.yaml @@ -1165,11 +1165,6 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - enableOOBLoadReport: - description: |- - Whether to enable out-of-band utilization reporting collection from the endpoints. - By default, per-request utilization reporting is used. - type: boolean errorUtilizationPenalty: description: |- The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. @@ -1183,12 +1178,6 @@ spec: items: type: string type: array - oobReportingPeriod: - description: |- - Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. - Default is 10s; server may not provide reports as frequently as requested. - pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ - type: string weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop using the reported weight. Defaults to @@ -5747,11 +5736,6 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - enableOOBLoadReport: - description: |- - Whether to enable out-of-band utilization reporting collection from the endpoints. - By default, per-request utilization reporting is used. - type: boolean errorUtilizationPenalty: description: |- The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. @@ -5765,12 +5749,6 @@ spec: items: type: string type: array - oobReportingPeriod: - description: |- - Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. - Default is 10s; server may not provide reports as frequently as requested. - pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ - type: string weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop using the reported @@ -19428,11 +19406,6 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - enableOOBLoadReport: - description: |- - Whether to enable out-of-band utilization reporting collection from the endpoints. - By default, per-request utilization reporting is used. - type: boolean errorUtilizationPenalty: description: |- The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. @@ -19446,12 +19419,6 @@ spec: items: type: string type: array - oobReportingPeriod: - description: |- - Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. - Default is 10s; server may not provide reports as frequently as requested. - pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ - type: string weightExpirationPeriod: description: If a given endpoint has not reported load metrics @@ -20696,11 +20663,6 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - enableOOBLoadReport: - description: |- - Whether to enable out-of-band utilization reporting collection from the endpoints. - By default, per-request utilization reporting is used. - type: boolean errorUtilizationPenalty: description: |- The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. @@ -20714,12 +20676,6 @@ spec: items: type: string type: array - oobReportingPeriod: - description: |- - Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. - Default is 10s; server may not provide reports as frequently as requested. - pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ - type: string weightExpirationPeriod: description: If a given endpoint has not reported load metrics @@ -22058,11 +22014,6 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - enableOOBLoadReport: - description: |- - Whether to enable out-of-band utilization reporting collection from the endpoints. - By default, per-request utilization reporting is used. - type: boolean errorUtilizationPenalty: description: |- The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. @@ -22076,12 +22027,6 @@ spec: items: type: string type: array - oobReportingPeriod: - description: |- - Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. - Default is 10s; server may not provide reports as frequently as requested. - pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ - type: string weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this @@ -23325,11 +23270,6 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - enableOOBLoadReport: - description: |- - Whether to enable out-of-band utilization reporting collection from the endpoints. - By default, per-request utilization reporting is used. - type: boolean errorUtilizationPenalty: description: |- The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. @@ -23343,12 +23283,6 @@ spec: items: type: string type: array - oobReportingPeriod: - description: |- - Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. - Default is 10s; server may not provide reports as frequently as requested. - pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ - type: string weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop using the @@ -25562,11 +25496,6 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - enableOOBLoadReport: - description: |- - Whether to enable out-of-band utilization reporting collection from the endpoints. - By default, per-request utilization reporting is used. - type: boolean errorUtilizationPenalty: description: |- The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. @@ -25580,12 +25509,6 @@ spec: items: type: string type: array - oobReportingPeriod: - description: |- - Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. - Default is 10s; server may not provide reports as frequently as requested. - pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ - type: string weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop using the reported @@ -26714,11 +26637,6 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - enableOOBLoadReport: - description: |- - Whether to enable out-of-band utilization reporting collection from the endpoints. - By default, per-request utilization reporting is used. - type: boolean errorUtilizationPenalty: description: |- The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. @@ -26732,12 +26650,6 @@ spec: items: type: string type: array - oobReportingPeriod: - description: |- - Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. - Default is 10s; server may not provide reports as frequently as requested. - pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ - type: string weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop using the reported @@ -28077,11 +27989,6 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - enableOOBLoadReport: - description: |- - Whether to enable out-of-band utilization reporting collection from the endpoints. - By default, per-request utilization reporting is used. - type: boolean errorUtilizationPenalty: description: |- The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. @@ -28095,12 +28002,6 @@ spec: items: type: string type: array - oobReportingPeriod: - description: |- - Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. - Default is 10s; server may not provide reports as frequently as requested. - pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ - type: string weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop @@ -29500,11 +29401,6 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - enableOOBLoadReport: - description: |- - Whether to enable out-of-band utilization reporting collection from the endpoints. - By default, per-request utilization reporting is used. - type: boolean errorUtilizationPenalty: description: |- The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. @@ -29518,12 +29414,6 @@ spec: items: type: string type: array - oobReportingPeriod: - description: |- - Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. - Default is 10s; server may not provide reports as frequently as requested. - pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ - type: string weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop using the reported From 4512f9df9d86ebd194470f800b2debda0a14632a Mon Sep 17 00:00:00 2001 From: "anurag.ag" Date: Tue, 4 Nov 2025 03:04:58 +0530 Subject: [PATCH 05/23] Remove `enableOOBLoadReport` and `oobReportingPeriod` fields from ClientSideWeightedRoundRobin configuration, update affected tests and CRDs. Signed-off-by: anurag.ag --- api/v1alpha1/loadbalancer_types.go | 10 ------- api/v1alpha1/zz_generated.deepcopy.go | 10 ------- internal/gatewayapi/clustersettings.go | 8 ----- .../gatewayapi/clustersettings_cswrr_test.go | 30 +++++-------------- internal/ir/xds.go | 2 -- internal/ir/xds_test.go | 5 +++- internal/ir/zz_generated.deepcopy.go | 10 ------- internal/xds/translator/cluster.go | 6 ---- .../backendtrafficpolicy_test.go | 2 -- 9 files changed, 12 insertions(+), 71 deletions(-) diff --git a/api/v1alpha1/loadbalancer_types.go b/api/v1alpha1/loadbalancer_types.go index 39eb25428a..ed272a0f91 100644 --- a/api/v1alpha1/loadbalancer_types.go +++ b/api/v1alpha1/loadbalancer_types.go @@ -148,16 +148,6 @@ type Cookie struct { // See Envoy proto: envoy.extensions.load_balancing_policies.client_side_weighted_round_robin.v3.ClientSideWeightedRoundRobin // Note: SlowStart is not supported for this policy in Envoy Gateway at this time. type ClientSideWeightedRoundRobin struct { - // Whether to enable out-of-band utilization reporting collection from the endpoints. - // By default, per-request utilization reporting is used. - // +optional - EnableOOBLoadReport *bool `json:"-"` - - // Load reporting interval to request from the server. Used only when enableOOBLoadReport is true. - // Default is 10s; server may not provide reports as frequently as requested. - // +optional - OOBReportingPeriod *gwapiv1.Duration `json:"-"` - // A given endpoint must report load metrics continuously for at least this long before the endpoint weight will be used. // Default is 10s. // +optional diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index 5ee347d0ad..137ba70db1 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -993,16 +993,6 @@ func (in *ClientIPDetectionSettings) DeepCopy() *ClientIPDetectionSettings { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ClientSideWeightedRoundRobin) DeepCopyInto(out *ClientSideWeightedRoundRobin) { *out = *in - if in.EnableOOBLoadReport != nil { - in, out := &in.EnableOOBLoadReport, &out.EnableOOBLoadReport - *out = new(bool) - **out = **in - } - if in.OOBReportingPeriod != nil { - in, out := &in.OOBReportingPeriod, &out.OOBReportingPeriod - *out = new(v1.Duration) - **out = **in - } if in.BlackoutPeriod != nil { in, out := &in.BlackoutPeriod, &out.BlackoutPeriod *out = new(v1.Duration) diff --git a/internal/gatewayapi/clustersettings.go b/internal/gatewayapi/clustersettings.go index 9a948eee9a..6c5d8f3b04 100644 --- a/internal/gatewayapi/clustersettings.go +++ b/internal/gatewayapi/clustersettings.go @@ -346,14 +346,6 @@ func buildLoadBalancer(policy *egv1a1.ClusterSettings) (*ir.LoadBalancer, error) } cswrr := policy.LoadBalancer.ClientSideWeightedRoundRobin if cswrr != nil { - if cswrr.EnableOOBLoadReport != nil { - lb.ClientSideWeightedRoundRobin.EnableOOBLoadReport = cswrr.EnableOOBLoadReport - } - if cswrr.OOBReportingPeriod != nil { - if d, err := time.ParseDuration(string(*cswrr.OOBReportingPeriod)); err == nil { - lb.ClientSideWeightedRoundRobin.OOBReportingPeriod = ir.MetaV1DurationPtr(d) - } - } if cswrr.BlackoutPeriod != nil { if d, err := time.ParseDuration(string(*cswrr.BlackoutPeriod)); err == nil { lb.ClientSideWeightedRoundRobin.BlackoutPeriod = ir.MetaV1DurationPtr(d) diff --git a/internal/gatewayapi/clustersettings_cswrr_test.go b/internal/gatewayapi/clustersettings_cswrr_test.go index 0537eda3a7..711d12d4d6 100644 --- a/internal/gatewayapi/clustersettings_cswrr_test.go +++ b/internal/gatewayapi/clustersettings_cswrr_test.go @@ -11,20 +11,18 @@ import ( "github.com/stretchr/testify/require" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/utils/ptr" gwapiv1 "sigs.k8s.io/gateway-api/apis/v1" egv1a1 "github.com/envoyproxy/gateway/api/v1alpha1" - "github.com/envoyproxy/gateway/internal/ir" ) func TestBuildLoadBalancer_ClientSideWeightedRoundRobin(t *testing.T) { cswrr := &egv1a1.ClientSideWeightedRoundRobin{ - EnableOOBLoadReport: ptrBool(true), - OOBReportingPeriod: ptrDuration("5s"), - BlackoutPeriod: ptrDuration("10s"), - WeightExpirationPeriod: ptrDuration("3m"), - WeightUpdatePeriod: ptrDuration("1s"), - ErrorUtilizationPenalty: ptrFloat32(1.5), + BlackoutPeriod: ptr.To(gwapiv1.Duration("10s")), + WeightExpirationPeriod: ptr.To(gwapiv1.Duration("3m")), + WeightUpdatePeriod: ptr.To(gwapiv1.Duration("1s")), + ErrorUtilizationPenalty: ptr.To[float32](1.5), MetricNamesForComputingUtilization: []string{"named_metrics.foo", "cpu_utilization"}, } @@ -41,22 +39,10 @@ func TestBuildLoadBalancer_ClientSideWeightedRoundRobin(t *testing.T) { require.NotNil(t, lb.ClientSideWeightedRoundRobin) got := lb.ClientSideWeightedRoundRobin - require.Equal(t, cswrr.EnableOOBLoadReport, got.EnableOOBLoadReport) - require.Equal(t, toMetaV1Duration(t, "5s"), got.OOBReportingPeriod) - require.Equal(t, toMetaV1Duration(t, "10s"), got.BlackoutPeriod) - require.Equal(t, toMetaV1Duration(t, "3m"), got.WeightExpirationPeriod) - require.Equal(t, toMetaV1Duration(t, "1s"), got.WeightUpdatePeriod) + require.Equal(t, ptr.To(metav1.Duration{Duration: 10 * time.Second}), got.BlackoutPeriod) + require.Equal(t, ptr.To(metav1.Duration{Duration: 3 * time.Minute}), got.WeightExpirationPeriod) + require.Equal(t, ptr.To(metav1.Duration{Duration: 1 * time.Second}), got.WeightUpdatePeriod) require.NotNil(t, got.ErrorUtilizationPenalty) require.InDelta(t, 1.5, *got.ErrorUtilizationPenalty, 0.0001) require.Equal(t, []string{"named_metrics.foo", "cpu_utilization"}, got.MetricNamesForComputingUtilization) } - -func ptrBool(v bool) *bool { return &v } -func ptrFloat32(v float32) *float32 { return &v } -func ptrDuration(d string) *gwapiv1.Duration { v := gwapiv1.Duration(d); return &v } - -func toMetaV1Duration(t *testing.T, d string) *metav1.Duration { - dur, err := time.ParseDuration(d) - require.NoError(t, err) - return ir.MetaV1DurationPtr(dur) -} diff --git a/internal/ir/xds.go b/internal/ir/xds.go index b1afc14c2f..cfd22bedb9 100644 --- a/internal/ir/xds.go +++ b/internal/ir/xds.go @@ -2621,8 +2621,6 @@ type Random struct{} // ClientSideWeightedRoundRobin load balancer settings // +k8s:deepcopy-gen=true type ClientSideWeightedRoundRobin struct { - EnableOOBLoadReport *bool `json:"enableOOBLoadReport,omitempty" yaml:"enableOOBLoadReport,omitempty"` - OOBReportingPeriod *metav1.Duration `json:"oobReportingPeriod,omitempty" yaml:"oobReportingPeriod,omitempty"` BlackoutPeriod *metav1.Duration `json:"blackoutPeriod,omitempty" yaml:"blackoutPeriod,omitempty"` WeightExpirationPeriod *metav1.Duration `json:"weightExpirationPeriod,omitempty" yaml:"weightExpirationPeriod,omitempty"` WeightUpdatePeriod *metav1.Duration `json:"weightUpdatePeriod,omitempty" yaml:"weightUpdatePeriod,omitempty"` diff --git a/internal/ir/xds_test.go b/internal/ir/xds_test.go index 049a214628..6285f9ae22 100644 --- a/internal/ir/xds_test.go +++ b/internal/ir/xds_test.go @@ -14,6 +14,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/utils/ptr" gwapiv1 "sigs.k8s.io/gateway-api/apis/v1" @@ -1341,7 +1342,9 @@ func TestValidateLoadBalancer(t *testing.T) { name: "client side wrr set", input: LoadBalancer{ ClientSideWeightedRoundRobin: &ClientSideWeightedRoundRobin{ - EnableOOBLoadReport: ptr.To(false), + BlackoutPeriod: ptr.To(metav1.Duration{Duration: 30 * time.Second}), + WeightExpirationPeriod: ptr.To(metav1.Duration{Duration: 10 * time.Second}), + WeightUpdatePeriod: ptr.To(metav1.Duration{Duration: 1 * time.Second}), MetricNamesForComputingUtilization: []string{"named_metrics.foo"}, }, }, diff --git a/internal/ir/zz_generated.deepcopy.go b/internal/ir/zz_generated.deepcopy.go index d41caef7c2..4d48e935c1 100644 --- a/internal/ir/zz_generated.deepcopy.go +++ b/internal/ir/zz_generated.deepcopy.go @@ -566,16 +566,6 @@ func (in *ClientIPDetectionSettings) DeepCopy() *ClientIPDetectionSettings { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ClientSideWeightedRoundRobin) DeepCopyInto(out *ClientSideWeightedRoundRobin) { *out = *in - if in.EnableOOBLoadReport != nil { - in, out := &in.EnableOOBLoadReport, &out.EnableOOBLoadReport - *out = new(bool) - **out = **in - } - if in.OOBReportingPeriod != nil { - in, out := &in.OOBReportingPeriod, &out.OOBReportingPeriod - *out = new(v1.Duration) - **out = **in - } if in.BlackoutPeriod != nil { in, out := &in.BlackoutPeriod, &out.BlackoutPeriod *out = new(v1.Duration) diff --git a/internal/xds/translator/cluster.go b/internal/xds/translator/cluster.go index 4edea5f674..f6880fbae7 100644 --- a/internal/xds/translator/cluster.go +++ b/internal/xds/translator/cluster.go @@ -403,12 +403,6 @@ func buildXdsCluster(args *xdsClusterArgs) (*buildClusterResult, error) { case args.loadBalancer.ClientSideWeightedRoundRobin != nil: cswrr := &cswrrv3.ClientSideWeightedRoundRobin{} if v := args.loadBalancer.ClientSideWeightedRoundRobin; v != nil { - if v.EnableOOBLoadReport != nil { - cswrr.EnableOobLoadReport = wrapperspb.Bool(*v.EnableOOBLoadReport) - } - if v.OOBReportingPeriod != nil && v.OOBReportingPeriod.Duration > 0 { - cswrr.OobReportingPeriod = durationpb.New(v.OOBReportingPeriod.Duration) - } if v.BlackoutPeriod != nil && v.BlackoutPeriod.Duration > 0 { cswrr.BlackoutPeriod = durationpb.New(v.BlackoutPeriod.Duration) } diff --git a/test/cel-validation/backendtrafficpolicy_test.go b/test/cel-validation/backendtrafficpolicy_test.go index 96d0064517..70a0c11dde 100644 --- a/test/cel-validation/backendtrafficpolicy_test.go +++ b/test/cel-validation/backendtrafficpolicy_test.go @@ -534,8 +534,6 @@ func TestBackendTrafficPolicyTarget(t *testing.T) { LoadBalancer: &egv1a1.LoadBalancer{ Type: egv1a1.ClientSideWeightedRoundRobinLoadBalancerType, ClientSideWeightedRoundRobin: &egv1a1.ClientSideWeightedRoundRobin{ - EnableOOBLoadReport: ptr.To[bool](false), - OOBReportingPeriod: ptr.To(gwapiv1.Duration("30s")), BlackoutPeriod: ptr.To(gwapiv1.Duration("10s")), WeightUpdatePeriod: ptr.To(gwapiv1.Duration("10s")), WeightExpirationPeriod: ptr.To(gwapiv1.Duration("10s")), From dd5d285d2c8579609f23fb05b636057d955d7484 Mon Sep 17 00:00:00 2001 From: "anurag.ag" Date: Mon, 17 Nov 2025 05:04:38 +0530 Subject: [PATCH 06/23] Update: Change `ErrorUtilizationPenalty` type from float to integer across Gateway CRDs, configuration files, and related tests. Adjust documentation to reflect percentage-based representation. Signed-off-by: anurag.ag --- api/v1alpha1/loadbalancer_types.go | 16 ++++- api/v1alpha1/zz_generated.deepcopy.go | 2 +- ....envoyproxy.io_backendtrafficpolicies.yaml | 17 ++++- ....envoyproxy.io_envoyextensionpolicies.yaml | 17 ++++- .../gateway.envoyproxy.io_envoyproxies.yaml | 68 +++++++++++++++---- ...ateway.envoyproxy.io_securitypolicies.yaml | 68 +++++++++++++++---- ....envoyproxy.io_backendtrafficpolicies.yaml | 17 ++++- ....envoyproxy.io_envoyextensionpolicies.yaml | 17 ++++- .../gateway.envoyproxy.io_envoyproxies.yaml | 68 +++++++++++++++---- ...ateway.envoyproxy.io_securitypolicies.yaml | 68 +++++++++++++++---- internal/gatewayapi/clustersettings.go | 3 +- .../gatewayapi/clustersettings_cswrr_test.go | 2 +- ...endtrafficpolicy-with-loadbalancer.in.yaml | 2 +- ...ndtrafficpolicy-with-loadbalancer.out.yaml | 2 +- site/content/en/latest/api/extension_types.md | 2 +- .../backendtrafficpolicy_test.go | 2 +- .../FuzzGatewayAPIToXDS/traffic_policy | 2 +- 17 files changed, 302 insertions(+), 71 deletions(-) diff --git a/api/v1alpha1/loadbalancer_types.go b/api/v1alpha1/loadbalancer_types.go index ed272a0f91..a85f16a9a9 100644 --- a/api/v1alpha1/loadbalancer_types.go +++ b/api/v1alpha1/loadbalancer_types.go @@ -161,11 +161,21 @@ type ClientSideWeightedRoundRobin struct { // +optional WeightUpdatePeriod *gwapiv1.Duration `json:"weightUpdatePeriod,omitempty"` - // The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. - // Must be non-negative. Default is 1.0. + // ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + // This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + // + // For example: + // - 100 => 1.0x + // - 120 => 1.2x + // - 200 => 2.0x + // + // Note: In the internal IR/XDS configuration this value is converted back to a + // floating point multiplier (value / 100.0). + // + // Must be non-negative. // +kubebuilder:validation:Minimum=0 // +optional - ErrorUtilizationPenalty *float32 `json:"errorUtilizationPenalty,omitempty"` + ErrorUtilizationPenalty *uint32 `json:"errorUtilizationPenalty,omitempty"` // Metric names used to compute utilization if application_utilization is not set. // For map fields in ORCA proto, use the form ".", e.g., "named_metrics.foo". diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index 137ba70db1..1f6695e1b9 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -1010,7 +1010,7 @@ func (in *ClientSideWeightedRoundRobin) DeepCopyInto(out *ClientSideWeightedRoun } if in.ErrorUtilizationPenalty != nil { in, out := &in.ErrorUtilizationPenalty, &out.ErrorUtilizationPenalty - *out = new(float32) + *out = new(uint32) **out = **in } if in.MetricNamesForComputingUtilization != nil { diff --git a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml index 4b3276f9d5..966e537867 100644 --- a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml +++ b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml @@ -690,10 +690,21 @@ spec: type: string errorUtilizationPenalty: description: |- - The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. - Must be non-negative. Default is 1.0. + ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 minimum: 0 - type: number + type: integer metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. diff --git a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml index 47e7eacad4..7612188010 100644 --- a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml +++ b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml @@ -729,10 +729,21 @@ spec: type: string errorUtilizationPenalty: description: |- - The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. - Must be non-negative. Default is 1.0. + ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 minimum: 0 - type: number + type: integer metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. diff --git a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyproxies.yaml b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyproxies.yaml index e24d360ed7..3033e23369 100644 --- a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyproxies.yaml +++ b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyproxies.yaml @@ -11722,10 +11722,21 @@ spec: type: string errorUtilizationPenalty: description: |- - The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. - Must be non-negative. Default is 1.0. + ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 minimum: 0 - type: number + type: integer metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. @@ -12979,10 +12990,21 @@ spec: type: string errorUtilizationPenalty: description: |- - The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. - Must be non-negative. Default is 1.0. + ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 minimum: 0 - type: number + type: integer metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. @@ -14330,10 +14352,21 @@ spec: type: string errorUtilizationPenalty: description: |- - The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. - Must be non-negative. Default is 1.0. + ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 minimum: 0 - type: number + type: integer metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. @@ -15586,10 +15619,21 @@ spec: type: string errorUtilizationPenalty: description: |- - The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. - Must be non-negative. Default is 1.0. + ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 minimum: 0 - type: number + type: integer metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. diff --git a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_securitypolicies.yaml b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_securitypolicies.yaml index cf081eeb67..b4abb9485e 100644 --- a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_securitypolicies.yaml +++ b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_securitypolicies.yaml @@ -1247,10 +1247,21 @@ spec: type: string errorUtilizationPenalty: description: |- - The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. - Must be non-negative. Default is 1.0. + ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 minimum: 0 - type: number + type: integer metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. @@ -2388,10 +2399,21 @@ spec: type: string errorUtilizationPenalty: description: |- - The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. - Must be non-negative. Default is 1.0. + ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 minimum: 0 - type: number + type: integer metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. @@ -3740,10 +3762,21 @@ spec: type: string errorUtilizationPenalty: description: |- - The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. - Must be non-negative. Default is 1.0. + ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 minimum: 0 - type: number + type: integer metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. @@ -5152,10 +5185,21 @@ spec: type: string errorUtilizationPenalty: description: |- - The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. - Must be non-negative. Default is 1.0. + ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 minimum: 0 - type: number + type: integer metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. diff --git a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml index 429fdf8699..5251a1f86d 100644 --- a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml +++ b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml @@ -689,10 +689,21 @@ spec: type: string errorUtilizationPenalty: description: |- - The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. - Must be non-negative. Default is 1.0. + ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 minimum: 0 - type: number + type: integer metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. diff --git a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml index ea2d259477..7c1ee3b907 100644 --- a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml +++ b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml @@ -728,10 +728,21 @@ spec: type: string errorUtilizationPenalty: description: |- - The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. - Must be non-negative. Default is 1.0. + ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 minimum: 0 - type: number + type: integer metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. diff --git a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyproxies.yaml b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyproxies.yaml index 44b1ebc176..7bf59d2577 100644 --- a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyproxies.yaml +++ b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyproxies.yaml @@ -11721,10 +11721,21 @@ spec: type: string errorUtilizationPenalty: description: |- - The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. - Must be non-negative. Default is 1.0. + ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 minimum: 0 - type: number + type: integer metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. @@ -12978,10 +12989,21 @@ spec: type: string errorUtilizationPenalty: description: |- - The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. - Must be non-negative. Default is 1.0. + ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 minimum: 0 - type: number + type: integer metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. @@ -14329,10 +14351,21 @@ spec: type: string errorUtilizationPenalty: description: |- - The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. - Must be non-negative. Default is 1.0. + ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 minimum: 0 - type: number + type: integer metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. @@ -15585,10 +15618,21 @@ spec: type: string errorUtilizationPenalty: description: |- - The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. - Must be non-negative. Default is 1.0. + ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 minimum: 0 - type: number + type: integer metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. diff --git a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_securitypolicies.yaml b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_securitypolicies.yaml index dc7eab9ffc..0e2df047bb 100644 --- a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_securitypolicies.yaml +++ b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_securitypolicies.yaml @@ -1246,10 +1246,21 @@ spec: type: string errorUtilizationPenalty: description: |- - The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. - Must be non-negative. Default is 1.0. + ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 minimum: 0 - type: number + type: integer metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. @@ -2387,10 +2398,21 @@ spec: type: string errorUtilizationPenalty: description: |- - The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. - Must be non-negative. Default is 1.0. + ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 minimum: 0 - type: number + type: integer metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. @@ -3739,10 +3761,21 @@ spec: type: string errorUtilizationPenalty: description: |- - The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. - Must be non-negative. Default is 1.0. + ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 minimum: 0 - type: number + type: integer metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. @@ -5151,10 +5184,21 @@ spec: type: string errorUtilizationPenalty: description: |- - The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. - Must be non-negative. Default is 1.0. + ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 minimum: 0 - type: number + type: integer metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. diff --git a/internal/gatewayapi/clustersettings.go b/internal/gatewayapi/clustersettings.go index 6c5d8f3b04..a5b9f7e5ac 100644 --- a/internal/gatewayapi/clustersettings.go +++ b/internal/gatewayapi/clustersettings.go @@ -362,7 +362,8 @@ func buildLoadBalancer(policy *egv1a1.ClusterSettings) (*ir.LoadBalancer, error) } } if cswrr.ErrorUtilizationPenalty != nil { - lb.ClientSideWeightedRoundRobin.ErrorUtilizationPenalty = cswrr.ErrorUtilizationPenalty + v := float32(*cswrr.ErrorUtilizationPenalty) / 100.0 + lb.ClientSideWeightedRoundRobin.ErrorUtilizationPenalty = &v } if len(cswrr.MetricNamesForComputingUtilization) > 0 { lb.ClientSideWeightedRoundRobin.MetricNamesForComputingUtilization = append([]string(nil), cswrr.MetricNamesForComputingUtilization...) diff --git a/internal/gatewayapi/clustersettings_cswrr_test.go b/internal/gatewayapi/clustersettings_cswrr_test.go index 711d12d4d6..07b3879ef1 100644 --- a/internal/gatewayapi/clustersettings_cswrr_test.go +++ b/internal/gatewayapi/clustersettings_cswrr_test.go @@ -22,7 +22,7 @@ func TestBuildLoadBalancer_ClientSideWeightedRoundRobin(t *testing.T) { BlackoutPeriod: ptr.To(gwapiv1.Duration("10s")), WeightExpirationPeriod: ptr.To(gwapiv1.Duration("3m")), WeightUpdatePeriod: ptr.To(gwapiv1.Duration("1s")), - ErrorUtilizationPenalty: ptr.To[float32](1.5), + ErrorUtilizationPenalty: ptr.To[uint32](150), MetricNamesForComputingUtilization: []string{"named_metrics.foo", "cpu_utilization"}, } diff --git a/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer.in.yaml b/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer.in.yaml index ac32af8b24..53351de4a7 100644 --- a/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer.in.yaml +++ b/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer.in.yaml @@ -213,6 +213,6 @@ backendTrafficPolicies: blackoutPeriod: 10s weightExpirationPeriod: 60s weightUpdatePeriod: 10s - errorUtilizationPenalty: 1 + errorUtilizationPenalty: 100 metricNamesForComputingUtilization: - "cpu_utilization" diff --git a/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer.out.yaml b/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer.out.yaml index 6c9b86ba01..fd0b2dbaea 100644 --- a/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer.out.yaml +++ b/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer.out.yaml @@ -98,7 +98,7 @@ backendTrafficPolicies: loadBalancer: clientSideWeightedRoundRobin: blackoutPeriod: 10s - errorUtilizationPenalty: 1 + errorUtilizationPenalty: 100 metricNamesForComputingUtilization: - cpu_utilization weightExpirationPeriod: 60s diff --git a/site/content/en/latest/api/extension_types.md b/site/content/en/latest/api/extension_types.md index 18069a3b76..563c87f05d 100644 --- a/site/content/en/latest/api/extension_types.md +++ b/site/content/en/latest/api/extension_types.md @@ -721,7 +721,7 @@ _Appears in:_ | `blackoutPeriod` | _[Duration](https://gateway-api.sigs.k8s.io/reference/1.4/spec/#duration)_ | false | | A given endpoint must report load metrics continuously for at least this long before the endpoint weight will be used.
Default is 10s. | | `weightExpirationPeriod` | _[Duration](https://gateway-api.sigs.k8s.io/reference/1.4/spec/#duration)_ | false | | If a given endpoint has not reported load metrics in this long, stop using the reported weight. Defaults to 3m. | | `weightUpdatePeriod` | _[Duration](https://gateway-api.sigs.k8s.io/reference/1.4/spec/#duration)_ | false | | How often endpoint weights are recalculated. Values less than 100ms are capped at 100ms. Default 1s. | -| `errorUtilizationPenalty` | _float_ | false | | The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps.
Must be non-negative. Default is 1.0. | +| `errorUtilizationPenalty` | _integer_ | false | | ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps).
This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc.
For example:
- 100 => 1.0x
- 120 => 1.2x
- 200 => 2.0x
Note: In the internal IR/XDS configuration this value is converted back to a
floating point multiplier (value / 100.0).
Must be non-negative. | | `metricNamesForComputingUtilization` | _string array_ | false | | Metric names used to compute utilization if application_utilization is not set.
For map fields in ORCA proto, use the form ".", e.g., "named_metrics.foo". | diff --git a/test/cel-validation/backendtrafficpolicy_test.go b/test/cel-validation/backendtrafficpolicy_test.go index 70a0c11dde..43395b1a8a 100644 --- a/test/cel-validation/backendtrafficpolicy_test.go +++ b/test/cel-validation/backendtrafficpolicy_test.go @@ -537,7 +537,7 @@ func TestBackendTrafficPolicyTarget(t *testing.T) { BlackoutPeriod: ptr.To(gwapiv1.Duration("10s")), WeightUpdatePeriod: ptr.To(gwapiv1.Duration("10s")), WeightExpirationPeriod: ptr.To(gwapiv1.Duration("10s")), - ErrorUtilizationPenalty: ptr.To[float32](0.5), + ErrorUtilizationPenalty: ptr.To[uint32](50), MetricNamesForComputingUtilization: []string{"metric1", "metric2"}, }, }, diff --git a/test/fuzz/testdata/FuzzGatewayAPIToXDS/traffic_policy b/test/fuzz/testdata/FuzzGatewayAPIToXDS/traffic_policy index c48b013e57..d3bdedd284 100644 --- a/test/fuzz/testdata/FuzzGatewayAPIToXDS/traffic_policy +++ b/test/fuzz/testdata/FuzzGatewayAPIToXDS/traffic_policy @@ -59,4 +59,4 @@ spec: loadBalancer: type: ClientSideWeightedRoundRobin clientSideWeightedRoundRobin: - errorUtilizationPenalty: 1.2 + errorUtilizationPenalty: 120 From 8bce8861bb2744f8371f20da55194a348860f095 Mon Sep 17 00:00:00 2001 From: "anurag.ag" Date: Sun, 7 Dec 2025 20:41:15 +0530 Subject: [PATCH 07/23] Update: Refactor `ErrorUtilizationPenalty` to use integer type with percentage-based representation in Gateway CRDs, configurations, and tests. Adjust related documentation and ensure backward compatibility. Signed-off-by: anurag.ag --- internal/gatewayapi/clustersettings.go | 3 +- .../gatewayapi/clustersettings_cswrr_test.go | 2 +- ...ndtrafficpolicy-with-loadbalancer.out.yaml | 2 +- internal/ir/xds.go | 2 +- internal/ir/zz_generated.deepcopy.go | 2 +- internal/xds/translator/cluster.go | 2 +- .../testdata/in/xds-ir/load-balancer.yaml | 2 +- .../backendtrafficpolicy_test.go | 8 +- test/helm/gateway-crds-helm/all.out.yaml | 170 ++++++++++++++---- .../envoy-gateway-crds.out.yaml | 170 ++++++++++++++---- 10 files changed, 290 insertions(+), 73 deletions(-) diff --git a/internal/gatewayapi/clustersettings.go b/internal/gatewayapi/clustersettings.go index a5b9f7e5ac..fedf91ebfe 100644 --- a/internal/gatewayapi/clustersettings.go +++ b/internal/gatewayapi/clustersettings.go @@ -362,8 +362,7 @@ func buildLoadBalancer(policy *egv1a1.ClusterSettings) (*ir.LoadBalancer, error) } } if cswrr.ErrorUtilizationPenalty != nil { - v := float32(*cswrr.ErrorUtilizationPenalty) / 100.0 - lb.ClientSideWeightedRoundRobin.ErrorUtilizationPenalty = &v + lb.ClientSideWeightedRoundRobin.ErrorUtilizationPenalty = ptr.To(*cswrr.ErrorUtilizationPenalty) } if len(cswrr.MetricNamesForComputingUtilization) > 0 { lb.ClientSideWeightedRoundRobin.MetricNamesForComputingUtilization = append([]string(nil), cswrr.MetricNamesForComputingUtilization...) diff --git a/internal/gatewayapi/clustersettings_cswrr_test.go b/internal/gatewayapi/clustersettings_cswrr_test.go index 07b3879ef1..a75ccb2171 100644 --- a/internal/gatewayapi/clustersettings_cswrr_test.go +++ b/internal/gatewayapi/clustersettings_cswrr_test.go @@ -43,6 +43,6 @@ func TestBuildLoadBalancer_ClientSideWeightedRoundRobin(t *testing.T) { require.Equal(t, ptr.To(metav1.Duration{Duration: 3 * time.Minute}), got.WeightExpirationPeriod) require.Equal(t, ptr.To(metav1.Duration{Duration: 1 * time.Second}), got.WeightUpdatePeriod) require.NotNil(t, got.ErrorUtilizationPenalty) - require.InDelta(t, 1.5, *got.ErrorUtilizationPenalty, 0.0001) + require.EqualValues(t, 150, *got.ErrorUtilizationPenalty) require.Equal(t, []string{"named_metrics.foo", "cpu_utilization"}, got.MetricNamesForComputingUtilization) } diff --git a/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer.out.yaml b/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer.out.yaml index fd0b2dbaea..66aea6d982 100644 --- a/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer.out.yaml +++ b/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer.out.yaml @@ -705,7 +705,7 @@ xdsIR: loadBalancer: clientSideWeightedRoundRobin: blackoutPeriod: 10s - errorUtilizationPenalty: 1 + errorUtilizationPenalty: 100 metricNamesForComputingUtilization: - cpu_utilization weightExpirationPeriod: 1m0s diff --git a/internal/ir/xds.go b/internal/ir/xds.go index 69d23294ff..5fe3f726d1 100644 --- a/internal/ir/xds.go +++ b/internal/ir/xds.go @@ -2640,7 +2640,7 @@ type ClientSideWeightedRoundRobin struct { BlackoutPeriod *metav1.Duration `json:"blackoutPeriod,omitempty" yaml:"blackoutPeriod,omitempty"` WeightExpirationPeriod *metav1.Duration `json:"weightExpirationPeriod,omitempty" yaml:"weightExpirationPeriod,omitempty"` WeightUpdatePeriod *metav1.Duration `json:"weightUpdatePeriod,omitempty" yaml:"weightUpdatePeriod,omitempty"` - ErrorUtilizationPenalty *float32 `json:"errorUtilizationPenalty,omitempty" yaml:"errorUtilizationPenalty,omitempty"` + ErrorUtilizationPenalty *uint32 `json:"errorUtilizationPenalty,omitempty" yaml:"errorUtilizationPenalty,omitempty"` MetricNamesForComputingUtilization []string `json:"metricNamesForComputingUtilization,omitempty" yaml:"metricNamesForComputingUtilization,omitempty"` } diff --git a/internal/ir/zz_generated.deepcopy.go b/internal/ir/zz_generated.deepcopy.go index 3a9534fe7a..f592f59bf2 100644 --- a/internal/ir/zz_generated.deepcopy.go +++ b/internal/ir/zz_generated.deepcopy.go @@ -599,7 +599,7 @@ func (in *ClientSideWeightedRoundRobin) DeepCopyInto(out *ClientSideWeightedRoun } if in.ErrorUtilizationPenalty != nil { in, out := &in.ErrorUtilizationPenalty, &out.ErrorUtilizationPenalty - *out = new(float32) + *out = new(uint32) **out = **in } if in.MetricNamesForComputingUtilization != nil { diff --git a/internal/xds/translator/cluster.go b/internal/xds/translator/cluster.go index f6880fbae7..0809d72d26 100644 --- a/internal/xds/translator/cluster.go +++ b/internal/xds/translator/cluster.go @@ -413,7 +413,7 @@ func buildXdsCluster(args *xdsClusterArgs) (*buildClusterResult, error) { cswrr.WeightUpdatePeriod = durationpb.New(v.WeightUpdatePeriod.Duration) } if v.ErrorUtilizationPenalty != nil { - cswrr.ErrorUtilizationPenalty = wrapperspb.Float(float32(*v.ErrorUtilizationPenalty)) + cswrr.ErrorUtilizationPenalty = wrapperspb.Float(float32(*v.ErrorUtilizationPenalty) / 100.0) } if len(v.MetricNamesForComputingUtilization) > 0 { cswrr.MetricNamesForComputingUtilization = append([]string(nil), v.MetricNamesForComputingUtilization...) diff --git a/internal/xds/translator/testdata/in/xds-ir/load-balancer.yaml b/internal/xds/translator/testdata/in/xds-ir/load-balancer.yaml index c559eeb5a5..76e26f0dd0 100644 --- a/internal/xds/translator/testdata/in/xds-ir/load-balancer.yaml +++ b/internal/xds/translator/testdata/in/xds-ir/load-balancer.yaml @@ -210,7 +210,7 @@ http: blackoutPeriod: 30s weightExpirationPeriod: 60s weightUpdatePeriod: 10s - errorUtilizationPenalty: 1 + errorUtilizationPenalty: 100 metricNamesForComputingUtilization: - "cpu_utilization" destination: diff --git a/test/cel-validation/backendtrafficpolicy_test.go b/test/cel-validation/backendtrafficpolicy_test.go index 43395b1a8a..e1111782b5 100644 --- a/test/cel-validation/backendtrafficpolicy_test.go +++ b/test/cel-validation/backendtrafficpolicy_test.go @@ -623,7 +623,7 @@ func TestBackendTrafficPolicyTarget(t *testing.T) { }, }, { - desc: "cswrr with negative penalty is invalid", + desc: "cswrr with zero penalty is valid", mutate: func(btp *egv1a1.BackendTrafficPolicy) { btp.Spec = egv1a1.BackendTrafficPolicySpec{ PolicyTargetReferences: egv1a1.PolicyTargetReferences{ @@ -638,14 +638,12 @@ func TestBackendTrafficPolicyTarget(t *testing.T) { ClusterSettings: egv1a1.ClusterSettings{ LoadBalancer: &egv1a1.LoadBalancer{ Type: egv1a1.ClientSideWeightedRoundRobinLoadBalancerType, - ClientSideWeightedRoundRobin: &egv1a1.ClientSideWeightedRoundRobin{ErrorUtilizationPenalty: ptr.To[float32](-1)}, + ClientSideWeightedRoundRobin: &egv1a1.ClientSideWeightedRoundRobin{ErrorUtilizationPenalty: ptr.To[uint32](0)}, }, }, } }, - wantErrors: []string{ - "Invalid value: -1: spec.loadBalancer.clientSideWeightedRoundRobin.errorUtilizationPenalty in body should be greater than or equal to 0", - }, + wantErrors: []string{}, }, { desc: "Using both httpStatus and grpcStatus in abort fault injection", diff --git a/test/helm/gateway-crds-helm/all.out.yaml b/test/helm/gateway-crds-helm/all.out.yaml index e86d3778b9..32aa49d65c 100644 --- a/test/helm/gateway-crds-helm/all.out.yaml +++ b/test/helm/gateway-crds-helm/all.out.yaml @@ -21824,10 +21824,21 @@ spec: type: string errorUtilizationPenalty: description: |- - The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. - Must be non-negative. Default is 1.0. + ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 minimum: 0 - type: number + type: integer metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. @@ -26431,10 +26442,21 @@ spec: type: string errorUtilizationPenalty: description: |- - The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. - Must be non-negative. Default is 1.0. + ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 minimum: 0 - type: number + type: integer metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. @@ -40121,10 +40143,21 @@ spec: type: string errorUtilizationPenalty: description: |- - The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. - Must be non-negative. Default is 1.0. + ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 minimum: 0 - type: number + type: integer metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. @@ -41398,10 +41431,21 @@ spec: type: string errorUtilizationPenalty: description: |- - The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. - Must be non-negative. Default is 1.0. + ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 minimum: 0 - type: number + type: integer metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. @@ -42769,10 +42813,21 @@ spec: type: string errorUtilizationPenalty: description: |- - The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. - Must be non-negative. Default is 1.0. + ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 minimum: 0 - type: number + type: integer metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. @@ -44045,10 +44100,21 @@ spec: type: string errorUtilizationPenalty: description: |- - The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. - Must be non-negative. Default is 1.0. + ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 minimum: 0 - type: number + type: integer metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. @@ -46291,10 +46357,21 @@ spec: type: string errorUtilizationPenalty: description: |- - The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. - Must be non-negative. Default is 1.0. + ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 minimum: 0 - type: number + type: integer metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. @@ -47452,10 +47529,21 @@ spec: type: string errorUtilizationPenalty: description: |- - The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. - Must be non-negative. Default is 1.0. + ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 minimum: 0 - type: number + type: integer metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. @@ -48824,10 +48912,21 @@ spec: type: string errorUtilizationPenalty: description: |- - The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. - Must be non-negative. Default is 1.0. + ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 minimum: 0 - type: number + type: integer metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. @@ -50256,10 +50355,21 @@ spec: type: string errorUtilizationPenalty: description: |- - The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. - Must be non-negative. Default is 1.0. + ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 minimum: 0 - type: number + type: integer metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. diff --git a/test/helm/gateway-crds-helm/envoy-gateway-crds.out.yaml b/test/helm/gateway-crds-helm/envoy-gateway-crds.out.yaml index c87c26486b..485a1b5eaf 100644 --- a/test/helm/gateway-crds-helm/envoy-gateway-crds.out.yaml +++ b/test/helm/gateway-crds-helm/envoy-gateway-crds.out.yaml @@ -1168,10 +1168,21 @@ spec: type: string errorUtilizationPenalty: description: |- - The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. - Must be non-negative. Default is 1.0. + ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 minimum: 0 - type: number + type: integer metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. @@ -5775,10 +5786,21 @@ spec: type: string errorUtilizationPenalty: description: |- - The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. - Must be non-negative. Default is 1.0. + ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 minimum: 0 - type: number + type: integer metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. @@ -19465,10 +19487,21 @@ spec: type: string errorUtilizationPenalty: description: |- - The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. - Must be non-negative. Default is 1.0. + ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 minimum: 0 - type: number + type: integer metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. @@ -20742,10 +20775,21 @@ spec: type: string errorUtilizationPenalty: description: |- - The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. - Must be non-negative. Default is 1.0. + ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 minimum: 0 - type: number + type: integer metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. @@ -22113,10 +22157,21 @@ spec: type: string errorUtilizationPenalty: description: |- - The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. - Must be non-negative. Default is 1.0. + ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 minimum: 0 - type: number + type: integer metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. @@ -23389,10 +23444,21 @@ spec: type: string errorUtilizationPenalty: description: |- - The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. - Must be non-negative. Default is 1.0. + ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 minimum: 0 - type: number + type: integer metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. @@ -25635,10 +25701,21 @@ spec: type: string errorUtilizationPenalty: description: |- - The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. - Must be non-negative. Default is 1.0. + ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 minimum: 0 - type: number + type: integer metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. @@ -26796,10 +26873,21 @@ spec: type: string errorUtilizationPenalty: description: |- - The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. - Must be non-negative. Default is 1.0. + ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 minimum: 0 - type: number + type: integer metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. @@ -28168,10 +28256,21 @@ spec: type: string errorUtilizationPenalty: description: |- - The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. - Must be non-negative. Default is 1.0. + ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 minimum: 0 - type: number + type: integer metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. @@ -29600,10 +29699,21 @@ spec: type: string errorUtilizationPenalty: description: |- - The multiplier used to adjust endpoint weights with the error rate calculated as eps/qps. - Must be non-negative. Default is 1.0. + ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 minimum: 0 - type: number + type: integer metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. From a479e677f9845e2ce51edf5a474dd1125fa3e851 Mon Sep 17 00:00:00 2001 From: "anurag.ag" Date: Sun, 7 Dec 2025 22:43:19 +0530 Subject: [PATCH 08/23] Refactor: Replace `ptr.To(metav1.Duration)` with `ir.MetaV1DurationPtr` across gateway configurations and tests for cleaner and consistent duration handling. Remove unused `metav1` imports where applicable. Signed-off-by: anurag.ag --- internal/gatewayapi/backendtrafficpolicy_test.go | 13 ++++++------- internal/gatewayapi/clienttrafficpolicy.go | 4 ++-- internal/gatewayapi/clustersettings.go | 2 +- internal/gatewayapi/clustersettings_cswrr_test.go | 8 ++++---- internal/ir/xds_test.go | 7 +++---- internal/xds/translator/cluster_test.go | 13 ++++++------- 6 files changed, 22 insertions(+), 25 deletions(-) diff --git a/internal/gatewayapi/backendtrafficpolicy_test.go b/internal/gatewayapi/backendtrafficpolicy_test.go index 8d4a2794a1..2bc7e3d465 100644 --- a/internal/gatewayapi/backendtrafficpolicy_test.go +++ b/internal/gatewayapi/backendtrafficpolicy_test.go @@ -12,7 +12,6 @@ import ( "time" "github.com/stretchr/testify/require" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/utils/ptr" gwapiv1 "sigs.k8s.io/gateway-api/apis/v1" @@ -222,8 +221,8 @@ func TestBuildPassiveHealthCheck(t *testing.T) { }, }, expected: &ir.OutlierDetection{ - Interval: ptr.To(metav1.Duration{Duration: 10 * time.Second}), - BaseEjectionTime: ptr.To(metav1.Duration{Duration: 30 * time.Second}), + Interval: ir.MetaV1DurationPtr(10 * time.Second), + BaseEjectionTime: ir.MetaV1DurationPtr(30 * time.Second), MaxEjectionPercent: ptr.To[int32](10), Consecutive5xxErrors: ptr.To[uint32](5), }, @@ -240,8 +239,8 @@ func TestBuildPassiveHealthCheck(t *testing.T) { }, }, expected: &ir.OutlierDetection{ - Interval: ptr.To(metav1.Duration{Duration: 10 * time.Second}), - BaseEjectionTime: ptr.To(metav1.Duration{Duration: 30 * time.Second}), + Interval: ir.MetaV1DurationPtr(10 * time.Second), + BaseEjectionTime: ir.MetaV1DurationPtr(30 * time.Second), MaxEjectionPercent: ptr.To[int32](10), Consecutive5xxErrors: ptr.To[uint32](5), FailurePercentageThreshold: ptr.To[uint32](90), @@ -263,11 +262,11 @@ func TestBuildPassiveHealthCheck(t *testing.T) { }, expected: &ir.OutlierDetection{ SplitExternalLocalOriginErrors: ptr.To(true), - Interval: ptr.To(metav1.Duration{Duration: 10 * time.Second}), + Interval: ir.MetaV1DurationPtr(10 * time.Second), ConsecutiveLocalOriginFailures: ptr.To[uint32](3), ConsecutiveGatewayErrors: ptr.To[uint32](2), Consecutive5xxErrors: ptr.To[uint32](5), - BaseEjectionTime: ptr.To(metav1.Duration{Duration: 30 * time.Second}), + BaseEjectionTime: ir.MetaV1DurationPtr(30 * time.Second), MaxEjectionPercent: ptr.To[int32](10), FailurePercentageThreshold: ptr.To[uint32](85), }, diff --git a/internal/gatewayapi/clienttrafficpolicy.go b/internal/gatewayapi/clienttrafficpolicy.go index ddd7099818..e3ea947f9e 100644 --- a/internal/gatewayapi/clienttrafficpolicy.go +++ b/internal/gatewayapi/clienttrafficpolicy.go @@ -961,7 +961,7 @@ func buildConnection(connection *egv1a1.ClientConnection) (*ir.ClientConnection, if err != nil { return nil, fmt.Errorf("invalid MaxConnectionDuration value %s", *connection.ConnectionLimit.MaxConnectionDuration) } - irConnectionLimit.MaxConnectionDuration = ptr.To(metav1.Duration{Duration: d}) + irConnectionLimit.MaxConnectionDuration = ir.MetaV1DurationPtr(d) } if connection.ConnectionLimit.MaxRequestsPerConnection != nil { @@ -973,7 +973,7 @@ func buildConnection(connection *egv1a1.ClientConnection) (*ir.ClientConnection, if err != nil { return nil, fmt.Errorf("invalid MaxStreamDuration value %s", *connection.ConnectionLimit.MaxStreamDuration) } - irConnectionLimit.MaxStreamDuration = ptr.To(metav1.Duration{Duration: d}) + irConnectionLimit.MaxStreamDuration = ir.MetaV1DurationPtr(d) } irConnection.ConnectionLimit = irConnectionLimit diff --git a/internal/gatewayapi/clustersettings.go b/internal/gatewayapi/clustersettings.go index de09b55e5e..94f572ebb6 100644 --- a/internal/gatewayapi/clustersettings.go +++ b/internal/gatewayapi/clustersettings.go @@ -147,7 +147,7 @@ func buildClusterSettingsTimeout(policy *egv1a1.ClusterSettings) (*ir.Timeout, e if err != nil { errs = errors.Join(errs, fmt.Errorf("invalid MaxStreamDuration value %s", *pto.HTTP.MaxStreamDuration)) } else { - msd = ptr.To(metav1.Duration{Duration: d}) + msd = ir.MetaV1DurationPtr(d) } } diff --git a/internal/gatewayapi/clustersettings_cswrr_test.go b/internal/gatewayapi/clustersettings_cswrr_test.go index a75ccb2171..478c53c8a9 100644 --- a/internal/gatewayapi/clustersettings_cswrr_test.go +++ b/internal/gatewayapi/clustersettings_cswrr_test.go @@ -10,11 +10,11 @@ import ( "time" "github.com/stretchr/testify/require" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/utils/ptr" gwapiv1 "sigs.k8s.io/gateway-api/apis/v1" egv1a1 "github.com/envoyproxy/gateway/api/v1alpha1" + "github.com/envoyproxy/gateway/internal/ir" ) func TestBuildLoadBalancer_ClientSideWeightedRoundRobin(t *testing.T) { @@ -39,9 +39,9 @@ func TestBuildLoadBalancer_ClientSideWeightedRoundRobin(t *testing.T) { require.NotNil(t, lb.ClientSideWeightedRoundRobin) got := lb.ClientSideWeightedRoundRobin - require.Equal(t, ptr.To(metav1.Duration{Duration: 10 * time.Second}), got.BlackoutPeriod) - require.Equal(t, ptr.To(metav1.Duration{Duration: 3 * time.Minute}), got.WeightExpirationPeriod) - require.Equal(t, ptr.To(metav1.Duration{Duration: 1 * time.Second}), got.WeightUpdatePeriod) + require.Equal(t, ir.MetaV1DurationPtr(10*time.Second), got.BlackoutPeriod) + require.Equal(t, ir.MetaV1DurationPtr(3*time.Minute), got.WeightExpirationPeriod) + require.Equal(t, ir.MetaV1DurationPtr(1*time.Second), got.WeightUpdatePeriod) require.NotNil(t, got.ErrorUtilizationPenalty) require.EqualValues(t, 150, *got.ErrorUtilizationPenalty) require.Equal(t, []string{"named_metrics.foo", "cpu_utilization"}, got.MetricNamesForComputingUtilization) diff --git a/internal/ir/xds_test.go b/internal/ir/xds_test.go index 8474ed1605..d171a6446b 100644 --- a/internal/ir/xds_test.go +++ b/internal/ir/xds_test.go @@ -14,7 +14,6 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/utils/ptr" gwapiv1 "sigs.k8s.io/gateway-api/apis/v1" @@ -1342,9 +1341,9 @@ func TestValidateLoadBalancer(t *testing.T) { name: "client side wrr set", input: LoadBalancer{ ClientSideWeightedRoundRobin: &ClientSideWeightedRoundRobin{ - BlackoutPeriod: ptr.To(metav1.Duration{Duration: 30 * time.Second}), - WeightExpirationPeriod: ptr.To(metav1.Duration{Duration: 10 * time.Second}), - WeightUpdatePeriod: ptr.To(metav1.Duration{Duration: 1 * time.Second}), + BlackoutPeriod: MetaV1DurationPtr(30 * time.Second), + WeightExpirationPeriod: MetaV1DurationPtr(10 * time.Second), + WeightUpdatePeriod: MetaV1DurationPtr(1 * time.Second), MetricNamesForComputingUtilization: []string{"named_metrics.foo"}, }, }, diff --git a/internal/xds/translator/cluster_test.go b/internal/xds/translator/cluster_test.go index 89e7a67b6e..aae658bcda 100644 --- a/internal/xds/translator/cluster_test.go +++ b/internal/xds/translator/cluster_test.go @@ -17,7 +17,6 @@ import ( "google.golang.org/protobuf/testing/protocmp" "google.golang.org/protobuf/types/known/durationpb" "google.golang.org/protobuf/types/known/wrapperspb" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/utils/ptr" "sigs.k8s.io/yaml" @@ -91,8 +90,8 @@ func TestBuildXdsOutlierDetection(t *testing.T) { { name: "basic outlier detection", input: &ir.OutlierDetection{ - Interval: ptr.To(metav1.Duration{Duration: 10 * time.Second}), - BaseEjectionTime: ptr.To(metav1.Duration{Duration: 30 * time.Second}), + Interval: ir.MetaV1DurationPtr(10 * time.Second), + BaseEjectionTime: ir.MetaV1DurationPtr(30 * time.Second), MaxEjectionPercent: ptr.To[int32](10), Consecutive5xxErrors: ptr.To[uint32](5), }, @@ -106,8 +105,8 @@ func TestBuildXdsOutlierDetection(t *testing.T) { { name: "outlier detection with failure percentage threshold", input: &ir.OutlierDetection{ - Interval: ptr.To(metav1.Duration{Duration: 10 * time.Second}), - BaseEjectionTime: ptr.To(metav1.Duration{Duration: 30 * time.Second}), + Interval: ir.MetaV1DurationPtr(10 * time.Second), + BaseEjectionTime: ir.MetaV1DurationPtr(30 * time.Second), MaxEjectionPercent: ptr.To[int32](10), Consecutive5xxErrors: ptr.To[uint32](5), FailurePercentageThreshold: ptr.To[uint32](90), @@ -125,11 +124,11 @@ func TestBuildXdsOutlierDetection(t *testing.T) { name: "outlier detection with all fields", input: &ir.OutlierDetection{ SplitExternalLocalOriginErrors: ptr.To(true), - Interval: ptr.To(metav1.Duration{Duration: 10 * time.Second}), + Interval: ir.MetaV1DurationPtr(10 * time.Second), ConsecutiveLocalOriginFailures: ptr.To[uint32](3), ConsecutiveGatewayErrors: ptr.To[uint32](2), Consecutive5xxErrors: ptr.To[uint32](5), - BaseEjectionTime: ptr.To(metav1.Duration{Duration: 30 * time.Second}), + BaseEjectionTime: ir.MetaV1DurationPtr(30 * time.Second), MaxEjectionPercent: ptr.To[int32](10), FailurePercentageThreshold: ptr.To[uint32](85), }, From 777a1c1535f629f987a2ea93bfe79a51b77e1189 Mon Sep 17 00:00:00 2001 From: "anurag.ag" Date: Sun, 7 Dec 2025 23:12:38 +0530 Subject: [PATCH 09/23] Update: Add support for SlowStart configuration for ClientSideWeightedRoundRobin load balancer in Gateway CRDs, configurations, and tests. Adjust validation rules and documentation accordingly. Signed-off-by: anurag.ag --- api/v1alpha1/loadbalancer_types.go | 5 +- ....envoyproxy.io_backendtrafficpolicies.yaml | 10 +- ....envoyproxy.io_envoyextensionpolicies.yaml | 11 +- .../gateway.envoyproxy.io_envoyproxies.yaml | 40 +++---- ...ateway.envoyproxy.io_securitypolicies.yaml | 46 ++++---- ....envoyproxy.io_backendtrafficpolicies.yaml | 10 +- ....envoyproxy.io_envoyextensionpolicies.yaml | 11 +- .../gateway.envoyproxy.io_envoyproxies.yaml | 40 +++---- ...ateway.envoyproxy.io_securitypolicies.yaml | 46 ++++---- internal/gatewayapi/clustersettings.go | 9 ++ ...endtrafficpolicy-with-loadbalancer.in.yaml | 2 + ...ndtrafficpolicy-with-loadbalancer.out.yaml | 4 + internal/ir/xds.go | 1 + internal/ir/zz_generated.deepcopy.go | 5 + internal/xds/translator/cluster.go | 6 + internal/xds/translator/cluster_test.go | 36 ++++++ .../testdata/in/xds-ir/load-balancer.yaml | 2 + .../out/xds-ir/load-balancer.clusters.yaml | 2 + site/content/en/latest/api/extension_types.md | 3 +- .../backendtrafficpolicy_test.go | 8 +- test/helm/gateway-crds-helm/all.out.yaml | 107 +++++++++--------- .../envoy-gateway-crds.out.yaml | 107 +++++++++--------- 22 files changed, 289 insertions(+), 222 deletions(-) diff --git a/api/v1alpha1/loadbalancer_types.go b/api/v1alpha1/loadbalancer_types.go index 8dc3ad8494..821edc8e9e 100644 --- a/api/v1alpha1/loadbalancer_types.go +++ b/api/v1alpha1/loadbalancer_types.go @@ -12,7 +12,7 @@ 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 == 'ClientSideWeightedRoundRobin' ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)",message="If LoadBalancer type is ClientSideWeightedRoundRobin, clientSideWeightedRoundRobin field needs to be set." -// +kubebuilder:validation:XValidation:rule="self.type in ['Random', 'ConsistentHash', 'ClientSideWeightedRoundRobin'] ? !has(self.slowStart) : true ",message="Currently SlowStart is only supported for RoundRobin and LeastRequest load balancers." +// +kubebuilder:validation:XValidation:rule="self.type in ['Random', 'ConsistentHash'] ? !has(self.slowStart) : true ",message="Currently SlowStart is only supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers." // +kubebuilder:validation:XValidation:rule="self.type in ['ConsistentHash', 'ClientSideWeightedRoundRobin'] ? !has(self.zoneAware) : true ",message="Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers." type LoadBalancer struct { // Type decides the type of Load Balancer policy. @@ -47,7 +47,7 @@ type LoadBalancer struct { // SlowStart defines the configuration related to the slow start load balancer policy. // If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - // Currently this is only supported for RoundRobin and LeastRequest load balancers + // Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. // // +optional SlowStart *SlowStart `json:"slowStart,omitempty"` @@ -160,7 +160,6 @@ type Cookie struct { // ClientSideWeightedRoundRobin defines configuration for Envoy's Client-Side Weighted Round Robin policy. // See Envoy proto: envoy.extensions.load_balancing_policies.client_side_weighted_round_robin.v3.ClientSideWeightedRoundRobin -// Note: SlowStart is not supported for this policy in Envoy Gateway at this time. type ClientSideWeightedRoundRobin struct { // A given endpoint must report load metrics continuously for at least this long before the endpoint weight will be used. // Default is 10s. diff --git a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml index dd68f3d0f9..2f136be38d 100644 --- a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml +++ b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml @@ -871,7 +871,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Currently this is only supported for RoundRobin and LeastRequest load balancers + Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. properties: window: description: |- @@ -948,10 +948,10 @@ spec: field needs to be set. rule: 'self.type == ''ClientSideWeightedRoundRobin'' ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' - - message: Currently SlowStart is only supported for RoundRobin and - LeastRequest load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash'', ''ClientSideWeightedRoundRobin''] - ? !has(self.slowStart) : true ' + - message: Currently SlowStart is only supported for RoundRobin, LeastRequest, + and ClientSideWeightedRoundRobin load balancers. + rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) + : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] diff --git a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml index 4c9f64d0ef..8559743415 100644 --- a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml +++ b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml @@ -936,7 +936,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Currently this is only supported for RoundRobin and LeastRequest load balancers + Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. properties: window: description: |- @@ -1015,10 +1015,11 @@ spec: clientSideWeightedRoundRobin field needs to be set. rule: 'self.type == ''ClientSideWeightedRoundRobin'' ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' - - message: Currently SlowStart is only supported for RoundRobin - and LeastRequest load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash'', ''ClientSideWeightedRoundRobin''] - ? !has(self.slowStart) : true ' + - message: Currently SlowStart is only supported for RoundRobin, + LeastRequest, and ClientSideWeightedRoundRobin load + balancers. + rule: 'self.type in [''Random'', ''ConsistentHash''] ? + !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] diff --git a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyproxies.yaml b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyproxies.yaml index 60338bc148..272e493cb7 100644 --- a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyproxies.yaml +++ b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyproxies.yaml @@ -11947,7 +11947,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Currently this is only supported for RoundRobin and LeastRequest load balancers + Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. properties: window: description: |- @@ -12035,10 +12035,10 @@ spec: ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' - message: Currently SlowStart is only - supported for RoundRobin and LeastRequest - load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash'', - ''ClientSideWeightedRoundRobin''] + supported for RoundRobin, LeastRequest, + and ClientSideWeightedRoundRobin load + balancers. + rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, @@ -13260,7 +13260,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Currently this is only supported for RoundRobin and LeastRequest load balancers + Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. properties: window: description: |- @@ -13348,10 +13348,10 @@ spec: ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' - message: Currently SlowStart is only - supported for RoundRobin and LeastRequest - load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash'', - ''ClientSideWeightedRoundRobin''] + supported for RoundRobin, LeastRequest, + and ClientSideWeightedRoundRobin load + balancers. + rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, @@ -14659,7 +14659,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Currently this is only supported for RoundRobin and LeastRequest load balancers + Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. properties: window: description: |- @@ -14746,10 +14746,10 @@ spec: ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' - message: Currently SlowStart is only supported - for RoundRobin and LeastRequest load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash'', - ''ClientSideWeightedRoundRobin''] ? !has(self.slowStart) - : true ' + for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin + load balancers. + rule: 'self.type in [''Random'', ''ConsistentHash''] + ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. @@ -15964,7 +15964,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Currently this is only supported for RoundRobin and LeastRequest load balancers + Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. properties: window: description: |- @@ -16048,10 +16048,10 @@ spec: rule: 'self.type == ''ClientSideWeightedRoundRobin'' ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' - message: Currently SlowStart is only supported for - RoundRobin and LeastRequest load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash'', - ''ClientSideWeightedRoundRobin''] ? !has(self.slowStart) - : true ' + RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin + load balancers. + rule: 'self.type in [''Random'', ''ConsistentHash''] + ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] diff --git a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_securitypolicies.yaml b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_securitypolicies.yaml index cdfa9d0692..fee1943d49 100644 --- a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_securitypolicies.yaml +++ b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_securitypolicies.yaml @@ -1456,7 +1456,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Currently this is only supported for RoundRobin and LeastRequest load balancers + Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. properties: window: description: |- @@ -1537,11 +1537,11 @@ spec: clientSideWeightedRoundRobin field needs to be set. rule: 'self.type == ''ClientSideWeightedRoundRobin'' ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' - - message: Currently SlowStart is only supported for RoundRobin - and LeastRequest load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash'', - ''ClientSideWeightedRoundRobin''] ? !has(self.slowStart) - : true ' + - message: Currently SlowStart is only supported for RoundRobin, + LeastRequest, and ClientSideWeightedRoundRobin load + balancers. + rule: 'self.type in [''Random'', ''ConsistentHash''] + ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] @@ -2651,7 +2651,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Currently this is only supported for RoundRobin and LeastRequest load balancers + Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. properties: window: description: |- @@ -2732,11 +2732,11 @@ spec: clientSideWeightedRoundRobin field needs to be set. rule: 'self.type == ''ClientSideWeightedRoundRobin'' ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' - - message: Currently SlowStart is only supported for RoundRobin - and LeastRequest load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash'', - ''ClientSideWeightedRoundRobin''] ? !has(self.slowStart) - : true ' + - message: Currently SlowStart is only supported for RoundRobin, + LeastRequest, and ClientSideWeightedRoundRobin load + balancers. + rule: 'self.type in [''Random'', ''ConsistentHash''] + ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] @@ -4061,7 +4061,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Currently this is only supported for RoundRobin and LeastRequest load balancers + Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. properties: window: description: |- @@ -4145,10 +4145,10 @@ spec: rule: 'self.type == ''ClientSideWeightedRoundRobin'' ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' - message: Currently SlowStart is only supported - for RoundRobin and LeastRequest load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash'', - ''ClientSideWeightedRoundRobin''] ? !has(self.slowStart) - : true ' + for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin + load balancers. + rule: 'self.type in [''Random'', ''ConsistentHash''] + ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. @@ -5523,7 +5523,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Currently this is only supported for RoundRobin and LeastRequest load balancers + Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. properties: window: description: |- @@ -5604,11 +5604,11 @@ spec: clientSideWeightedRoundRobin field needs to be set. rule: 'self.type == ''ClientSideWeightedRoundRobin'' ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' - - message: Currently SlowStart is only supported for RoundRobin - and LeastRequest load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash'', - ''ClientSideWeightedRoundRobin''] ? !has(self.slowStart) - : true ' + - message: Currently SlowStart is only supported for RoundRobin, + LeastRequest, and ClientSideWeightedRoundRobin load + balancers. + rule: 'self.type in [''Random'', ''ConsistentHash''] + ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] diff --git a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml index 8e9a4d62fa..a9baebcbe7 100644 --- a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml +++ b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml @@ -870,7 +870,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Currently this is only supported for RoundRobin and LeastRequest load balancers + Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. properties: window: description: |- @@ -947,10 +947,10 @@ spec: field needs to be set. rule: 'self.type == ''ClientSideWeightedRoundRobin'' ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' - - message: Currently SlowStart is only supported for RoundRobin and - LeastRequest load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash'', ''ClientSideWeightedRoundRobin''] - ? !has(self.slowStart) : true ' + - message: Currently SlowStart is only supported for RoundRobin, LeastRequest, + and ClientSideWeightedRoundRobin load balancers. + rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) + : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] diff --git a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml index fdec36c497..e699decba6 100644 --- a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml +++ b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml @@ -935,7 +935,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Currently this is only supported for RoundRobin and LeastRequest load balancers + Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. properties: window: description: |- @@ -1014,10 +1014,11 @@ spec: clientSideWeightedRoundRobin field needs to be set. rule: 'self.type == ''ClientSideWeightedRoundRobin'' ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' - - message: Currently SlowStart is only supported for RoundRobin - and LeastRequest load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash'', ''ClientSideWeightedRoundRobin''] - ? !has(self.slowStart) : true ' + - message: Currently SlowStart is only supported for RoundRobin, + LeastRequest, and ClientSideWeightedRoundRobin load + balancers. + rule: 'self.type in [''Random'', ''ConsistentHash''] ? + !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] diff --git a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyproxies.yaml b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyproxies.yaml index 72b2a74fed..a4401232b3 100644 --- a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyproxies.yaml +++ b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyproxies.yaml @@ -11946,7 +11946,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Currently this is only supported for RoundRobin and LeastRequest load balancers + Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. properties: window: description: |- @@ -12034,10 +12034,10 @@ spec: ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' - message: Currently SlowStart is only - supported for RoundRobin and LeastRequest - load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash'', - ''ClientSideWeightedRoundRobin''] + supported for RoundRobin, LeastRequest, + and ClientSideWeightedRoundRobin load + balancers. + rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, @@ -13259,7 +13259,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Currently this is only supported for RoundRobin and LeastRequest load balancers + Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. properties: window: description: |- @@ -13347,10 +13347,10 @@ spec: ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' - message: Currently SlowStart is only - supported for RoundRobin and LeastRequest - load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash'', - ''ClientSideWeightedRoundRobin''] + supported for RoundRobin, LeastRequest, + and ClientSideWeightedRoundRobin load + balancers. + rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, @@ -14658,7 +14658,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Currently this is only supported for RoundRobin and LeastRequest load balancers + Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. properties: window: description: |- @@ -14745,10 +14745,10 @@ spec: ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' - message: Currently SlowStart is only supported - for RoundRobin and LeastRequest load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash'', - ''ClientSideWeightedRoundRobin''] ? !has(self.slowStart) - : true ' + for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin + load balancers. + rule: 'self.type in [''Random'', ''ConsistentHash''] + ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. @@ -15963,7 +15963,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Currently this is only supported for RoundRobin and LeastRequest load balancers + Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. properties: window: description: |- @@ -16047,10 +16047,10 @@ spec: rule: 'self.type == ''ClientSideWeightedRoundRobin'' ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' - message: Currently SlowStart is only supported for - RoundRobin and LeastRequest load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash'', - ''ClientSideWeightedRoundRobin''] ? !has(self.slowStart) - : true ' + RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin + load balancers. + rule: 'self.type in [''Random'', ''ConsistentHash''] + ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] diff --git a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_securitypolicies.yaml b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_securitypolicies.yaml index 480c5b092e..944129039d 100644 --- a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_securitypolicies.yaml +++ b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_securitypolicies.yaml @@ -1455,7 +1455,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Currently this is only supported for RoundRobin and LeastRequest load balancers + Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. properties: window: description: |- @@ -1536,11 +1536,11 @@ spec: clientSideWeightedRoundRobin field needs to be set. rule: 'self.type == ''ClientSideWeightedRoundRobin'' ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' - - message: Currently SlowStart is only supported for RoundRobin - and LeastRequest load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash'', - ''ClientSideWeightedRoundRobin''] ? !has(self.slowStart) - : true ' + - message: Currently SlowStart is only supported for RoundRobin, + LeastRequest, and ClientSideWeightedRoundRobin load + balancers. + rule: 'self.type in [''Random'', ''ConsistentHash''] + ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] @@ -2650,7 +2650,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Currently this is only supported for RoundRobin and LeastRequest load balancers + Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. properties: window: description: |- @@ -2731,11 +2731,11 @@ spec: clientSideWeightedRoundRobin field needs to be set. rule: 'self.type == ''ClientSideWeightedRoundRobin'' ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' - - message: Currently SlowStart is only supported for RoundRobin - and LeastRequest load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash'', - ''ClientSideWeightedRoundRobin''] ? !has(self.slowStart) - : true ' + - message: Currently SlowStart is only supported for RoundRobin, + LeastRequest, and ClientSideWeightedRoundRobin load + balancers. + rule: 'self.type in [''Random'', ''ConsistentHash''] + ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] @@ -4060,7 +4060,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Currently this is only supported for RoundRobin and LeastRequest load balancers + Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. properties: window: description: |- @@ -4144,10 +4144,10 @@ spec: rule: 'self.type == ''ClientSideWeightedRoundRobin'' ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' - message: Currently SlowStart is only supported - for RoundRobin and LeastRequest load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash'', - ''ClientSideWeightedRoundRobin''] ? !has(self.slowStart) - : true ' + for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin + load balancers. + rule: 'self.type in [''Random'', ''ConsistentHash''] + ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. @@ -5522,7 +5522,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Currently this is only supported for RoundRobin and LeastRequest load balancers + Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. properties: window: description: |- @@ -5603,11 +5603,11 @@ spec: clientSideWeightedRoundRobin field needs to be set. rule: 'self.type == ''ClientSideWeightedRoundRobin'' ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' - - message: Currently SlowStart is only supported for RoundRobin - and LeastRequest load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash'', - ''ClientSideWeightedRoundRobin''] ? !has(self.slowStart) - : true ' + - message: Currently SlowStart is only supported for RoundRobin, + LeastRequest, and ClientSideWeightedRoundRobin load + balancers. + rule: 'self.type in [''Random'', ''ConsistentHash''] + ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] diff --git a/internal/gatewayapi/clustersettings.go b/internal/gatewayapi/clustersettings.go index 94f572ebb6..2757a55b06 100644 --- a/internal/gatewayapi/clustersettings.go +++ b/internal/gatewayapi/clustersettings.go @@ -368,6 +368,15 @@ func buildLoadBalancer(policy *egv1a1.ClusterSettings) (*ir.LoadBalancer, error) lb.ClientSideWeightedRoundRobin.MetricNamesForComputingUtilization = append([]string(nil), cswrr.MetricNamesForComputingUtilization...) } } + if policy.LoadBalancer.SlowStart != nil && policy.LoadBalancer.SlowStart.Window != nil { + d, err := time.ParseDuration(string(*policy.LoadBalancer.SlowStart.Window)) + if err != nil { + return nil, err + } + lb.ClientSideWeightedRoundRobin.SlowStart = &ir.SlowStart{ + Window: ir.MetaV1DurationPtr(d), + } + } } // Add ZoneAware loadbalancer settings diff --git a/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer.in.yaml b/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer.in.yaml index 09dcc03acd..5e934b804e 100644 --- a/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer.in.yaml +++ b/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer.in.yaml @@ -244,6 +244,8 @@ backendTrafficPolicies: name: httproute-5 loadBalancer: type: ClientSideWeightedRoundRobin + slowStart: + window: 300s clientSideWeightedRoundRobin: blackoutPeriod: 10s weightExpirationPeriod: 60s diff --git a/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer.out.yaml b/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer.out.yaml index 6843afaa71..42c8bd585d 100644 --- a/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer.out.yaml +++ b/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer.out.yaml @@ -134,6 +134,8 @@ backendTrafficPolicies: - cpu_utilization weightExpirationPeriod: 60s weightUpdatePeriod: 10s + slowStart: + window: 300s type: ClientSideWeightedRoundRobin targetRef: group: gateway.networking.k8s.io @@ -819,6 +821,8 @@ xdsIR: errorUtilizationPenalty: 100 metricNamesForComputingUtilization: - cpu_utilization + slowStart: + window: 5m0s weightExpirationPeriod: 1m0s weightUpdatePeriod: 10s - destination: diff --git a/internal/ir/xds.go b/internal/ir/xds.go index d300217846..9b5585e7c8 100644 --- a/internal/ir/xds.go +++ b/internal/ir/xds.go @@ -2648,6 +2648,7 @@ type ClientSideWeightedRoundRobin struct { WeightUpdatePeriod *metav1.Duration `json:"weightUpdatePeriod,omitempty" yaml:"weightUpdatePeriod,omitempty"` ErrorUtilizationPenalty *uint32 `json:"errorUtilizationPenalty,omitempty" yaml:"errorUtilizationPenalty,omitempty"` MetricNamesForComputingUtilization []string `json:"metricNamesForComputingUtilization,omitempty" yaml:"metricNamesForComputingUtilization,omitempty"` + SlowStart *SlowStart `json:"slowStart,omitempty" yaml:"slowStart,omitempty"` } // ConsistentHash load balancer settings diff --git a/internal/ir/zz_generated.deepcopy.go b/internal/ir/zz_generated.deepcopy.go index b4b6b64f21..b466fdff9c 100644 --- a/internal/ir/zz_generated.deepcopy.go +++ b/internal/ir/zz_generated.deepcopy.go @@ -607,6 +607,11 @@ func (in *ClientSideWeightedRoundRobin) DeepCopyInto(out *ClientSideWeightedRoun *out = make([]string, len(*in)) copy(*out, *in) } + if in.SlowStart != nil { + in, out := &in.SlowStart, &out.SlowStart + *out = new(SlowStart) + (*in).DeepCopyInto(*out) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClientSideWeightedRoundRobin. diff --git a/internal/xds/translator/cluster.go b/internal/xds/translator/cluster.go index 0809d72d26..4afbb57f87 100644 --- a/internal/xds/translator/cluster.go +++ b/internal/xds/translator/cluster.go @@ -412,6 +412,12 @@ func buildXdsCluster(args *xdsClusterArgs) (*buildClusterResult, error) { if v.WeightUpdatePeriod != nil && v.WeightUpdatePeriod.Duration > 0 { cswrr.WeightUpdatePeriod = durationpb.New(v.WeightUpdatePeriod.Duration) } + // Map SlowStart for CSWRR if configured in IR + if v.SlowStart != nil && v.SlowStart.Window != nil && v.SlowStart.Window.Duration > 0 { + cswrr.SlowStartConfig = &commonv3.SlowStartConfig{ + SlowStartWindow: durationpb.New(v.SlowStart.Window.Duration), + } + } if v.ErrorUtilizationPenalty != nil { cswrr.ErrorUtilizationPenalty = wrapperspb.Float(float32(*v.ErrorUtilizationPenalty) / 100.0) } diff --git a/internal/xds/translator/cluster_test.go b/internal/xds/translator/cluster_test.go index aae658bcda..5b05419484 100644 --- a/internal/xds/translator/cluster_test.go +++ b/internal/xds/translator/cluster_test.go @@ -11,6 +11,7 @@ import ( bootstrapv3 "github.com/envoyproxy/go-control-plane/envoy/config/bootstrap/v3" clusterv3 "github.com/envoyproxy/go-control-plane/envoy/config/cluster/v3" + cswrrv3 "github.com/envoyproxy/go-control-plane/envoy/extensions/load_balancing_policies/client_side_weighted_round_robin/v3" "github.com/google/go-cmp/cmp" "github.com/stretchr/testify/require" "google.golang.org/protobuf/encoding/protojson" @@ -185,3 +186,38 @@ func TestBuildCluster_WithClientSideWeightedRoundRobin(t *testing.T) { require.NotNil(t, policy.TypedExtensionConfig.TypedConfig) require.Equal(t, "type.googleapis.com/envoy.extensions.load_balancing_policies.client_side_weighted_round_robin.v3.ClientSideWeightedRoundRobin", policy.TypedExtensionConfig.TypedConfig.TypeUrl) } + +func TestBuildCluster_WithClientSideWeightedRoundRobin_SlowStart(t *testing.T) { + window := 5 * time.Second + args := &xdsClusterArgs{ + name: "test-cluster-cswrr-ss", + endpointType: EndpointTypeStatic, + settings: []*ir.DestinationSetting{{ + Endpoints: []*ir.DestinationEndpoint{{Host: "127.0.0.1", Port: 8080}}, + }}, + loadBalancer: &ir.LoadBalancer{ClientSideWeightedRoundRobin: &ir.ClientSideWeightedRoundRobin{ + SlowStart: &ir.SlowStart{Window: ir.MetaV1DurationPtr(window)}, + }}, + } + + result, err := buildXdsCluster(args) + require.NoError(t, err) + require.NotNil(t, result) + cluster := result.cluster + require.NotNil(t, cluster) + + require.NotNil(t, cluster.LoadBalancingPolicy) + require.Len(t, cluster.LoadBalancingPolicy.Policies, 1) + policy := cluster.LoadBalancingPolicy.Policies[0] + require.NotNil(t, policy) + require.NotNil(t, policy.TypedExtensionConfig) + require.Equal(t, "envoy.load_balancing_policies.client_side_weighted_round_robin", policy.TypedExtensionConfig.Name) + + // Unmarshal and verify SlowStartConfig is present + cswrr := &cswrrv3.ClientSideWeightedRoundRobin{} + err = policy.TypedExtensionConfig.TypedConfig.UnmarshalTo(cswrr) + require.NoError(t, err) + require.NotNil(t, cswrr.SlowStartConfig) + require.NotNil(t, cswrr.SlowStartConfig.SlowStartWindow) + require.Equal(t, window, cswrr.SlowStartConfig.SlowStartWindow.AsDuration()) +} diff --git a/internal/xds/translator/testdata/in/xds-ir/load-balancer.yaml b/internal/xds/translator/testdata/in/xds-ir/load-balancer.yaml index d37ccd2d96..aa79333fb0 100644 --- a/internal/xds/translator/testdata/in/xds-ir/load-balancer.yaml +++ b/internal/xds/translator/testdata/in/xds-ir/load-balancer.yaml @@ -225,6 +225,8 @@ http: blackoutPeriod: 30s weightExpirationPeriod: 60s weightUpdatePeriod: 10s + slowStart: + window: 45s errorUtilizationPenalty: 100 metricNamesForComputingUtilization: - "cpu_utilization" diff --git a/internal/xds/translator/testdata/out/xds-ir/load-balancer.clusters.yaml b/internal/xds/translator/testdata/out/xds-ir/load-balancer.clusters.yaml index bc05f9550f..613dd80c37 100644 --- a/internal/xds/translator/testdata/out/xds-ir/load-balancer.clusters.yaml +++ b/internal/xds/translator/testdata/out/xds-ir/load-balancer.clusters.yaml @@ -387,6 +387,8 @@ errorUtilizationPenalty: 1 metricNamesForComputingUtilization: - cpu_utilization + slowStartConfig: + slowStartWindow: 45s weightExpirationPeriod: 60s weightUpdatePeriod: 10s name: sixteenth-route-dest diff --git a/site/content/en/latest/api/extension_types.md b/site/content/en/latest/api/extension_types.md index f54c895395..ecc5fa1285 100644 --- a/site/content/en/latest/api/extension_types.md +++ b/site/content/en/latest/api/extension_types.md @@ -727,7 +727,6 @@ _Appears in:_ ClientSideWeightedRoundRobin defines configuration for Envoy's Client-Side Weighted Round Robin policy. See Envoy proto: envoy.extensions.load_balancing_policies.client_side_weighted_round_robin.v3.ClientSideWeightedRoundRobin -Note: SlowStart is not supported for this policy in Envoy Gateway at this time. _Appears in:_ - [LoadBalancer](#loadbalancer) @@ -3277,7 +3276,7 @@ _Appears in:_ | `consistentHash` | _[ConsistentHash](#consistenthash)_ | false | | ConsistentHash defines the configuration when the load balancer type is
set to ConsistentHash | | `clientSideWeightedRoundRobin` | _[ClientSideWeightedRoundRobin](#clientsideweightedroundrobin)_ | false | | ClientSideWeightedRoundRobin defines the configuration when the load balancer type is
set to ClientSideWeightedRoundRobin. | | `endpointOverride` | _[EndpointOverride](#endpointoverride)_ | false | | EndpointOverride defines the configuration for endpoint override.
When specified, the load balancer will attempt to route requests to endpoints
based on the override information extracted from request headers or metadata.
If the override endpoints are not available, the configured load balancer policy will be used as fallback. | -| `slowStart` | _[SlowStart](#slowstart)_ | false | | SlowStart defines the configuration related to the slow start load balancer policy.
If set, during slow start window, traffic sent to the newly added hosts will gradually increase.
Currently this is only supported for RoundRobin and LeastRequest load balancers | +| `slowStart` | _[SlowStart](#slowstart)_ | false | | SlowStart defines the configuration related to the slow start load balancer policy.
If set, during slow start window, traffic sent to the newly added hosts will gradually increase.
Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. | | `zoneAware` | _[ZoneAware](#zoneaware)_ | false | | ZoneAware defines the configuration related to the distribution of requests between locality zones. | diff --git a/test/cel-validation/backendtrafficpolicy_test.go b/test/cel-validation/backendtrafficpolicy_test.go index e1111782b5..09493ac67b 100644 --- a/test/cel-validation/backendtrafficpolicy_test.go +++ b/test/cel-validation/backendtrafficpolicy_test.go @@ -487,7 +487,7 @@ func TestBackendTrafficPolicyTarget(t *testing.T) { } }, wantErrors: []string{ - "spec.loadBalancer: Invalid value: \"object\": Currently SlowStart is only supported for RoundRobin and LeastRequest load balancers.", + "spec.loadBalancer: Invalid value: \"object\": Currently SlowStart is only supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers.", }, }, { @@ -514,7 +514,7 @@ func TestBackendTrafficPolicyTarget(t *testing.T) { } }, wantErrors: []string{ - "spec.loadBalancer: Invalid value: \"object\": Currently SlowStart is only supported for RoundRobin and LeastRequest load balancers.", + "spec.loadBalancer: Invalid value: \"object\": Currently SlowStart is only supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers.", }, }, { @@ -592,9 +592,7 @@ func TestBackendTrafficPolicyTarget(t *testing.T) { }, } }, - wantErrors: []string{ - "spec.loadBalancer: Invalid value: \"object\": Currently SlowStart is only supported for RoundRobin and LeastRequest load balancers.", - }, + wantErrors: []string{}, }, { desc: "cswrr with ZoneAware is set", diff --git a/test/helm/gateway-crds-helm/all.out.yaml b/test/helm/gateway-crds-helm/all.out.yaml index 4cf47ba1f2..990f495971 100644 --- a/test/helm/gateway-crds-helm/all.out.yaml +++ b/test/helm/gateway-crds-helm/all.out.yaml @@ -22168,7 +22168,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Currently this is only supported for RoundRobin and LeastRequest load balancers + Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. properties: window: description: |- @@ -22245,10 +22245,10 @@ spec: field needs to be set. rule: 'self.type == ''ClientSideWeightedRoundRobin'' ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' - - message: Currently SlowStart is only supported for RoundRobin and - LeastRequest load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash'', ''ClientSideWeightedRoundRobin''] - ? !has(self.slowStart) : true ' + - message: Currently SlowStart is only supported for RoundRobin, LeastRequest, + and ClientSideWeightedRoundRobin load balancers. + rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) + : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] @@ -26882,7 +26882,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Currently this is only supported for RoundRobin and LeastRequest load balancers + Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. properties: window: description: |- @@ -26961,10 +26961,11 @@ spec: clientSideWeightedRoundRobin field needs to be set. rule: 'self.type == ''ClientSideWeightedRoundRobin'' ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' - - message: Currently SlowStart is only supported for RoundRobin - and LeastRequest load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash'', ''ClientSideWeightedRoundRobin''] - ? !has(self.slowStart) : true ' + - message: Currently SlowStart is only supported for RoundRobin, + LeastRequest, and ClientSideWeightedRoundRobin load + balancers. + rule: 'self.type in [''Random'', ''ConsistentHash''] ? + !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] @@ -40623,7 +40624,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Currently this is only supported for RoundRobin and LeastRequest load balancers + Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. properties: window: description: |- @@ -40711,10 +40712,10 @@ spec: ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' - message: Currently SlowStart is only - supported for RoundRobin and LeastRequest - load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash'', - ''ClientSideWeightedRoundRobin''] + supported for RoundRobin, LeastRequest, + and ClientSideWeightedRoundRobin load + balancers. + rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, @@ -41936,7 +41937,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Currently this is only supported for RoundRobin and LeastRequest load balancers + Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. properties: window: description: |- @@ -42024,10 +42025,10 @@ spec: ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' - message: Currently SlowStart is only - supported for RoundRobin and LeastRequest - load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash'', - ''ClientSideWeightedRoundRobin''] + supported for RoundRobin, LeastRequest, + and ClientSideWeightedRoundRobin load + balancers. + rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, @@ -43335,7 +43336,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Currently this is only supported for RoundRobin and LeastRequest load balancers + Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. properties: window: description: |- @@ -43422,10 +43423,10 @@ spec: ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' - message: Currently SlowStart is only supported - for RoundRobin and LeastRequest load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash'', - ''ClientSideWeightedRoundRobin''] ? !has(self.slowStart) - : true ' + for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin + load balancers. + rule: 'self.type in [''Random'', ''ConsistentHash''] + ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. @@ -44640,7 +44641,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Currently this is only supported for RoundRobin and LeastRequest load balancers + Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. properties: window: description: |- @@ -44724,10 +44725,10 @@ spec: rule: 'self.type == ''ClientSideWeightedRoundRobin'' ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' - message: Currently SlowStart is only supported for - RoundRobin and LeastRequest load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash'', - ''ClientSideWeightedRoundRobin''] ? !has(self.slowStart) - : true ' + RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin + load balancers. + rule: 'self.type in [''Random'', ''ConsistentHash''] + ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] @@ -46918,7 +46919,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Currently this is only supported for RoundRobin and LeastRequest load balancers + Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. properties: window: description: |- @@ -46999,11 +47000,11 @@ spec: clientSideWeightedRoundRobin field needs to be set. rule: 'self.type == ''ClientSideWeightedRoundRobin'' ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' - - message: Currently SlowStart is only supported for RoundRobin - and LeastRequest load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash'', - ''ClientSideWeightedRoundRobin''] ? !has(self.slowStart) - : true ' + - message: Currently SlowStart is only supported for RoundRobin, + LeastRequest, and ClientSideWeightedRoundRobin load + balancers. + rule: 'self.type in [''Random'', ''ConsistentHash''] + ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] @@ -48113,7 +48114,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Currently this is only supported for RoundRobin and LeastRequest load balancers + Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. properties: window: description: |- @@ -48194,11 +48195,11 @@ spec: clientSideWeightedRoundRobin field needs to be set. rule: 'self.type == ''ClientSideWeightedRoundRobin'' ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' - - message: Currently SlowStart is only supported for RoundRobin - and LeastRequest load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash'', - ''ClientSideWeightedRoundRobin''] ? !has(self.slowStart) - : true ' + - message: Currently SlowStart is only supported for RoundRobin, + LeastRequest, and ClientSideWeightedRoundRobin load + balancers. + rule: 'self.type in [''Random'', ''ConsistentHash''] + ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] @@ -49523,7 +49524,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Currently this is only supported for RoundRobin and LeastRequest load balancers + Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. properties: window: description: |- @@ -49607,10 +49608,10 @@ spec: rule: 'self.type == ''ClientSideWeightedRoundRobin'' ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' - message: Currently SlowStart is only supported - for RoundRobin and LeastRequest load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash'', - ''ClientSideWeightedRoundRobin''] ? !has(self.slowStart) - : true ' + for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin + load balancers. + rule: 'self.type in [''Random'', ''ConsistentHash''] + ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. @@ -50985,7 +50986,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Currently this is only supported for RoundRobin and LeastRequest load balancers + Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. properties: window: description: |- @@ -51066,11 +51067,11 @@ spec: clientSideWeightedRoundRobin field needs to be set. rule: 'self.type == ''ClientSideWeightedRoundRobin'' ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' - - message: Currently SlowStart is only supported for RoundRobin - and LeastRequest load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash'', - ''ClientSideWeightedRoundRobin''] ? !has(self.slowStart) - : true ' + - message: Currently SlowStart is only supported for RoundRobin, + LeastRequest, and ClientSideWeightedRoundRobin load + balancers. + rule: 'self.type in [''Random'', ''ConsistentHash''] + ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] diff --git a/test/helm/gateway-crds-helm/envoy-gateway-crds.out.yaml b/test/helm/gateway-crds-helm/envoy-gateway-crds.out.yaml index 7b4f823518..ae0da97132 100644 --- a/test/helm/gateway-crds-helm/envoy-gateway-crds.out.yaml +++ b/test/helm/gateway-crds-helm/envoy-gateway-crds.out.yaml @@ -1348,7 +1348,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Currently this is only supported for RoundRobin and LeastRequest load balancers + Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. properties: window: description: |- @@ -1425,10 +1425,10 @@ spec: field needs to be set. rule: 'self.type == ''ClientSideWeightedRoundRobin'' ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' - - message: Currently SlowStart is only supported for RoundRobin and - LeastRequest load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash'', ''ClientSideWeightedRoundRobin''] - ? !has(self.slowStart) : true ' + - message: Currently SlowStart is only supported for RoundRobin, LeastRequest, + and ClientSideWeightedRoundRobin load balancers. + rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) + : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] @@ -6062,7 +6062,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Currently this is only supported for RoundRobin and LeastRequest load balancers + Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. properties: window: description: |- @@ -6141,10 +6141,11 @@ spec: clientSideWeightedRoundRobin field needs to be set. rule: 'self.type == ''ClientSideWeightedRoundRobin'' ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' - - message: Currently SlowStart is only supported for RoundRobin - and LeastRequest load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash'', ''ClientSideWeightedRoundRobin''] - ? !has(self.slowStart) : true ' + - message: Currently SlowStart is only supported for RoundRobin, + LeastRequest, and ClientSideWeightedRoundRobin load + balancers. + rule: 'self.type in [''Random'', ''ConsistentHash''] ? + !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] @@ -19803,7 +19804,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Currently this is only supported for RoundRobin and LeastRequest load balancers + Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. properties: window: description: |- @@ -19891,10 +19892,10 @@ spec: ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' - message: Currently SlowStart is only - supported for RoundRobin and LeastRequest - load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash'', - ''ClientSideWeightedRoundRobin''] + supported for RoundRobin, LeastRequest, + and ClientSideWeightedRoundRobin load + balancers. + rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, @@ -21116,7 +21117,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Currently this is only supported for RoundRobin and LeastRequest load balancers + Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. properties: window: description: |- @@ -21204,10 +21205,10 @@ spec: ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' - message: Currently SlowStart is only - supported for RoundRobin and LeastRequest - load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash'', - ''ClientSideWeightedRoundRobin''] + supported for RoundRobin, LeastRequest, + and ClientSideWeightedRoundRobin load + balancers. + rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, @@ -22515,7 +22516,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Currently this is only supported for RoundRobin and LeastRequest load balancers + Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. properties: window: description: |- @@ -22602,10 +22603,10 @@ spec: ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' - message: Currently SlowStart is only supported - for RoundRobin and LeastRequest load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash'', - ''ClientSideWeightedRoundRobin''] ? !has(self.slowStart) - : true ' + for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin + load balancers. + rule: 'self.type in [''Random'', ''ConsistentHash''] + ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. @@ -23820,7 +23821,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Currently this is only supported for RoundRobin and LeastRequest load balancers + Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. properties: window: description: |- @@ -23904,10 +23905,10 @@ spec: rule: 'self.type == ''ClientSideWeightedRoundRobin'' ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' - message: Currently SlowStart is only supported for - RoundRobin and LeastRequest load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash'', - ''ClientSideWeightedRoundRobin''] ? !has(self.slowStart) - : true ' + RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin + load balancers. + rule: 'self.type in [''Random'', ''ConsistentHash''] + ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] @@ -26098,7 +26099,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Currently this is only supported for RoundRobin and LeastRequest load balancers + Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. properties: window: description: |- @@ -26179,11 +26180,11 @@ spec: clientSideWeightedRoundRobin field needs to be set. rule: 'self.type == ''ClientSideWeightedRoundRobin'' ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' - - message: Currently SlowStart is only supported for RoundRobin - and LeastRequest load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash'', - ''ClientSideWeightedRoundRobin''] ? !has(self.slowStart) - : true ' + - message: Currently SlowStart is only supported for RoundRobin, + LeastRequest, and ClientSideWeightedRoundRobin load + balancers. + rule: 'self.type in [''Random'', ''ConsistentHash''] + ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] @@ -27293,7 +27294,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Currently this is only supported for RoundRobin and LeastRequest load balancers + Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. properties: window: description: |- @@ -27374,11 +27375,11 @@ spec: clientSideWeightedRoundRobin field needs to be set. rule: 'self.type == ''ClientSideWeightedRoundRobin'' ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' - - message: Currently SlowStart is only supported for RoundRobin - and LeastRequest load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash'', - ''ClientSideWeightedRoundRobin''] ? !has(self.slowStart) - : true ' + - message: Currently SlowStart is only supported for RoundRobin, + LeastRequest, and ClientSideWeightedRoundRobin load + balancers. + rule: 'self.type in [''Random'', ''ConsistentHash''] + ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] @@ -28703,7 +28704,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Currently this is only supported for RoundRobin and LeastRequest load balancers + Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. properties: window: description: |- @@ -28787,10 +28788,10 @@ spec: rule: 'self.type == ''ClientSideWeightedRoundRobin'' ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' - message: Currently SlowStart is only supported - for RoundRobin and LeastRequest load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash'', - ''ClientSideWeightedRoundRobin''] ? !has(self.slowStart) - : true ' + for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin + load balancers. + rule: 'self.type in [''Random'', ''ConsistentHash''] + ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. @@ -30165,7 +30166,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Currently this is only supported for RoundRobin and LeastRequest load balancers + Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. properties: window: description: |- @@ -30246,11 +30247,11 @@ spec: clientSideWeightedRoundRobin field needs to be set. rule: 'self.type == ''ClientSideWeightedRoundRobin'' ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' - - message: Currently SlowStart is only supported for RoundRobin - and LeastRequest load balancers. - rule: 'self.type in [''Random'', ''ConsistentHash'', - ''ClientSideWeightedRoundRobin''] ? !has(self.slowStart) - : true ' + - message: Currently SlowStart is only supported for RoundRobin, + LeastRequest, and ClientSideWeightedRoundRobin load + balancers. + rule: 'self.type in [''Random'', ''ConsistentHash''] + ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] From 234cffa64c58e9d57e9b19c4fd4085ea27d0c9cf Mon Sep 17 00:00:00 2001 From: "anurag.ag" Date: Wed, 21 Jan 2026 13:45:13 +0530 Subject: [PATCH 10/23] Update: Replace `ClientSideWeightedRoundRobin` load balancer type with `BackendUtilization` in Gateway CRDs, configurations, and tests. Revise validation rules, documentation, and enums accordingly. Signed-off-by: anurag.ag --- api/v1alpha1/loadbalancer_types.go | 26 +- api/v1alpha1/zz_generated.deepcopy.go | 86 +++--- ....envoyproxy.io_backendtrafficpolicies.yaml | 22 +- ....envoyproxy.io_envoyextensionpolicies.yaml | 25 +- .../gateway.envoyproxy.io_envoyproxies.yaml | 111 ++++---- ...ateway.envoyproxy.io_securitypolicies.yaml | 100 ++++--- ....envoyproxy.io_backendtrafficpolicies.yaml | 22 +- ....envoyproxy.io_envoyextensionpolicies.yaml | 25 +- .../gateway.envoyproxy.io_envoyproxies.yaml | 111 ++++---- ...ateway.envoyproxy.io_securitypolicies.yaml | 100 ++++--- internal/gatewayapi/clustersettings.go | 36 +-- ...lustersettings_backendutilization_test.go} | 12 +- ...endtrafficpolicy-with-loadbalancer.in.yaml | 4 +- ...ndtrafficpolicy-with-loadbalancer.out.yaml | 6 +- internal/ir/xds.go | 14 +- internal/ir/xds_test.go | 4 +- internal/ir/zz_generated.deepcopy.go | 96 +++---- internal/xds/translator/cluster.go | 13 +- internal/xds/translator/cluster_test.go | 12 +- .../testdata/in/xds-ir/load-balancer.yaml | 4 +- site/content/en/latest/api/extension_types.md | 46 ++-- .../backendtrafficpolicy_test.go | 42 +-- ...> load_balancing_backend_utilization.yaml} | 22 +- test/e2e/tests/load_balancing.go | 38 +-- .../FuzzGatewayAPIToXDS/traffic_policy | 8 +- test/helm/gateway-crds-helm/all.out.yaml | 258 +++++++++--------- .../envoy-gateway-crds.out.yaml | 258 +++++++++--------- 27 files changed, 727 insertions(+), 774 deletions(-) rename internal/gatewayapi/{clustersettings_cswrr_test.go => clustersettings_backendutilization_test.go} (80%) rename test/e2e/testdata/{load_balancing_client_side_weighted_round_robin.yaml => load_balancing_backend_utilization.yaml} (83%) diff --git a/api/v1alpha1/loadbalancer_types.go b/api/v1alpha1/loadbalancer_types.go index 50605f635d..b162e301df 100644 --- a/api/v1alpha1/loadbalancer_types.go +++ b/api/v1alpha1/loadbalancer_types.go @@ -11,9 +11,9 @@ import gwapiv1 "sigs.k8s.io/gateway-api/apis/v1" // +union // // +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 == 'ClientSideWeightedRoundRobin' ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)",message="If LoadBalancer type is ClientSideWeightedRoundRobin, clientSideWeightedRoundRobin 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, LeastRequest, and ClientSideWeightedRoundRobin load balancers." -// +kubebuilder:validation:XValidation:rule="self.type in ['ConsistentHash', 'ClientSideWeightedRoundRobin'] ? !has(self.zoneAware) : true ",message="Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers." +// +kubebuilder:validation:XValidation:rule="self.type == 'BackendUtilization' ? has(self.backendUtilization) : !has(self.backendUtilization)",message="If LoadBalancer type is BackendUtilization, backendUtilization 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, LeastRequest, and BackendUtilization load balancers." +// +kubebuilder:validation:XValidation:rule="self.type in ['ConsistentHash', 'BackendUtilization'] ? !has(self.zoneAware) : true ",message="Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers." type LoadBalancer struct { // Type decides the type of Load Balancer policy. // Valid LoadBalancerType values are @@ -21,7 +21,7 @@ type LoadBalancer struct { // "LeastRequest", // "Random", // "RoundRobin", - // "ClientSideWeightedRoundRobin". + // "BackendUtilization". // // +unionDiscriminator Type LoadBalancerType `json:"type"` @@ -31,11 +31,11 @@ type LoadBalancer struct { // +optional ConsistentHash *ConsistentHash `json:"consistentHash,omitempty"` - // ClientSideWeightedRoundRobin defines the configuration when the load balancer type is - // set to ClientSideWeightedRoundRobin. + // BackendUtilization defines the configuration when the load balancer type is + // set to BackendUtilization. // // +optional - ClientSideWeightedRoundRobin *ClientSideWeightedRoundRobin `json:"clientSideWeightedRoundRobin,omitempty"` + BackendUtilization *BackendUtilization `json:"backendUtilization,omitempty"` // EndpointOverride defines the configuration for endpoint override. // When specified, the load balancer will attempt to route requests to endpoints @@ -47,7 +47,7 @@ type LoadBalancer struct { // SlowStart defines the configuration related to the slow start load balancer policy. // If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - // Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. + // Supported for RoundRobin, LeastRequest, and BackendUtilization load balancers. // // +optional SlowStart *SlowStart `json:"slowStart,omitempty"` @@ -59,7 +59,7 @@ type LoadBalancer struct { } // LoadBalancerType specifies the types of LoadBalancer. -// +kubebuilder:validation:Enum=ConsistentHash;LeastRequest;Random;RoundRobin;ClientSideWeightedRoundRobin +// +kubebuilder:validation:Enum=ConsistentHash;LeastRequest;Random;RoundRobin;BackendUtilization type LoadBalancerType string const ( @@ -71,8 +71,8 @@ const ( RandomLoadBalancerType LoadBalancerType = "Random" // RoundRobinLoadBalancerType load balancer policy. RoundRobinLoadBalancerType LoadBalancerType = "RoundRobin" - // ClientSideWeightedRoundRobinLoadBalancerType load balancer policy. - ClientSideWeightedRoundRobinLoadBalancerType LoadBalancerType = "ClientSideWeightedRoundRobin" + // BackendUtilizationLoadBalancerType load balancer policy. + BackendUtilizationLoadBalancerType LoadBalancerType = "BackendUtilization" ) // ConsistentHash defines the configuration related to the consistent hash @@ -158,9 +158,9 @@ type Cookie struct { Attributes map[string]string `json:"attributes,omitempty"` } -// ClientSideWeightedRoundRobin defines configuration for Envoy's Client-Side Weighted Round Robin policy. +// BackendUtilization defines configuration for Envoy's Backend Utilization policy. // See Envoy proto: envoy.extensions.load_balancing_policies.client_side_weighted_round_robin.v3.ClientSideWeightedRoundRobin -type ClientSideWeightedRoundRobin struct { +type BackendUtilization struct { // A given endpoint must report load metrics continuously for at least this long before the endpoint weight will be used. // Default is 10s. // +optional diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index 2c5768ba02..d452fb3d42 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -804,6 +804,46 @@ func (in *BackendTrafficPolicySpec) DeepCopy() *BackendTrafficPolicySpec { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BackendUtilization) DeepCopyInto(out *BackendUtilization) { + *out = *in + if in.BlackoutPeriod != nil { + in, out := &in.BlackoutPeriod, &out.BlackoutPeriod + *out = new(v1.Duration) + **out = **in + } + if in.WeightExpirationPeriod != nil { + in, out := &in.WeightExpirationPeriod, &out.WeightExpirationPeriod + *out = new(v1.Duration) + **out = **in + } + if in.WeightUpdatePeriod != nil { + in, out := &in.WeightUpdatePeriod, &out.WeightUpdatePeriod + *out = new(v1.Duration) + **out = **in + } + if in.ErrorUtilizationPenalty != nil { + in, out := &in.ErrorUtilizationPenalty, &out.ErrorUtilizationPenalty + *out = new(uint32) + **out = **in + } + if in.MetricNamesForComputingUtilization != nil { + in, out := &in.MetricNamesForComputingUtilization, &out.MetricNamesForComputingUtilization + *out = make([]string, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackendUtilization. +func (in *BackendUtilization) DeepCopy() *BackendUtilization { + if in == nil { + return nil + } + out := new(BackendUtilization) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *BasicAuth) DeepCopyInto(out *BasicAuth) { *out = *in @@ -1020,46 +1060,6 @@ func (in *ClientIPDetectionSettings) DeepCopy() *ClientIPDetectionSettings { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ClientSideWeightedRoundRobin) DeepCopyInto(out *ClientSideWeightedRoundRobin) { - *out = *in - if in.BlackoutPeriod != nil { - in, out := &in.BlackoutPeriod, &out.BlackoutPeriod - *out = new(v1.Duration) - **out = **in - } - if in.WeightExpirationPeriod != nil { - in, out := &in.WeightExpirationPeriod, &out.WeightExpirationPeriod - *out = new(v1.Duration) - **out = **in - } - if in.WeightUpdatePeriod != nil { - in, out := &in.WeightUpdatePeriod, &out.WeightUpdatePeriod - *out = new(v1.Duration) - **out = **in - } - if in.ErrorUtilizationPenalty != nil { - in, out := &in.ErrorUtilizationPenalty, &out.ErrorUtilizationPenalty - *out = new(uint32) - **out = **in - } - if in.MetricNamesForComputingUtilization != nil { - in, out := &in.MetricNamesForComputingUtilization, &out.MetricNamesForComputingUtilization - *out = make([]string, len(*in)) - copy(*out, *in) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClientSideWeightedRoundRobin. -func (in *ClientSideWeightedRoundRobin) DeepCopy() *ClientSideWeightedRoundRobin { - if in == nil { - return nil - } - out := new(ClientSideWeightedRoundRobin) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ClientTLSSettings) DeepCopyInto(out *ClientTLSSettings) { *out = *in @@ -4938,9 +4938,9 @@ func (in *LoadBalancer) DeepCopyInto(out *LoadBalancer) { *out = new(ConsistentHash) (*in).DeepCopyInto(*out) } - if in.ClientSideWeightedRoundRobin != nil { - in, out := &in.ClientSideWeightedRoundRobin, &out.ClientSideWeightedRoundRobin - *out = new(ClientSideWeightedRoundRobin) + if in.BackendUtilization != nil { + in, out := &in.BackendUtilization, &out.BackendUtilization + *out = new(BackendUtilization) (*in).DeepCopyInto(*out) } if in.EndpointOverride != nil { diff --git a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml index 198d1975df..7170377280 100644 --- a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml +++ b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml @@ -706,10 +706,10 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: - clientSideWeightedRoundRobin: + backendUtilization: description: |- - ClientSideWeightedRoundRobin defines the configuration when the load balancer type is - set to ClientSideWeightedRoundRobin. + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. properties: blackoutPeriod: description: |- @@ -899,7 +899,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. + Supported for RoundRobin, LeastRequest, and BackendUtilization load balancers. properties: window: description: |- @@ -920,13 +920,13 @@ spec: "LeastRequest", "Random", "RoundRobin", - "ClientSideWeightedRoundRobin". + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin - - ClientSideWeightedRoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the configuration related to the @@ -972,17 +972,17 @@ spec: field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' - - message: If LoadBalancer type is ClientSideWeightedRoundRobin, clientSideWeightedRoundRobin + - message: If LoadBalancer type is BackendUtilization, backendUtilization field needs to be set. - rule: 'self.type == ''ClientSideWeightedRoundRobin'' ? has(self.clientSideWeightedRoundRobin) - : !has(self.clientSideWeightedRoundRobin)' + rule: 'self.type == ''BackendUtilization'' ? has(self.backendUtilization) + : !has(self.backendUtilization)' - message: Currently SlowStart is only supported for RoundRobin, LeastRequest, - and ClientSideWeightedRoundRobin load balancers. + and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. - rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] + rule: 'self.type in [''ConsistentHash'', ''BackendUtilization''] ? !has(self.zoneAware) : true ' mergeType: description: |- diff --git a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml index 8559743415..1718c88e7a 100644 --- a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml +++ b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml @@ -736,10 +736,10 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: - clientSideWeightedRoundRobin: + backendUtilization: description: |- - ClientSideWeightedRoundRobin defines the configuration when the load balancer type is - set to ClientSideWeightedRoundRobin. + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. properties: blackoutPeriod: description: |- @@ -936,7 +936,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. + Supported for RoundRobin, LeastRequest, and BackendUtilization load balancers. properties: window: description: |- @@ -957,13 +957,13 @@ spec: "LeastRequest", "Random", "RoundRobin", - "ClientSideWeightedRoundRobin". + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin - - ClientSideWeightedRoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the configuration related @@ -1011,18 +1011,17 @@ spec: field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' - - message: If LoadBalancer type is ClientSideWeightedRoundRobin, - clientSideWeightedRoundRobin field needs to be set. - rule: 'self.type == ''ClientSideWeightedRoundRobin'' ? - has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' + - message: If LoadBalancer type is BackendUtilization, backendUtilization + field needs to be set. + rule: 'self.type == ''BackendUtilization'' ? has(self.backendUtilization) + : !has(self.backendUtilization)' - message: Currently SlowStart is only supported for RoundRobin, - LeastRequest, and ClientSideWeightedRoundRobin load - balancers. + LeastRequest, and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. - rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] + rule: 'self.type in [''ConsistentHash'', ''BackendUtilization''] ? !has(self.zoneAware) : true ' proxyProtocol: description: ProxyProtocol enables the Proxy Protocol when diff --git a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyproxies.yaml b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyproxies.yaml index 91a9833486..7e0361df42 100644 --- a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyproxies.yaml +++ b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyproxies.yaml @@ -11802,10 +11802,10 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: - clientSideWeightedRoundRobin: + backendUtilization: description: |- - ClientSideWeightedRoundRobin defines the configuration when the load balancer type is - set to ClientSideWeightedRoundRobin. + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. properties: blackoutPeriod: description: |- @@ -12020,7 +12020,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. + Supported for RoundRobin, LeastRequest, and BackendUtilization load balancers. properties: window: description: |- @@ -12041,13 +12041,13 @@ spec: "LeastRequest", "Random", "RoundRobin", - "ClientSideWeightedRoundRobin". + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin - - ClientSideWeightedRoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the @@ -12101,24 +12101,22 @@ spec: consistentHash field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' - - message: If LoadBalancer type is ClientSideWeightedRoundRobin, - clientSideWeightedRoundRobin field - needs to be set. - rule: 'self.type == ''ClientSideWeightedRoundRobin'' - ? has(self.clientSideWeightedRoundRobin) - : !has(self.clientSideWeightedRoundRobin)' + - message: If LoadBalancer type is BackendUtilization, + backendUtilization field needs to + be set. + rule: 'self.type == ''BackendUtilization'' + ? has(self.backendUtilization) : !has(self.backendUtilization)' - message: Currently SlowStart is only supported for RoundRobin, LeastRequest, - and ClientSideWeightedRoundRobin load - balancers. + and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. rule: 'self.type in [''ConsistentHash'', - ''ClientSideWeightedRoundRobin''] - ? !has(self.zoneAware) : true ' + ''BackendUtilization''] ? !has(self.zoneAware) + : true ' proxyProtocol: description: ProxyProtocol enables the Proxy Protocol when communicating with @@ -13115,10 +13113,10 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: - clientSideWeightedRoundRobin: + backendUtilization: description: |- - ClientSideWeightedRoundRobin defines the configuration when the load balancer type is - set to ClientSideWeightedRoundRobin. + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. properties: blackoutPeriod: description: |- @@ -13333,7 +13331,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. + Supported for RoundRobin, LeastRequest, and BackendUtilization load balancers. properties: window: description: |- @@ -13354,13 +13352,13 @@ spec: "LeastRequest", "Random", "RoundRobin", - "ClientSideWeightedRoundRobin". + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin - - ClientSideWeightedRoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the @@ -13414,24 +13412,22 @@ spec: consistentHash field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' - - message: If LoadBalancer type is ClientSideWeightedRoundRobin, - clientSideWeightedRoundRobin field - needs to be set. - rule: 'self.type == ''ClientSideWeightedRoundRobin'' - ? has(self.clientSideWeightedRoundRobin) - : !has(self.clientSideWeightedRoundRobin)' + - message: If LoadBalancer type is BackendUtilization, + backendUtilization field needs to + be set. + rule: 'self.type == ''BackendUtilization'' + ? has(self.backendUtilization) : !has(self.backendUtilization)' - message: Currently SlowStart is only supported for RoundRobin, LeastRequest, - and ClientSideWeightedRoundRobin load - balancers. + and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. rule: 'self.type in [''ConsistentHash'', - ''ClientSideWeightedRoundRobin''] - ? !has(self.zoneAware) : true ' + ''BackendUtilization''] ? !has(self.zoneAware) + : true ' proxyProtocol: description: ProxyProtocol enables the Proxy Protocol when communicating with @@ -14572,10 +14568,10 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: - clientSideWeightedRoundRobin: + backendUtilization: description: |- - ClientSideWeightedRoundRobin defines the configuration when the load balancer type is - set to ClientSideWeightedRoundRobin. + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. properties: blackoutPeriod: description: |- @@ -14782,7 +14778,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. + Supported for RoundRobin, LeastRequest, and BackendUtilization load balancers. properties: window: description: |- @@ -14803,13 +14799,13 @@ spec: "LeastRequest", "Random", "RoundRobin", - "ClientSideWeightedRoundRobin". + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin - - ClientSideWeightedRoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the configuration @@ -14862,21 +14858,19 @@ spec: consistentHash field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' - - message: If LoadBalancer type is ClientSideWeightedRoundRobin, - clientSideWeightedRoundRobin field needs - to be set. - rule: 'self.type == ''ClientSideWeightedRoundRobin'' - ? has(self.clientSideWeightedRoundRobin) - : !has(self.clientSideWeightedRoundRobin)' + - message: If LoadBalancer type is BackendUtilization, + backendUtilization field needs to be set. + rule: 'self.type == ''BackendUtilization'' + ? has(self.backendUtilization) : !has(self.backendUtilization)' - message: Currently SlowStart is only supported - for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin + for RoundRobin, LeastRequest, and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. - rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] + rule: 'self.type in [''ConsistentHash'', ''BackendUtilization''] ? !has(self.zoneAware) : true ' proxyProtocol: description: ProxyProtocol enables the Proxy @@ -15929,10 +15923,10 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: - clientSideWeightedRoundRobin: + backendUtilization: description: |- - ClientSideWeightedRoundRobin defines the configuration when the load balancer type is - set to ClientSideWeightedRoundRobin. + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. properties: blackoutPeriod: description: |- @@ -16133,7 +16127,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. + Supported for RoundRobin, LeastRequest, and BackendUtilization load balancers. properties: window: description: |- @@ -16154,13 +16148,13 @@ spec: "LeastRequest", "Random", "RoundRobin", - "ClientSideWeightedRoundRobin". + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin - - ClientSideWeightedRoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the configuration @@ -16211,19 +16205,18 @@ spec: consistentHash field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' - - message: If LoadBalancer type is ClientSideWeightedRoundRobin, - clientSideWeightedRoundRobin field needs to be - set. - rule: 'self.type == ''ClientSideWeightedRoundRobin'' - ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' + - message: If LoadBalancer type is BackendUtilization, + backendUtilization field needs to be set. + rule: 'self.type == ''BackendUtilization'' ? has(self.backendUtilization) + : !has(self.backendUtilization)' - message: Currently SlowStart is only supported for - RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin + RoundRobin, LeastRequest, and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. - rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] + rule: 'self.type in [''ConsistentHash'', ''BackendUtilization''] ? !has(self.zoneAware) : true ' proxyProtocol: description: ProxyProtocol enables the Proxy Protocol diff --git a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_securitypolicies.yaml b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_securitypolicies.yaml index 1e80e8bfbe..96264f84b1 100644 --- a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_securitypolicies.yaml +++ b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_securitypolicies.yaml @@ -1333,10 +1333,10 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: - clientSideWeightedRoundRobin: + backendUtilization: description: |- - ClientSideWeightedRoundRobin defines the configuration when the load balancer type is - set to ClientSideWeightedRoundRobin. + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. properties: blackoutPeriod: description: |- @@ -1535,7 +1535,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. + Supported for RoundRobin, LeastRequest, and BackendUtilization load balancers. properties: window: description: |- @@ -1556,13 +1556,13 @@ spec: "LeastRequest", "Random", "RoundRobin", - "ClientSideWeightedRoundRobin". + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin - - ClientSideWeightedRoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the configuration related @@ -1612,18 +1612,17 @@ spec: field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' - - message: If LoadBalancer type is ClientSideWeightedRoundRobin, - clientSideWeightedRoundRobin field needs to be set. - rule: 'self.type == ''ClientSideWeightedRoundRobin'' - ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' + - message: If LoadBalancer type is BackendUtilization, + backendUtilization field needs to be set. + rule: 'self.type == ''BackendUtilization'' ? has(self.backendUtilization) + : !has(self.backendUtilization)' - message: Currently SlowStart is only supported for RoundRobin, - LeastRequest, and ClientSideWeightedRoundRobin load - balancers. + LeastRequest, and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. - rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] + rule: 'self.type in [''ConsistentHash'', ''BackendUtilization''] ? !has(self.zoneAware) : true ' proxyProtocol: description: ProxyProtocol enables the Proxy Protocol @@ -2528,10 +2527,10 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: - clientSideWeightedRoundRobin: + backendUtilization: description: |- - ClientSideWeightedRoundRobin defines the configuration when the load balancer type is - set to ClientSideWeightedRoundRobin. + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. properties: blackoutPeriod: description: |- @@ -2730,7 +2729,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. + Supported for RoundRobin, LeastRequest, and BackendUtilization load balancers. properties: window: description: |- @@ -2751,13 +2750,13 @@ spec: "LeastRequest", "Random", "RoundRobin", - "ClientSideWeightedRoundRobin". + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin - - ClientSideWeightedRoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the configuration related @@ -2807,18 +2806,17 @@ spec: field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' - - message: If LoadBalancer type is ClientSideWeightedRoundRobin, - clientSideWeightedRoundRobin field needs to be set. - rule: 'self.type == ''ClientSideWeightedRoundRobin'' - ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' + - message: If LoadBalancer type is BackendUtilization, + backendUtilization field needs to be set. + rule: 'self.type == ''BackendUtilization'' ? has(self.backendUtilization) + : !has(self.backendUtilization)' - message: Currently SlowStart is only supported for RoundRobin, - LeastRequest, and ClientSideWeightedRoundRobin load - balancers. + LeastRequest, and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. - rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] + rule: 'self.type in [''ConsistentHash'', ''BackendUtilization''] ? !has(self.zoneAware) : true ' proxyProtocol: description: ProxyProtocol enables the Proxy Protocol @@ -3934,10 +3932,10 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: - clientSideWeightedRoundRobin: + backendUtilization: description: |- - ClientSideWeightedRoundRobin defines the configuration when the load balancer type is - set to ClientSideWeightedRoundRobin. + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. properties: blackoutPeriod: description: |- @@ -4140,7 +4138,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. + Supported for RoundRobin, LeastRequest, and BackendUtilization load balancers. properties: window: description: |- @@ -4161,13 +4159,13 @@ spec: "LeastRequest", "Random", "RoundRobin", - "ClientSideWeightedRoundRobin". + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin - - ClientSideWeightedRoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the configuration @@ -4218,20 +4216,19 @@ spec: consistentHash field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' - - message: If LoadBalancer type is ClientSideWeightedRoundRobin, - clientSideWeightedRoundRobin field needs to - be set. - rule: 'self.type == ''ClientSideWeightedRoundRobin'' - ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' + - message: If LoadBalancer type is BackendUtilization, + backendUtilization field needs to be set. + rule: 'self.type == ''BackendUtilization'' ? has(self.backendUtilization) + : !has(self.backendUtilization)' - message: Currently SlowStart is only supported - for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin + for RoundRobin, LeastRequest, and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. - rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] + rule: 'self.type in [''ConsistentHash'', ''BackendUtilization''] ? !has(self.zoneAware) : true ' proxyProtocol: description: ProxyProtocol enables the Proxy Protocol @@ -5400,10 +5397,10 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: - clientSideWeightedRoundRobin: + backendUtilization: description: |- - ClientSideWeightedRoundRobin defines the configuration when the load balancer type is - set to ClientSideWeightedRoundRobin. + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. properties: blackoutPeriod: description: |- @@ -5602,7 +5599,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. + Supported for RoundRobin, LeastRequest, and BackendUtilization load balancers. properties: window: description: |- @@ -5623,13 +5620,13 @@ spec: "LeastRequest", "Random", "RoundRobin", - "ClientSideWeightedRoundRobin". + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin - - ClientSideWeightedRoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the configuration related @@ -5679,18 +5676,17 @@ spec: field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' - - message: If LoadBalancer type is ClientSideWeightedRoundRobin, - clientSideWeightedRoundRobin field needs to be set. - rule: 'self.type == ''ClientSideWeightedRoundRobin'' - ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' + - message: If LoadBalancer type is BackendUtilization, + backendUtilization field needs to be set. + rule: 'self.type == ''BackendUtilization'' ? has(self.backendUtilization) + : !has(self.backendUtilization)' - message: Currently SlowStart is only supported for RoundRobin, - LeastRequest, and ClientSideWeightedRoundRobin load - balancers. + LeastRequest, and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. - rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] + rule: 'self.type in [''ConsistentHash'', ''BackendUtilization''] ? !has(self.zoneAware) : true ' proxyProtocol: description: ProxyProtocol enables the Proxy Protocol diff --git a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml index 46516870b5..fb876cf621 100644 --- a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml +++ b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml @@ -705,10 +705,10 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: - clientSideWeightedRoundRobin: + backendUtilization: description: |- - ClientSideWeightedRoundRobin defines the configuration when the load balancer type is - set to ClientSideWeightedRoundRobin. + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. properties: blackoutPeriod: description: |- @@ -898,7 +898,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. + Supported for RoundRobin, LeastRequest, and BackendUtilization load balancers. properties: window: description: |- @@ -919,13 +919,13 @@ spec: "LeastRequest", "Random", "RoundRobin", - "ClientSideWeightedRoundRobin". + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin - - ClientSideWeightedRoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the configuration related to the @@ -971,17 +971,17 @@ spec: field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' - - message: If LoadBalancer type is ClientSideWeightedRoundRobin, clientSideWeightedRoundRobin + - message: If LoadBalancer type is BackendUtilization, backendUtilization field needs to be set. - rule: 'self.type == ''ClientSideWeightedRoundRobin'' ? has(self.clientSideWeightedRoundRobin) - : !has(self.clientSideWeightedRoundRobin)' + rule: 'self.type == ''BackendUtilization'' ? has(self.backendUtilization) + : !has(self.backendUtilization)' - message: Currently SlowStart is only supported for RoundRobin, LeastRequest, - and ClientSideWeightedRoundRobin load balancers. + and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. - rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] + rule: 'self.type in [''ConsistentHash'', ''BackendUtilization''] ? !has(self.zoneAware) : true ' mergeType: description: |- diff --git a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml index e699decba6..eb1df174ff 100644 --- a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml +++ b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml @@ -735,10 +735,10 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: - clientSideWeightedRoundRobin: + backendUtilization: description: |- - ClientSideWeightedRoundRobin defines the configuration when the load balancer type is - set to ClientSideWeightedRoundRobin. + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. properties: blackoutPeriod: description: |- @@ -935,7 +935,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. + Supported for RoundRobin, LeastRequest, and BackendUtilization load balancers. properties: window: description: |- @@ -956,13 +956,13 @@ spec: "LeastRequest", "Random", "RoundRobin", - "ClientSideWeightedRoundRobin". + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin - - ClientSideWeightedRoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the configuration related @@ -1010,18 +1010,17 @@ spec: field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' - - message: If LoadBalancer type is ClientSideWeightedRoundRobin, - clientSideWeightedRoundRobin field needs to be set. - rule: 'self.type == ''ClientSideWeightedRoundRobin'' ? - has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' + - message: If LoadBalancer type is BackendUtilization, backendUtilization + field needs to be set. + rule: 'self.type == ''BackendUtilization'' ? has(self.backendUtilization) + : !has(self.backendUtilization)' - message: Currently SlowStart is only supported for RoundRobin, - LeastRequest, and ClientSideWeightedRoundRobin load - balancers. + LeastRequest, and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. - rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] + rule: 'self.type in [''ConsistentHash'', ''BackendUtilization''] ? !has(self.zoneAware) : true ' proxyProtocol: description: ProxyProtocol enables the Proxy Protocol when diff --git a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyproxies.yaml b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyproxies.yaml index c721730f3a..97c97b31ad 100644 --- a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyproxies.yaml +++ b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyproxies.yaml @@ -11801,10 +11801,10 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: - clientSideWeightedRoundRobin: + backendUtilization: description: |- - ClientSideWeightedRoundRobin defines the configuration when the load balancer type is - set to ClientSideWeightedRoundRobin. + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. properties: blackoutPeriod: description: |- @@ -12019,7 +12019,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. + Supported for RoundRobin, LeastRequest, and BackendUtilization load balancers. properties: window: description: |- @@ -12040,13 +12040,13 @@ spec: "LeastRequest", "Random", "RoundRobin", - "ClientSideWeightedRoundRobin". + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin - - ClientSideWeightedRoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the @@ -12100,24 +12100,22 @@ spec: consistentHash field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' - - message: If LoadBalancer type is ClientSideWeightedRoundRobin, - clientSideWeightedRoundRobin field - needs to be set. - rule: 'self.type == ''ClientSideWeightedRoundRobin'' - ? has(self.clientSideWeightedRoundRobin) - : !has(self.clientSideWeightedRoundRobin)' + - message: If LoadBalancer type is BackendUtilization, + backendUtilization field needs to + be set. + rule: 'self.type == ''BackendUtilization'' + ? has(self.backendUtilization) : !has(self.backendUtilization)' - message: Currently SlowStart is only supported for RoundRobin, LeastRequest, - and ClientSideWeightedRoundRobin load - balancers. + and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. rule: 'self.type in [''ConsistentHash'', - ''ClientSideWeightedRoundRobin''] - ? !has(self.zoneAware) : true ' + ''BackendUtilization''] ? !has(self.zoneAware) + : true ' proxyProtocol: description: ProxyProtocol enables the Proxy Protocol when communicating with @@ -13114,10 +13112,10 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: - clientSideWeightedRoundRobin: + backendUtilization: description: |- - ClientSideWeightedRoundRobin defines the configuration when the load balancer type is - set to ClientSideWeightedRoundRobin. + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. properties: blackoutPeriod: description: |- @@ -13332,7 +13330,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. + Supported for RoundRobin, LeastRequest, and BackendUtilization load balancers. properties: window: description: |- @@ -13353,13 +13351,13 @@ spec: "LeastRequest", "Random", "RoundRobin", - "ClientSideWeightedRoundRobin". + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin - - ClientSideWeightedRoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the @@ -13413,24 +13411,22 @@ spec: consistentHash field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' - - message: If LoadBalancer type is ClientSideWeightedRoundRobin, - clientSideWeightedRoundRobin field - needs to be set. - rule: 'self.type == ''ClientSideWeightedRoundRobin'' - ? has(self.clientSideWeightedRoundRobin) - : !has(self.clientSideWeightedRoundRobin)' + - message: If LoadBalancer type is BackendUtilization, + backendUtilization field needs to + be set. + rule: 'self.type == ''BackendUtilization'' + ? has(self.backendUtilization) : !has(self.backendUtilization)' - message: Currently SlowStart is only supported for RoundRobin, LeastRequest, - and ClientSideWeightedRoundRobin load - balancers. + and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. rule: 'self.type in [''ConsistentHash'', - ''ClientSideWeightedRoundRobin''] - ? !has(self.zoneAware) : true ' + ''BackendUtilization''] ? !has(self.zoneAware) + : true ' proxyProtocol: description: ProxyProtocol enables the Proxy Protocol when communicating with @@ -14571,10 +14567,10 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: - clientSideWeightedRoundRobin: + backendUtilization: description: |- - ClientSideWeightedRoundRobin defines the configuration when the load balancer type is - set to ClientSideWeightedRoundRobin. + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. properties: blackoutPeriod: description: |- @@ -14781,7 +14777,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. + Supported for RoundRobin, LeastRequest, and BackendUtilization load balancers. properties: window: description: |- @@ -14802,13 +14798,13 @@ spec: "LeastRequest", "Random", "RoundRobin", - "ClientSideWeightedRoundRobin". + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin - - ClientSideWeightedRoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the configuration @@ -14861,21 +14857,19 @@ spec: consistentHash field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' - - message: If LoadBalancer type is ClientSideWeightedRoundRobin, - clientSideWeightedRoundRobin field needs - to be set. - rule: 'self.type == ''ClientSideWeightedRoundRobin'' - ? has(self.clientSideWeightedRoundRobin) - : !has(self.clientSideWeightedRoundRobin)' + - message: If LoadBalancer type is BackendUtilization, + backendUtilization field needs to be set. + rule: 'self.type == ''BackendUtilization'' + ? has(self.backendUtilization) : !has(self.backendUtilization)' - message: Currently SlowStart is only supported - for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin + for RoundRobin, LeastRequest, and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. - rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] + rule: 'self.type in [''ConsistentHash'', ''BackendUtilization''] ? !has(self.zoneAware) : true ' proxyProtocol: description: ProxyProtocol enables the Proxy @@ -15928,10 +15922,10 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: - clientSideWeightedRoundRobin: + backendUtilization: description: |- - ClientSideWeightedRoundRobin defines the configuration when the load balancer type is - set to ClientSideWeightedRoundRobin. + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. properties: blackoutPeriod: description: |- @@ -16132,7 +16126,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. + Supported for RoundRobin, LeastRequest, and BackendUtilization load balancers. properties: window: description: |- @@ -16153,13 +16147,13 @@ spec: "LeastRequest", "Random", "RoundRobin", - "ClientSideWeightedRoundRobin". + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin - - ClientSideWeightedRoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the configuration @@ -16210,19 +16204,18 @@ spec: consistentHash field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' - - message: If LoadBalancer type is ClientSideWeightedRoundRobin, - clientSideWeightedRoundRobin field needs to be - set. - rule: 'self.type == ''ClientSideWeightedRoundRobin'' - ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' + - message: If LoadBalancer type is BackendUtilization, + backendUtilization field needs to be set. + rule: 'self.type == ''BackendUtilization'' ? has(self.backendUtilization) + : !has(self.backendUtilization)' - message: Currently SlowStart is only supported for - RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin + RoundRobin, LeastRequest, and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. - rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] + rule: 'self.type in [''ConsistentHash'', ''BackendUtilization''] ? !has(self.zoneAware) : true ' proxyProtocol: description: ProxyProtocol enables the Proxy Protocol diff --git a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_securitypolicies.yaml b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_securitypolicies.yaml index f6c5a6e163..dae223f7db 100644 --- a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_securitypolicies.yaml +++ b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_securitypolicies.yaml @@ -1332,10 +1332,10 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: - clientSideWeightedRoundRobin: + backendUtilization: description: |- - ClientSideWeightedRoundRobin defines the configuration when the load balancer type is - set to ClientSideWeightedRoundRobin. + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. properties: blackoutPeriod: description: |- @@ -1534,7 +1534,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. + Supported for RoundRobin, LeastRequest, and BackendUtilization load balancers. properties: window: description: |- @@ -1555,13 +1555,13 @@ spec: "LeastRequest", "Random", "RoundRobin", - "ClientSideWeightedRoundRobin". + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin - - ClientSideWeightedRoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the configuration related @@ -1611,18 +1611,17 @@ spec: field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' - - message: If LoadBalancer type is ClientSideWeightedRoundRobin, - clientSideWeightedRoundRobin field needs to be set. - rule: 'self.type == ''ClientSideWeightedRoundRobin'' - ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' + - message: If LoadBalancer type is BackendUtilization, + backendUtilization field needs to be set. + rule: 'self.type == ''BackendUtilization'' ? has(self.backendUtilization) + : !has(self.backendUtilization)' - message: Currently SlowStart is only supported for RoundRobin, - LeastRequest, and ClientSideWeightedRoundRobin load - balancers. + LeastRequest, and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. - rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] + rule: 'self.type in [''ConsistentHash'', ''BackendUtilization''] ? !has(self.zoneAware) : true ' proxyProtocol: description: ProxyProtocol enables the Proxy Protocol @@ -2527,10 +2526,10 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: - clientSideWeightedRoundRobin: + backendUtilization: description: |- - ClientSideWeightedRoundRobin defines the configuration when the load balancer type is - set to ClientSideWeightedRoundRobin. + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. properties: blackoutPeriod: description: |- @@ -2729,7 +2728,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. + Supported for RoundRobin, LeastRequest, and BackendUtilization load balancers. properties: window: description: |- @@ -2750,13 +2749,13 @@ spec: "LeastRequest", "Random", "RoundRobin", - "ClientSideWeightedRoundRobin". + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin - - ClientSideWeightedRoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the configuration related @@ -2806,18 +2805,17 @@ spec: field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' - - message: If LoadBalancer type is ClientSideWeightedRoundRobin, - clientSideWeightedRoundRobin field needs to be set. - rule: 'self.type == ''ClientSideWeightedRoundRobin'' - ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' + - message: If LoadBalancer type is BackendUtilization, + backendUtilization field needs to be set. + rule: 'self.type == ''BackendUtilization'' ? has(self.backendUtilization) + : !has(self.backendUtilization)' - message: Currently SlowStart is only supported for RoundRobin, - LeastRequest, and ClientSideWeightedRoundRobin load - balancers. + LeastRequest, and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. - rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] + rule: 'self.type in [''ConsistentHash'', ''BackendUtilization''] ? !has(self.zoneAware) : true ' proxyProtocol: description: ProxyProtocol enables the Proxy Protocol @@ -3933,10 +3931,10 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: - clientSideWeightedRoundRobin: + backendUtilization: description: |- - ClientSideWeightedRoundRobin defines the configuration when the load balancer type is - set to ClientSideWeightedRoundRobin. + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. properties: blackoutPeriod: description: |- @@ -4139,7 +4137,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. + Supported for RoundRobin, LeastRequest, and BackendUtilization load balancers. properties: window: description: |- @@ -4160,13 +4158,13 @@ spec: "LeastRequest", "Random", "RoundRobin", - "ClientSideWeightedRoundRobin". + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin - - ClientSideWeightedRoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the configuration @@ -4217,20 +4215,19 @@ spec: consistentHash field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' - - message: If LoadBalancer type is ClientSideWeightedRoundRobin, - clientSideWeightedRoundRobin field needs to - be set. - rule: 'self.type == ''ClientSideWeightedRoundRobin'' - ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' + - message: If LoadBalancer type is BackendUtilization, + backendUtilization field needs to be set. + rule: 'self.type == ''BackendUtilization'' ? has(self.backendUtilization) + : !has(self.backendUtilization)' - message: Currently SlowStart is only supported - for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin + for RoundRobin, LeastRequest, and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. - rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] + rule: 'self.type in [''ConsistentHash'', ''BackendUtilization''] ? !has(self.zoneAware) : true ' proxyProtocol: description: ProxyProtocol enables the Proxy Protocol @@ -5399,10 +5396,10 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: - clientSideWeightedRoundRobin: + backendUtilization: description: |- - ClientSideWeightedRoundRobin defines the configuration when the load balancer type is - set to ClientSideWeightedRoundRobin. + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. properties: blackoutPeriod: description: |- @@ -5601,7 +5598,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. + Supported for RoundRobin, LeastRequest, and BackendUtilization load balancers. properties: window: description: |- @@ -5622,13 +5619,13 @@ spec: "LeastRequest", "Random", "RoundRobin", - "ClientSideWeightedRoundRobin". + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin - - ClientSideWeightedRoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the configuration related @@ -5678,18 +5675,17 @@ spec: field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' - - message: If LoadBalancer type is ClientSideWeightedRoundRobin, - clientSideWeightedRoundRobin field needs to be set. - rule: 'self.type == ''ClientSideWeightedRoundRobin'' - ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' + - message: If LoadBalancer type is BackendUtilization, + backendUtilization field needs to be set. + rule: 'self.type == ''BackendUtilization'' ? has(self.backendUtilization) + : !has(self.backendUtilization)' - message: Currently SlowStart is only supported for RoundRobin, - LeastRequest, and ClientSideWeightedRoundRobin load - balancers. + LeastRequest, and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. - rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] + rule: 'self.type in [''ConsistentHash'', ''BackendUtilization''] ? !has(self.zoneAware) : true ' proxyProtocol: description: ProxyProtocol enables the Proxy Protocol diff --git a/internal/gatewayapi/clustersettings.go b/internal/gatewayapi/clustersettings.go index b6b44d356e..08994e70df 100644 --- a/internal/gatewayapi/clustersettings.go +++ b/internal/gatewayapi/clustersettings.go @@ -341,32 +341,32 @@ func buildLoadBalancer(policy *egv1a1.ClusterSettings) (*ir.LoadBalancer, error) Window: ir.MetaV1DurationPtr(d), } } - case egv1a1.ClientSideWeightedRoundRobinLoadBalancerType: + case egv1a1.BackendUtilizationLoadBalancerType: lb = &ir.LoadBalancer{ - ClientSideWeightedRoundRobin: &ir.ClientSideWeightedRoundRobin{}, + BackendUtilization: &ir.BackendUtilization{}, } - cswrr := policy.LoadBalancer.ClientSideWeightedRoundRobin - if cswrr != nil { - if cswrr.BlackoutPeriod != nil { - if d, err := time.ParseDuration(string(*cswrr.BlackoutPeriod)); err == nil { - lb.ClientSideWeightedRoundRobin.BlackoutPeriod = ir.MetaV1DurationPtr(d) + bu := policy.LoadBalancer.BackendUtilization + if bu != nil { + if bu.BlackoutPeriod != nil { + if d, err := time.ParseDuration(string(*bu.BlackoutPeriod)); err == nil { + lb.BackendUtilization.BlackoutPeriod = ir.MetaV1DurationPtr(d) } } - if cswrr.WeightExpirationPeriod != nil { - if d, err := time.ParseDuration(string(*cswrr.WeightExpirationPeriod)); err == nil { - lb.ClientSideWeightedRoundRobin.WeightExpirationPeriod = ir.MetaV1DurationPtr(d) + if bu.WeightExpirationPeriod != nil { + if d, err := time.ParseDuration(string(*bu.WeightExpirationPeriod)); err == nil { + lb.BackendUtilization.WeightExpirationPeriod = ir.MetaV1DurationPtr(d) } } - if cswrr.WeightUpdatePeriod != nil { - if d, err := time.ParseDuration(string(*cswrr.WeightUpdatePeriod)); err == nil { - lb.ClientSideWeightedRoundRobin.WeightUpdatePeriod = ir.MetaV1DurationPtr(d) + if bu.WeightUpdatePeriod != nil { + if d, err := time.ParseDuration(string(*bu.WeightUpdatePeriod)); err == nil { + lb.BackendUtilization.WeightUpdatePeriod = ir.MetaV1DurationPtr(d) } } - if cswrr.ErrorUtilizationPenalty != nil { - lb.ClientSideWeightedRoundRobin.ErrorUtilizationPenalty = ptr.To(*cswrr.ErrorUtilizationPenalty) + if bu.ErrorUtilizationPenalty != nil { + lb.BackendUtilization.ErrorUtilizationPenalty = ptr.To(*bu.ErrorUtilizationPenalty) } - if len(cswrr.MetricNamesForComputingUtilization) > 0 { - lb.ClientSideWeightedRoundRobin.MetricNamesForComputingUtilization = append([]string(nil), cswrr.MetricNamesForComputingUtilization...) + if len(bu.MetricNamesForComputingUtilization) > 0 { + lb.BackendUtilization.MetricNamesForComputingUtilization = append([]string(nil), bu.MetricNamesForComputingUtilization...) } } if policy.LoadBalancer.SlowStart != nil && policy.LoadBalancer.SlowStart.Window != nil { @@ -374,7 +374,7 @@ func buildLoadBalancer(policy *egv1a1.ClusterSettings) (*ir.LoadBalancer, error) if err != nil { return nil, err } - lb.ClientSideWeightedRoundRobin.SlowStart = &ir.SlowStart{ + lb.BackendUtilization.SlowStart = &ir.SlowStart{ Window: ir.MetaV1DurationPtr(d), } } diff --git a/internal/gatewayapi/clustersettings_cswrr_test.go b/internal/gatewayapi/clustersettings_backendutilization_test.go similarity index 80% rename from internal/gatewayapi/clustersettings_cswrr_test.go rename to internal/gatewayapi/clustersettings_backendutilization_test.go index 478c53c8a9..b5e069e6e1 100644 --- a/internal/gatewayapi/clustersettings_cswrr_test.go +++ b/internal/gatewayapi/clustersettings_backendutilization_test.go @@ -17,8 +17,8 @@ import ( "github.com/envoyproxy/gateway/internal/ir" ) -func TestBuildLoadBalancer_ClientSideWeightedRoundRobin(t *testing.T) { - cswrr := &egv1a1.ClientSideWeightedRoundRobin{ +func TestBuildLoadBalancer_BackendUtilization(t *testing.T) { + backendUtilization := &egv1a1.BackendUtilization{ BlackoutPeriod: ptr.To(gwapiv1.Duration("10s")), WeightExpirationPeriod: ptr.To(gwapiv1.Duration("3m")), WeightUpdatePeriod: ptr.To(gwapiv1.Duration("1s")), @@ -28,17 +28,17 @@ func TestBuildLoadBalancer_ClientSideWeightedRoundRobin(t *testing.T) { policy := &egv1a1.ClusterSettings{ LoadBalancer: &egv1a1.LoadBalancer{ - Type: egv1a1.ClientSideWeightedRoundRobinLoadBalancerType, - ClientSideWeightedRoundRobin: cswrr, + Type: egv1a1.BackendUtilizationLoadBalancerType, + BackendUtilization: backendUtilization, }, } lb, err := buildLoadBalancer(policy) require.NoError(t, err) require.NotNil(t, lb) - require.NotNil(t, lb.ClientSideWeightedRoundRobin) + require.NotNil(t, lb.BackendUtilization) - got := lb.ClientSideWeightedRoundRobin + got := lb.BackendUtilization require.Equal(t, ir.MetaV1DurationPtr(10*time.Second), got.BlackoutPeriod) require.Equal(t, ir.MetaV1DurationPtr(3*time.Minute), got.WeightExpirationPeriod) require.Equal(t, ir.MetaV1DurationPtr(1*time.Second), got.WeightUpdatePeriod) diff --git a/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer.in.yaml b/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer.in.yaml index 5e934b804e..c9d24baf25 100644 --- a/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer.in.yaml +++ b/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer.in.yaml @@ -243,10 +243,10 @@ backendTrafficPolicies: kind: HTTPRoute name: httproute-5 loadBalancer: - type: ClientSideWeightedRoundRobin + type: BackendUtilization slowStart: window: 300s - clientSideWeightedRoundRobin: + backendUtilization: blackoutPeriod: 10s weightExpirationPeriod: 60s weightUpdatePeriod: 10s diff --git a/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer.out.yaml b/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer.out.yaml index 61f961e5f9..8d4246c067 100644 --- a/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer.out.yaml +++ b/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer.out.yaml @@ -147,7 +147,7 @@ backendTrafficPolicies: namespace: default spec: loadBalancer: - clientSideWeightedRoundRobin: + backendUtilization: blackoutPeriod: 10s errorUtilizationPenalty: 100 metricNamesForComputingUtilization: @@ -156,7 +156,7 @@ backendTrafficPolicies: weightUpdatePeriod: 10s slowStart: window: 300s - type: ClientSideWeightedRoundRobin + type: BackendUtilization targetRef: group: gateway.networking.k8s.io kind: HTTPRoute @@ -851,7 +851,7 @@ xdsIR: prefix: /test5 traffic: loadBalancer: - clientSideWeightedRoundRobin: + backendUtilization: blackoutPeriod: 10s errorUtilizationPenalty: 100 metricNamesForComputingUtilization: diff --git a/internal/ir/xds.go b/internal/ir/xds.go index 15bf8b253f..ec4ce2a867 100644 --- a/internal/ir/xds.go +++ b/internal/ir/xds.go @@ -2641,8 +2641,8 @@ type LoadBalancer struct { Random *Random `json:"random,omitempty" yaml:"random,omitempty"` // ConsistentHash load balancer policy ConsistentHash *ConsistentHash `json:"consistentHash,omitempty" yaml:"consistentHash,omitempty"` - // ClientSideWeightedRoundRobin load balancer policy - ClientSideWeightedRoundRobin *ClientSideWeightedRoundRobin `json:"clientSideWeightedRoundRobin,omitempty" yaml:"clientSideWeightedRoundRobin,omitempty"` + // BackendUtilization load balancer policy + BackendUtilization *BackendUtilization `json:"backendUtilization,omitempty" yaml:"backendUtilization,omitempty"` // PreferLocal defines the configuration related to the distribution of requests between locality zones. PreferLocal *PreferLocalZone `json:"preferLocal,omitempty" yaml:"preferLocal,omitempty"` // EndpointOverride defines the configuration for endpoint override. @@ -2668,7 +2668,7 @@ func (l *LoadBalancer) Validate() error { if l.ConsistentHash != nil { matchCount++ } - if l.ClientSideWeightedRoundRobin != nil { + if l.BackendUtilization != nil { matchCount++ } if matchCount != 1 { @@ -2698,9 +2698,9 @@ type LeastRequest struct { // +k8s:deepcopy-gen=true type Random struct{} -// ClientSideWeightedRoundRobin load balancer settings +// BackendUtilization load balancer settings // +k8s:deepcopy-gen=true -type ClientSideWeightedRoundRobin struct { +type BackendUtilization struct { BlackoutPeriod *metav1.Duration `json:"blackoutPeriod,omitempty" yaml:"blackoutPeriod,omitempty"` WeightExpirationPeriod *metav1.Duration `json:"weightExpirationPeriod,omitempty" yaml:"weightExpirationPeriod,omitempty"` WeightUpdatePeriod *metav1.Duration `json:"weightUpdatePeriod,omitempty" yaml:"weightUpdatePeriod,omitempty"` @@ -3414,6 +3414,6 @@ const ( RandomLoadBalancer LoadBalancerType = "Random" // ConsistentHashLoadBalancer is the consistent hash load balancer type. ConsistentHashLoadBalancer LoadBalancerType = "ConsistentHash" - // ClientSideWeightedRoundRobinLoadBalancer is the client-side weighted round robin load balancer type. - ClientSideWeightedRoundRobinLoadBalancer LoadBalancerType = "ClientSideWeightedRoundRobin" + // BackendUtilizationLoadBalancer is the backend utilization load balancer type. + BackendUtilizationLoadBalancer LoadBalancerType = "BackendUtilization" ) diff --git a/internal/ir/xds_test.go b/internal/ir/xds_test.go index 6a5ff12236..4f3eb0d971 100644 --- a/internal/ir/xds_test.go +++ b/internal/ir/xds_test.go @@ -1338,9 +1338,9 @@ func TestValidateLoadBalancer(t *testing.T) { want: ErrLoadBalancerInvalid, }, { - name: "client side wrr set", + name: "backend utilization set", input: LoadBalancer{ - ClientSideWeightedRoundRobin: &ClientSideWeightedRoundRobin{ + BackendUtilization: &BackendUtilization{ BlackoutPeriod: MetaV1DurationPtr(30 * time.Second), WeightExpirationPeriod: MetaV1DurationPtr(10 * time.Second), WeightUpdatePeriod: MetaV1DurationPtr(1 * time.Second), diff --git a/internal/ir/zz_generated.deepcopy.go b/internal/ir/zz_generated.deepcopy.go index 6938956d60..4ec5b5bad5 100644 --- a/internal/ir/zz_generated.deepcopy.go +++ b/internal/ir/zz_generated.deepcopy.go @@ -393,6 +393,51 @@ func (in *BackendConnection) DeepCopy() *BackendConnection { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BackendUtilization) DeepCopyInto(out *BackendUtilization) { + *out = *in + if in.BlackoutPeriod != nil { + in, out := &in.BlackoutPeriod, &out.BlackoutPeriod + *out = new(metav1.Duration) + **out = **in + } + if in.WeightExpirationPeriod != nil { + in, out := &in.WeightExpirationPeriod, &out.WeightExpirationPeriod + *out = new(metav1.Duration) + **out = **in + } + if in.WeightUpdatePeriod != nil { + in, out := &in.WeightUpdatePeriod, &out.WeightUpdatePeriod + *out = new(metav1.Duration) + **out = **in + } + if in.ErrorUtilizationPenalty != nil { + in, out := &in.ErrorUtilizationPenalty, &out.ErrorUtilizationPenalty + *out = new(uint32) + **out = **in + } + if in.MetricNamesForComputingUtilization != nil { + in, out := &in.MetricNamesForComputingUtilization, &out.MetricNamesForComputingUtilization + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.SlowStart != nil { + in, out := &in.SlowStart, &out.SlowStart + *out = new(SlowStart) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackendUtilization. +func (in *BackendUtilization) DeepCopy() *BackendUtilization { + if in == nil { + return nil + } + out := new(BackendUtilization) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *BasicAuth) DeepCopyInto(out *BasicAuth) { *out = *in @@ -579,51 +624,6 @@ func (in *ClientIPDetectionSettings) DeepCopy() *ClientIPDetectionSettings { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ClientSideWeightedRoundRobin) DeepCopyInto(out *ClientSideWeightedRoundRobin) { - *out = *in - if in.BlackoutPeriod != nil { - in, out := &in.BlackoutPeriod, &out.BlackoutPeriod - *out = new(metav1.Duration) - **out = **in - } - if in.WeightExpirationPeriod != nil { - in, out := &in.WeightExpirationPeriod, &out.WeightExpirationPeriod - *out = new(metav1.Duration) - **out = **in - } - if in.WeightUpdatePeriod != nil { - in, out := &in.WeightUpdatePeriod, &out.WeightUpdatePeriod - *out = new(metav1.Duration) - **out = **in - } - if in.ErrorUtilizationPenalty != nil { - in, out := &in.ErrorUtilizationPenalty, &out.ErrorUtilizationPenalty - *out = new(uint32) - **out = **in - } - if in.MetricNamesForComputingUtilization != nil { - in, out := &in.MetricNamesForComputingUtilization, &out.MetricNamesForComputingUtilization - *out = make([]string, len(*in)) - copy(*out, *in) - } - if in.SlowStart != nil { - in, out := &in.SlowStart, &out.SlowStart - *out = new(SlowStart) - (*in).DeepCopyInto(*out) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClientSideWeightedRoundRobin. -func (in *ClientSideWeightedRoundRobin) DeepCopy() *ClientSideWeightedRoundRobin { - if in == nil { - return nil - } - out := new(ClientSideWeightedRoundRobin) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ClientTimeout) DeepCopyInto(out *ClientTimeout) { *out = *in @@ -2556,9 +2556,9 @@ func (in *LoadBalancer) DeepCopyInto(out *LoadBalancer) { *out = new(ConsistentHash) (*in).DeepCopyInto(*out) } - if in.ClientSideWeightedRoundRobin != nil { - in, out := &in.ClientSideWeightedRoundRobin, &out.ClientSideWeightedRoundRobin - *out = new(ClientSideWeightedRoundRobin) + if in.BackendUtilization != nil { + in, out := &in.BackendUtilization, &out.BackendUtilization + *out = new(BackendUtilization) (*in).DeepCopyInto(*out) } if in.PreferLocal != nil { diff --git a/internal/xds/translator/cluster.go b/internal/xds/translator/cluster.go index a31629bc3e..ace2392086 100644 --- a/internal/xds/translator/cluster.go +++ b/internal/xds/translator/cluster.go @@ -439,9 +439,9 @@ func buildXdsCluster(args *xdsClusterArgs) (*buildClusterResult, error) { }, }}, } - case args.loadBalancer.ClientSideWeightedRoundRobin != nil: + case args.loadBalancer.BackendUtilization != nil: cswrr := &cswrrv3.ClientSideWeightedRoundRobin{} - if v := args.loadBalancer.ClientSideWeightedRoundRobin; v != nil { + if v := args.loadBalancer.BackendUtilization; v != nil { if v.BlackoutPeriod != nil && v.BlackoutPeriod.Duration > 0 { cswrr.BlackoutPeriod = durationpb.New(v.BlackoutPeriod.Duration) } @@ -451,7 +451,6 @@ func buildXdsCluster(args *xdsClusterArgs) (*buildClusterResult, error) { if v.WeightUpdatePeriod != nil && v.WeightUpdatePeriod.Duration > 0 { cswrr.WeightUpdatePeriod = durationpb.New(v.WeightUpdatePeriod.Duration) } - // Map SlowStart for CSWRR if configured in IR if v.SlowStart != nil && v.SlowStart.Window != nil && v.SlowStart.Window.Duration > 0 { cswrr.SlowStartConfig = &commonv3.SlowStartConfig{ SlowStartWindow: durationpb.New(v.SlowStart.Window.Duration), @@ -1402,8 +1401,8 @@ func buildEndpointOverrideLoadBalancingPolicy(loadBalancer *ir.LoadBalancer) (*c fallbackType = ir.RandomLoadBalancer case loadBalancer.ConsistentHash != nil: fallbackType = ir.ConsistentHashLoadBalancer - case loadBalancer.ClientSideWeightedRoundRobin != nil: - fallbackType = ir.ClientSideWeightedRoundRobinLoadBalancer + case loadBalancer.BackendUtilization != nil: + fallbackType = ir.BackendUtilizationLoadBalancer default: // Default to LeastRequest if no specific type is set fallbackType = ir.LeastRequestLoadBalancer @@ -1499,10 +1498,10 @@ func buildFallbackLoadBalancingPolicy(fallbackType ir.LoadBalancerType) (*cluste }, }, }, nil - case ir.ClientSideWeightedRoundRobinLoadBalancer: + case ir.BackendUtilizationLoadBalancer: fallbackPolicyAny, err := anypb.New(&cswrrv3.ClientSideWeightedRoundRobin{}) if err != nil { - return nil, fmt.Errorf("failed to marshal ClientSideWeightedRoundRobin policy: %w", err) + return nil, fmt.Errorf("failed to marshal BackendUtilization policy: %w", err) } return &clusterv3.LoadBalancingPolicy{ Policies: []*clusterv3.LoadBalancingPolicy_Policy{ diff --git a/internal/xds/translator/cluster_test.go b/internal/xds/translator/cluster_test.go index 5b05419484..2f72895bb6 100644 --- a/internal/xds/translator/cluster_test.go +++ b/internal/xds/translator/cluster_test.go @@ -160,14 +160,14 @@ func requireCmpNoDiff(t *testing.T, expected, actual interface{}) { require.Empty(t, cmp.Diff(expected, actual, protocmp.Transform())) } -func TestBuildCluster_WithClientSideWeightedRoundRobin(t *testing.T) { +func TestBuildClusterWithBackendUtilization(t *testing.T) { args := &xdsClusterArgs{ - name: "test-cluster-cswrr", + name: "test-cluster-bu", endpointType: EndpointTypeStatic, settings: []*ir.DestinationSetting{{ Endpoints: []*ir.DestinationEndpoint{{Host: "127.0.0.1", Port: 8080}}, }}, - loadBalancer: &ir.LoadBalancer{ClientSideWeightedRoundRobin: &ir.ClientSideWeightedRoundRobin{}}, + loadBalancer: &ir.LoadBalancer{BackendUtilization: &ir.BackendUtilization{}}, } result, err := buildXdsCluster(args) @@ -187,15 +187,15 @@ func TestBuildCluster_WithClientSideWeightedRoundRobin(t *testing.T) { require.Equal(t, "type.googleapis.com/envoy.extensions.load_balancing_policies.client_side_weighted_round_robin.v3.ClientSideWeightedRoundRobin", policy.TypedExtensionConfig.TypedConfig.TypeUrl) } -func TestBuildCluster_WithClientSideWeightedRoundRobin_SlowStart(t *testing.T) { +func TestBuildClusterWithBackendUtilizationSlowStart(t *testing.T) { window := 5 * time.Second args := &xdsClusterArgs{ - name: "test-cluster-cswrr-ss", + name: "test-cluster-bu-ss", endpointType: EndpointTypeStatic, settings: []*ir.DestinationSetting{{ Endpoints: []*ir.DestinationEndpoint{{Host: "127.0.0.1", Port: 8080}}, }}, - loadBalancer: &ir.LoadBalancer{ClientSideWeightedRoundRobin: &ir.ClientSideWeightedRoundRobin{ + loadBalancer: &ir.LoadBalancer{BackendUtilization: &ir.BackendUtilization{ SlowStart: &ir.SlowStart{Window: ir.MetaV1DurationPtr(window)}, }}, } diff --git a/internal/xds/translator/testdata/in/xds-ir/load-balancer.yaml b/internal/xds/translator/testdata/in/xds-ir/load-balancer.yaml index aa79333fb0..7cf50724ac 100644 --- a/internal/xds/translator/testdata/in/xds-ir/load-balancer.yaml +++ b/internal/xds/translator/testdata/in/xds-ir/load-balancer.yaml @@ -221,7 +221,7 @@ http: hostname: "*" traffic: loadBalancer: - clientSideWeightedRoundRobin: + backendUtilization: blackoutPeriod: 30s weightExpirationPeriod: 60s weightUpdatePeriod: 10s @@ -241,7 +241,7 @@ http: hostname: "*" traffic: loadBalancer: - clientSideWeightedRoundRobin: + backendUtilization: blackoutPeriod: 30s weightExpirationPeriod: 60s weightUpdatePeriod: 10s diff --git a/site/content/en/latest/api/extension_types.md b/site/content/en/latest/api/extension_types.md index 8f1167a18d..54c0fae40e 100644 --- a/site/content/en/latest/api/extension_types.md +++ b/site/content/en/latest/api/extension_types.md @@ -565,6 +565,25 @@ _Appears in:_ | `DynamicResolver` | BackendTypeDynamicResolver defines the type of the backend as DynamicResolver.
When a backend is of type DynamicResolver, the Envoy will resolve the upstream
ip address and port from the host header of the incoming request. If the ip address
is directly set in the host header, the Envoy will use the ip address and port as the
upstream address. If the hostname is set in the host header, the Envoy will resolve the
ip address and port from the hostname using the DNS resolver.
| +#### BackendUtilization + + + +BackendUtilization defines configuration for Envoy's Backend Utilization policy. +See Envoy proto: envoy.extensions.load_balancing_policies.client_side_weighted_round_robin.v3.ClientSideWeightedRoundRobin + +_Appears in:_ +- [LoadBalancer](#loadbalancer) + +| Field | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| `blackoutPeriod` | _[Duration](https://gateway-api.sigs.k8s.io/reference/1.4/spec/#duration)_ | false | | A given endpoint must report load metrics continuously for at least this long before the endpoint weight will be used.
Default is 10s. | +| `weightExpirationPeriod` | _[Duration](https://gateway-api.sigs.k8s.io/reference/1.4/spec/#duration)_ | false | | If a given endpoint has not reported load metrics in this long, stop using the reported weight. Defaults to 3m. | +| `weightUpdatePeriod` | _[Duration](https://gateway-api.sigs.k8s.io/reference/1.4/spec/#duration)_ | false | | How often endpoint weights are recalculated. Values less than 100ms are capped at 100ms. Default 1s. | +| `errorUtilizationPenalty` | _integer_ | false | | ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps).
This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc.
For example:
- 100 => 1.0x
- 120 => 1.2x
- 200 => 2.0x
Note: In the internal IR/XDS configuration this value is converted back to a
floating point multiplier (value / 100.0).
Must be non-negative. | +| `metricNamesForComputingUtilization` | _string array_ | false | | Metric names used to compute utilization if application_utilization is not set.
For map fields in ORCA proto, use the form ".", e.g., "named_metrics.foo". | + + #### BasicAuth @@ -721,25 +740,6 @@ _Appears in:_ | `customHeader` | _[CustomHeaderExtensionSettings](#customheaderextensionsettings)_ | false | | CustomHeader provides configuration for determining the client IP address for a request based on
a trusted custom HTTP header. This uses the custom_header original IP detection extension.
Refer to https://www.envoyproxy.io/docs/envoy/latest/api-v3/extensions/http/original_ip_detection/custom_header/v3/custom_header.proto
for more details. | -#### ClientSideWeightedRoundRobin - - - -ClientSideWeightedRoundRobin defines configuration for Envoy's Client-Side Weighted Round Robin policy. -See Envoy proto: envoy.extensions.load_balancing_policies.client_side_weighted_round_robin.v3.ClientSideWeightedRoundRobin - -_Appears in:_ -- [LoadBalancer](#loadbalancer) - -| Field | Type | Required | Default | Description | -| --- | --- | --- | --- | --- | -| `blackoutPeriod` | _[Duration](https://gateway-api.sigs.k8s.io/reference/1.4/spec/#duration)_ | false | | A given endpoint must report load metrics continuously for at least this long before the endpoint weight will be used.
Default is 10s. | -| `weightExpirationPeriod` | _[Duration](https://gateway-api.sigs.k8s.io/reference/1.4/spec/#duration)_ | false | | If a given endpoint has not reported load metrics in this long, stop using the reported weight. Defaults to 3m. | -| `weightUpdatePeriod` | _[Duration](https://gateway-api.sigs.k8s.io/reference/1.4/spec/#duration)_ | false | | How often endpoint weights are recalculated. Values less than 100ms are capped at 100ms. Default 1s. | -| `errorUtilizationPenalty` | _integer_ | false | | ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps).
This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc.
For example:
- 100 => 1.0x
- 120 => 1.2x
- 200 => 2.0x
Note: In the internal IR/XDS configuration this value is converted back to a
floating point multiplier (value / 100.0).
Must be non-negative. | -| `metricNamesForComputingUtilization` | _string array_ | false | | Metric names used to compute utilization if application_utilization is not set.
For map fields in ORCA proto, use the form ".", e.g., "named_metrics.foo". | - - #### ClientTLSSettings @@ -3337,11 +3337,11 @@ _Appears in:_ | Field | Type | Required | Default | Description | | --- | --- | --- | --- | --- | -| `type` | _[LoadBalancerType](#loadbalancertype)_ | true | | Type decides the type of Load Balancer policy.
Valid LoadBalancerType values are
"ConsistentHash",
"LeastRequest",
"Random",
"RoundRobin",
"ClientSideWeightedRoundRobin". | +| `type` | _[LoadBalancerType](#loadbalancertype)_ | true | | Type decides the type of Load Balancer policy.
Valid LoadBalancerType values are
"ConsistentHash",
"LeastRequest",
"Random",
"RoundRobin",
"BackendUtilization". | | `consistentHash` | _[ConsistentHash](#consistenthash)_ | false | | ConsistentHash defines the configuration when the load balancer type is
set to ConsistentHash | -| `clientSideWeightedRoundRobin` | _[ClientSideWeightedRoundRobin](#clientsideweightedroundrobin)_ | false | | ClientSideWeightedRoundRobin defines the configuration when the load balancer type is
set to ClientSideWeightedRoundRobin. | +| `backendUtilization` | _[BackendUtilization](#backendutilization)_ | false | | BackendUtilization defines the configuration when the load balancer type is
set to BackendUtilization. | | `endpointOverride` | _[EndpointOverride](#endpointoverride)_ | false | | EndpointOverride defines the configuration for endpoint override.
When specified, the load balancer will attempt to route requests to endpoints
based on the override information extracted from request headers or metadata.
If the override endpoints are not available, the configured load balancer policy will be used as fallback. | -| `slowStart` | _[SlowStart](#slowstart)_ | false | | SlowStart defines the configuration related to the slow start load balancer policy.
If set, during slow start window, traffic sent to the newly added hosts will gradually increase.
Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. | +| `slowStart` | _[SlowStart](#slowstart)_ | false | | SlowStart defines the configuration related to the slow start load balancer policy.
If set, during slow start window, traffic sent to the newly added hosts will gradually increase.
Supported for RoundRobin, LeastRequest, and BackendUtilization load balancers. | | `zoneAware` | _[ZoneAware](#zoneaware)_ | false | | ZoneAware defines the configuration related to the distribution of requests between locality zones. | @@ -3360,7 +3360,7 @@ _Appears in:_ | `LeastRequest` | LeastRequestLoadBalancerType load balancer policy.
| | `Random` | RandomLoadBalancerType load balancer policy.
| | `RoundRobin` | RoundRobinLoadBalancerType load balancer policy.
| -| `ClientSideWeightedRoundRobin` | ClientSideWeightedRoundRobinLoadBalancerType load balancer policy.
| +| `BackendUtilization` | BackendUtilizationLoadBalancerType load balancer policy.
| #### LocalJWKS diff --git a/test/cel-validation/backendtrafficpolicy_test.go b/test/cel-validation/backendtrafficpolicy_test.go index 6719f3b215..4e8eea1bc7 100644 --- a/test/cel-validation/backendtrafficpolicy_test.go +++ b/test/cel-validation/backendtrafficpolicy_test.go @@ -497,7 +497,7 @@ func TestBackendTrafficPolicyTarget(t *testing.T) { }, wantErrors: []string{ "spec.loadBalancer: Invalid value:", - ": Currently SlowStart is only supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers.", + ": Currently SlowStart is only supported for RoundRobin, LeastRequest, and BackendUtilization load balancers.", }, }, { @@ -525,11 +525,11 @@ func TestBackendTrafficPolicyTarget(t *testing.T) { }, wantErrors: []string{ "spec.loadBalancer: Invalid value:", - ": Currently SlowStart is only supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers.", + ": Currently SlowStart is only supported for RoundRobin, LeastRequest, and BackendUtilization load balancers.", }, }, { - desc: "cswrr all fields set", + desc: "backendUtilization all fields set", mutate: func(btp *egv1a1.BackendTrafficPolicy) { btp.Spec = egv1a1.BackendTrafficPolicySpec{ PolicyTargetReferences: egv1a1.PolicyTargetReferences{ @@ -543,8 +543,8 @@ func TestBackendTrafficPolicyTarget(t *testing.T) { }, ClusterSettings: egv1a1.ClusterSettings{ LoadBalancer: &egv1a1.LoadBalancer{ - Type: egv1a1.ClientSideWeightedRoundRobinLoadBalancerType, - ClientSideWeightedRoundRobin: &egv1a1.ClientSideWeightedRoundRobin{ + Type: egv1a1.BackendUtilizationLoadBalancerType, + BackendUtilization: &egv1a1.BackendUtilization{ BlackoutPeriod: ptr.To(gwapiv1.Duration("10s")), WeightUpdatePeriod: ptr.To(gwapiv1.Duration("10s")), WeightExpirationPeriod: ptr.To(gwapiv1.Duration("10s")), @@ -558,7 +558,7 @@ func TestBackendTrafficPolicyTarget(t *testing.T) { wantErrors: []string{}, }, { - desc: "cswrr field nil when type is ClientSideWeightedRoundRobin", + desc: "backendUtilization field nil when type is BackendUtilization", mutate: func(btp *egv1a1.BackendTrafficPolicy) { btp.Spec = egv1a1.BackendTrafficPolicySpec{ PolicyTargetReferences: egv1a1.PolicyTargetReferences{ @@ -572,17 +572,18 @@ func TestBackendTrafficPolicyTarget(t *testing.T) { }, ClusterSettings: egv1a1.ClusterSettings{ LoadBalancer: &egv1a1.LoadBalancer{ - Type: egv1a1.ClientSideWeightedRoundRobinLoadBalancerType, + Type: egv1a1.BackendUtilizationLoadBalancerType, }, }, } }, wantErrors: []string{ - "spec.loadBalancer: Invalid value: \"object\": If LoadBalancer type is ClientSideWeightedRoundRobin, clientSideWeightedRoundRobin field needs to be set.", + "spec.loadBalancer: Invalid value:", + ": If LoadBalancer type is BackendUtilization, backendUtilization field needs to be set.", }, }, { - desc: "cswrr with SlowStart is set", + desc: "backendUtilization with SlowStart is set", mutate: func(btp *egv1a1.BackendTrafficPolicy) { btp.Spec = egv1a1.BackendTrafficPolicySpec{ PolicyTargetReferences: egv1a1.PolicyTargetReferences{ @@ -596,9 +597,9 @@ func TestBackendTrafficPolicyTarget(t *testing.T) { }, ClusterSettings: egv1a1.ClusterSettings{ LoadBalancer: &egv1a1.LoadBalancer{ - Type: egv1a1.ClientSideWeightedRoundRobinLoadBalancerType, - ClientSideWeightedRoundRobin: &egv1a1.ClientSideWeightedRoundRobin{}, - SlowStart: &egv1a1.SlowStart{Window: ptr.To(gwapiv1.Duration("10ms"))}, + Type: egv1a1.BackendUtilizationLoadBalancerType, + BackendUtilization: &egv1a1.BackendUtilization{}, + SlowStart: &egv1a1.SlowStart{Window: ptr.To(gwapiv1.Duration("10ms"))}, }, }, } @@ -606,7 +607,7 @@ func TestBackendTrafficPolicyTarget(t *testing.T) { wantErrors: []string{}, }, { - desc: "cswrr with ZoneAware is set", + desc: "backendUtilization with ZoneAware is set", mutate: func(btp *egv1a1.BackendTrafficPolicy) { btp.Spec = egv1a1.BackendTrafficPolicySpec{ PolicyTargetReferences: egv1a1.PolicyTargetReferences{ @@ -620,19 +621,20 @@ func TestBackendTrafficPolicyTarget(t *testing.T) { }, ClusterSettings: egv1a1.ClusterSettings{ LoadBalancer: &egv1a1.LoadBalancer{ - Type: egv1a1.ClientSideWeightedRoundRobinLoadBalancerType, - ClientSideWeightedRoundRobin: &egv1a1.ClientSideWeightedRoundRobin{}, - ZoneAware: &egv1a1.ZoneAware{PreferLocal: &egv1a1.PreferLocalZone{}}, + Type: egv1a1.BackendUtilizationLoadBalancerType, + BackendUtilization: &egv1a1.BackendUtilization{}, + ZoneAware: &egv1a1.ZoneAware{PreferLocal: &egv1a1.PreferLocalZone{}}, }, }, } }, wantErrors: []string{ - "spec.loadBalancer: Invalid value: \"object\": Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers.", + "spec.loadBalancer: Invalid value:", + ": Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers.", }, }, { - desc: "cswrr with zero penalty is valid", + desc: "backendUtilization with zero penalty is valid", mutate: func(btp *egv1a1.BackendTrafficPolicy) { btp.Spec = egv1a1.BackendTrafficPolicySpec{ PolicyTargetReferences: egv1a1.PolicyTargetReferences{ @@ -646,8 +648,8 @@ func TestBackendTrafficPolicyTarget(t *testing.T) { }, ClusterSettings: egv1a1.ClusterSettings{ LoadBalancer: &egv1a1.LoadBalancer{ - Type: egv1a1.ClientSideWeightedRoundRobinLoadBalancerType, - ClientSideWeightedRoundRobin: &egv1a1.ClientSideWeightedRoundRobin{ErrorUtilizationPenalty: ptr.To[uint32](0)}, + Type: egv1a1.BackendUtilizationLoadBalancerType, + BackendUtilization: &egv1a1.BackendUtilization{ErrorUtilizationPenalty: ptr.To[uint32](0)}, }, }, } diff --git a/test/e2e/testdata/load_balancing_client_side_weighted_round_robin.yaml b/test/e2e/testdata/load_balancing_backend_utilization.yaml similarity index 83% rename from test/e2e/testdata/load_balancing_client_side_weighted_round_robin.yaml rename to test/e2e/testdata/load_balancing_backend_utilization.yaml index a5774ad49f..33bece851f 100644 --- a/test/e2e/testdata/load_balancing_client_side_weighted_round_robin.yaml +++ b/test/e2e/testdata/load_balancing_backend_utilization.yaml @@ -1,11 +1,11 @@ apiVersion: v1 kind: Service metadata: - name: lb-backend-cswrr + name: lb-backend-bu namespace: gateway-conformance-infra spec: selector: - app: lb-backend-cswrr + app: lb-backend-bu ports: - protocol: TCP port: 8080 @@ -14,19 +14,19 @@ spec: apiVersion: apps/v1 kind: Deployment metadata: - name: lb-backend-cswrr + name: lb-backend-bu namespace: gateway-conformance-infra labels: - app: lb-backend-cswrr + app: lb-backend-bu spec: replicas: 3 selector: matchLabels: - app: lb-backend-cswrr + app: lb-backend-bu template: metadata: labels: - app: lb-backend-cswrr + app: lb-backend-bu spec: containers: - name: backend @@ -42,7 +42,7 @@ spec: fieldRef: fieldPath: metadata.namespace - name: SERVICE_NAME - value: lb-backend-cswrr + value: lb-backend-bu resources: requests: cpu: 10m @@ -58,8 +58,8 @@ spec: kind: HTTPRoute name: client-side-wrr-lb-route loadBalancer: - type: ClientSideWeightedRoundRobin - clientSideWeightedRoundRobin: + type: BackendUtilization + backendUtilization: blackoutPeriod: 30s weightExpirationPeriod: 60s weightUpdatePeriod: 10s @@ -78,7 +78,7 @@ spec: - matches: - path: type: PathPrefix - value: /cswrr + value: /bu backendRefs: - - name: lb-backend-cswrr + - name: lb-backend-bu port: 8080 diff --git a/test/e2e/tests/load_balancing.go b/test/e2e/tests/load_balancing.go index 3cd5cdaf93..25a57c0ea0 100644 --- a/test/e2e/tests/load_balancing.go +++ b/test/e2e/tests/load_balancing.go @@ -45,14 +45,14 @@ func init() { EndpointOverrideLoadBalancingTest, MultiHeaderConsistentHashHeaderLoadBalancingTest, ConsistentHashQueryParamsLoadBalancingTest, - ClientSideWeightedRoundRobinLoadBalancingTest, + BackendUtilizationLoadBalancingTest, ) } -var ClientSideWeightedRoundRobinLoadBalancingTest = suite.ConformanceTest{ - ShortName: "ClientSideWeightedRoundRobinLoadBalancing", - Description: "Test for client-side weighted round robin load balancing type", - Manifests: []string{"testdata/load_balancing_client_side_weighted_round_robin.yaml"}, +var BackendUtilizationLoadBalancingTest = suite.ConformanceTest{ + ShortName: "BackendUtilizationLoadBalancing", + Description: "Test for backend utilization load balancing type", + Manifests: []string{"testdata/load_balancing_backend_utilization.yaml"}, Test: func(t *testing.T, suite *suite.ConformanceTestSuite) { const ( sendRequests = 90 @@ -71,14 +71,14 @@ var ClientSideWeightedRoundRobinLoadBalancingTest = suite.ConformanceTest{ Name: gwapiv1.ObjectName(gwNN.Name), } BackendTrafficPolicyMustBeAccepted(t, suite.Client, types.NamespacedName{Name: "client-side-wrr-lb-policy", Namespace: ns}, suite.ControllerName, ancestorRef) - WaitForPods(t, suite.Client, ns, map[string]string{"app": "lb-backend-cswrr"}, corev1.PodRunning, &PodReady) + WaitForPods(t, suite.Client, ns, map[string]string{"app": "lb-backend-bu"}, corev1.PodRunning, &PodReady) gwAddr := kubernetes.GatewayAndRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN), &gwapiv1.HTTPRoute{}, false, routeNN) t.Run("traffic should be split roughly evenly (defaults to equal weights without ORCA)", func(t *testing.T) { expectedResponse := http.ExpectedResponse{ Request: http.Request{ - Path: "/cswrr", + Path: "/bu", }, Response: http.Response{ StatusCodes: []int{200}, @@ -711,10 +711,10 @@ var EndpointOverrideLoadBalancingTest = suite.ConformanceTest{ }, } -var ClientSideWeightedRoundRobinOOBLoadBalancingTest = suite.ConformanceTest{ - ShortName: "ClientSideWeightedRoundRobinOOBLoadBalancing", - Description: "Test for client-side weighted round robin with OOB enabled", - Manifests: []string{"testdata/load_balancing_client_side_weighted_round_robin_oob.yaml"}, +var BackendUtilizationOOBLoadBalancingTest = suite.ConformanceTest{ + ShortName: "BackendUtilizationOOBLoadBalancing", + Description: "Test for backend utilization with OOB enabled", + Manifests: []string{"testdata/load_balancing_backend_utilization.yaml"}, Test: func(t *testing.T, suite *suite.ConformanceTestSuite) { const ( sendRequests = 90 @@ -733,14 +733,14 @@ var ClientSideWeightedRoundRobinOOBLoadBalancingTest = suite.ConformanceTest{ Name: gwapiv1.ObjectName(gwNN.Name), } BackendTrafficPolicyMustBeAccepted(t, suite.Client, types.NamespacedName{Name: "client-side-wrr-lb-policy-oob", Namespace: ns}, suite.ControllerName, ancestorRef) - WaitForPods(t, suite.Client, ns, map[string]string{"app": "lb-backend-cswrr-oob"}, corev1.PodRunning, &PodReady) + WaitForPods(t, suite.Client, ns, map[string]string{"app": "lb-backend-bu-oob"}, corev1.PodRunning, &PodReady) gwAddr := kubernetes.GatewayAndRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN), &gwapiv1.HTTPRoute{}, false, routeNN) t.Run("traffic should be roughly even with OOB enabled (no ORCA signals)", func(t *testing.T) { expectedResponse := http.ExpectedResponse{ Request: http.Request{ - Path: "/cswrroob", + Path: "/buoob", }, Response: http.Response{ StatusCodes: []int{200}, @@ -768,10 +768,10 @@ var ClientSideWeightedRoundRobinOOBLoadBalancingTest = suite.ConformanceTest{ }, } -var ClientSideWeightedRoundRobinPenaltyLoadBalancingTest = suite.ConformanceTest{ - ShortName: "ClientSideWeightedRoundRobinPenaltyLoadBalancing", - Description: "Test for client-side weighted round robin with penalty and metrics", - Manifests: []string{"testdata/load_balancing_client_side_weighted_round_robin_penalty.yaml"}, +var BackendUtilizationPenaltyLoadBalancingTest = suite.ConformanceTest{ + ShortName: "BackendUtilizationPenaltyLoadBalancing", + Description: "Test for backend utilization with error penalty", + Manifests: []string{"testdata/load_balancing_backend_utilization.yaml"}, Test: func(t *testing.T, suite *suite.ConformanceTestSuite) { const ( sendRequests = 90 @@ -790,14 +790,14 @@ var ClientSideWeightedRoundRobinPenaltyLoadBalancingTest = suite.ConformanceTest Name: gwapiv1.ObjectName(gwNN.Name), } BackendTrafficPolicyMustBeAccepted(t, suite.Client, types.NamespacedName{Name: "client-side-wrr-lb-policy-penalty", Namespace: ns}, suite.ControllerName, ancestorRef) - WaitForPods(t, suite.Client, ns, map[string]string{"app": "lb-backend-cswrr-penalty"}, corev1.PodRunning, &PodReady) + WaitForPods(t, suite.Client, ns, map[string]string{"app": "lb-backend-bu-penalty"}, corev1.PodRunning, &PodReady) gwAddr := kubernetes.GatewayAndRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN), &gwapiv1.HTTPRoute{}, false, routeNN) t.Run("traffic should be roughly even without ORCA, even with penalty configured", func(t *testing.T) { expectedResponse := http.ExpectedResponse{ Request: http.Request{ - Path: "/cswrrpenalty", + Path: "/bupenalty", }, Response: http.Response{ StatusCodes: []int{200}, diff --git a/test/fuzz/testdata/FuzzGatewayAPIToXDS/traffic_policy b/test/fuzz/testdata/FuzzGatewayAPIToXDS/traffic_policy index d3bdedd284..8f0c50225e 100644 --- a/test/fuzz/testdata/FuzzGatewayAPIToXDS/traffic_policy +++ b/test/fuzz/testdata/FuzzGatewayAPIToXDS/traffic_policy @@ -49,14 +49,14 @@ spec: apiVersion: gateway.envoyproxy.io/v1alpha1 kind: BackendTrafficPolicy metadata: - name: cswrr-lb-policy + name: bu-lb-policy namespace: gateway-conformance-infra spec: targetRefs: - group: gateway.networking.k8s.io kind: HTTPRoute - name: cswrr-lb-route + name: bu-lb-route loadBalancer: - type: ClientSideWeightedRoundRobin - clientSideWeightedRoundRobin: + type: BackendUtilization + backendUtilization: errorUtilizationPenalty: 120 diff --git a/test/helm/gateway-crds-helm/all.out.yaml b/test/helm/gateway-crds-helm/all.out.yaml index cfc1ed12cd..8faf1de172 100644 --- a/test/helm/gateway-crds-helm/all.out.yaml +++ b/test/helm/gateway-crds-helm/all.out.yaml @@ -22003,10 +22003,10 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: - clientSideWeightedRoundRobin: + backendUtilization: description: |- - ClientSideWeightedRoundRobin defines the configuration when the load balancer type is - set to ClientSideWeightedRoundRobin. + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. properties: blackoutPeriod: description: |- @@ -22196,7 +22196,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. + Supported for RoundRobin, LeastRequest, and BackendUtilization load balancers. properties: window: description: |- @@ -22217,13 +22217,13 @@ spec: "LeastRequest", "Random", "RoundRobin", - "ClientSideWeightedRoundRobin". + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin - - ClientSideWeightedRoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the configuration related to the @@ -22269,17 +22269,17 @@ spec: field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' - - message: If LoadBalancer type is ClientSideWeightedRoundRobin, clientSideWeightedRoundRobin + - message: If LoadBalancer type is BackendUtilization, backendUtilization field needs to be set. - rule: 'self.type == ''ClientSideWeightedRoundRobin'' ? has(self.clientSideWeightedRoundRobin) - : !has(self.clientSideWeightedRoundRobin)' + rule: 'self.type == ''BackendUtilization'' ? has(self.backendUtilization) + : !has(self.backendUtilization)' - message: Currently SlowStart is only supported for RoundRobin, LeastRequest, - and ClientSideWeightedRoundRobin load balancers. + and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. - rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] + rule: 'self.type in [''ConsistentHash'', ''BackendUtilization''] ? !has(self.zoneAware) : true ' mergeType: description: |- @@ -26867,10 +26867,10 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: - clientSideWeightedRoundRobin: + backendUtilization: description: |- - ClientSideWeightedRoundRobin defines the configuration when the load balancer type is - set to ClientSideWeightedRoundRobin. + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. properties: blackoutPeriod: description: |- @@ -27067,7 +27067,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. + Supported for RoundRobin, LeastRequest, and BackendUtilization load balancers. properties: window: description: |- @@ -27088,13 +27088,13 @@ spec: "LeastRequest", "Random", "RoundRobin", - "ClientSideWeightedRoundRobin". + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin - - ClientSideWeightedRoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the configuration related @@ -27142,18 +27142,17 @@ spec: field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' - - message: If LoadBalancer type is ClientSideWeightedRoundRobin, - clientSideWeightedRoundRobin field needs to be set. - rule: 'self.type == ''ClientSideWeightedRoundRobin'' ? - has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' + - message: If LoadBalancer type is BackendUtilization, backendUtilization + field needs to be set. + rule: 'self.type == ''BackendUtilization'' ? has(self.backendUtilization) + : !has(self.backendUtilization)' - message: Currently SlowStart is only supported for RoundRobin, - LeastRequest, and ClientSideWeightedRoundRobin load - balancers. + LeastRequest, and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. - rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] + rule: 'self.type in [''ConsistentHash'', ''BackendUtilization''] ? !has(self.zoneAware) : true ' proxyProtocol: description: ProxyProtocol enables the Proxy Protocol when @@ -40667,10 +40666,10 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: - clientSideWeightedRoundRobin: + backendUtilization: description: |- - ClientSideWeightedRoundRobin defines the configuration when the load balancer type is - set to ClientSideWeightedRoundRobin. + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. properties: blackoutPeriod: description: |- @@ -40885,7 +40884,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. + Supported for RoundRobin, LeastRequest, and BackendUtilization load balancers. properties: window: description: |- @@ -40906,13 +40905,13 @@ spec: "LeastRequest", "Random", "RoundRobin", - "ClientSideWeightedRoundRobin". + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin - - ClientSideWeightedRoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the @@ -40966,24 +40965,22 @@ spec: consistentHash field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' - - message: If LoadBalancer type is ClientSideWeightedRoundRobin, - clientSideWeightedRoundRobin field - needs to be set. - rule: 'self.type == ''ClientSideWeightedRoundRobin'' - ? has(self.clientSideWeightedRoundRobin) - : !has(self.clientSideWeightedRoundRobin)' + - message: If LoadBalancer type is BackendUtilization, + backendUtilization field needs to + be set. + rule: 'self.type == ''BackendUtilization'' + ? has(self.backendUtilization) : !has(self.backendUtilization)' - message: Currently SlowStart is only supported for RoundRobin, LeastRequest, - and ClientSideWeightedRoundRobin load - balancers. + and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. rule: 'self.type in [''ConsistentHash'', - ''ClientSideWeightedRoundRobin''] - ? !has(self.zoneAware) : true ' + ''BackendUtilization''] ? !has(self.zoneAware) + : true ' proxyProtocol: description: ProxyProtocol enables the Proxy Protocol when communicating with @@ -41980,10 +41977,10 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: - clientSideWeightedRoundRobin: + backendUtilization: description: |- - ClientSideWeightedRoundRobin defines the configuration when the load balancer type is - set to ClientSideWeightedRoundRobin. + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. properties: blackoutPeriod: description: |- @@ -42198,7 +42195,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. + Supported for RoundRobin, LeastRequest, and BackendUtilization load balancers. properties: window: description: |- @@ -42219,13 +42216,13 @@ spec: "LeastRequest", "Random", "RoundRobin", - "ClientSideWeightedRoundRobin". + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin - - ClientSideWeightedRoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the @@ -42279,24 +42276,22 @@ spec: consistentHash field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' - - message: If LoadBalancer type is ClientSideWeightedRoundRobin, - clientSideWeightedRoundRobin field - needs to be set. - rule: 'self.type == ''ClientSideWeightedRoundRobin'' - ? has(self.clientSideWeightedRoundRobin) - : !has(self.clientSideWeightedRoundRobin)' + - message: If LoadBalancer type is BackendUtilization, + backendUtilization field needs to + be set. + rule: 'self.type == ''BackendUtilization'' + ? has(self.backendUtilization) : !has(self.backendUtilization)' - message: Currently SlowStart is only supported for RoundRobin, LeastRequest, - and ClientSideWeightedRoundRobin load - balancers. + and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. rule: 'self.type in [''ConsistentHash'', - ''ClientSideWeightedRoundRobin''] - ? !has(self.zoneAware) : true ' + ''BackendUtilization''] ? !has(self.zoneAware) + : true ' proxyProtocol: description: ProxyProtocol enables the Proxy Protocol when communicating with @@ -43437,10 +43432,10 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: - clientSideWeightedRoundRobin: + backendUtilization: description: |- - ClientSideWeightedRoundRobin defines the configuration when the load balancer type is - set to ClientSideWeightedRoundRobin. + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. properties: blackoutPeriod: description: |- @@ -43647,7 +43642,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. + Supported for RoundRobin, LeastRequest, and BackendUtilization load balancers. properties: window: description: |- @@ -43668,13 +43663,13 @@ spec: "LeastRequest", "Random", "RoundRobin", - "ClientSideWeightedRoundRobin". + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin - - ClientSideWeightedRoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the configuration @@ -43727,21 +43722,19 @@ spec: consistentHash field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' - - message: If LoadBalancer type is ClientSideWeightedRoundRobin, - clientSideWeightedRoundRobin field needs - to be set. - rule: 'self.type == ''ClientSideWeightedRoundRobin'' - ? has(self.clientSideWeightedRoundRobin) - : !has(self.clientSideWeightedRoundRobin)' + - message: If LoadBalancer type is BackendUtilization, + backendUtilization field needs to be set. + rule: 'self.type == ''BackendUtilization'' + ? has(self.backendUtilization) : !has(self.backendUtilization)' - message: Currently SlowStart is only supported - for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin + for RoundRobin, LeastRequest, and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. - rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] + rule: 'self.type in [''ConsistentHash'', ''BackendUtilization''] ? !has(self.zoneAware) : true ' proxyProtocol: description: ProxyProtocol enables the Proxy @@ -44794,10 +44787,10 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: - clientSideWeightedRoundRobin: + backendUtilization: description: |- - ClientSideWeightedRoundRobin defines the configuration when the load balancer type is - set to ClientSideWeightedRoundRobin. + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. properties: blackoutPeriod: description: |- @@ -44998,7 +44991,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. + Supported for RoundRobin, LeastRequest, and BackendUtilization load balancers. properties: window: description: |- @@ -45019,13 +45012,13 @@ spec: "LeastRequest", "Random", "RoundRobin", - "ClientSideWeightedRoundRobin". + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin - - ClientSideWeightedRoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the configuration @@ -45076,19 +45069,18 @@ spec: consistentHash field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' - - message: If LoadBalancer type is ClientSideWeightedRoundRobin, - clientSideWeightedRoundRobin field needs to be - set. - rule: 'self.type == ''ClientSideWeightedRoundRobin'' - ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' + - message: If LoadBalancer type is BackendUtilization, + backendUtilization field needs to be set. + rule: 'self.type == ''BackendUtilization'' ? has(self.backendUtilization) + : !has(self.backendUtilization)' - message: Currently SlowStart is only supported for - RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin + RoundRobin, LeastRequest, and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. - rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] + rule: 'self.type in [''ConsistentHash'', ''BackendUtilization''] ? !has(self.zoneAware) : true ' proxyProtocol: description: ProxyProtocol enables the Proxy Protocol @@ -47437,10 +47429,10 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: - clientSideWeightedRoundRobin: + backendUtilization: description: |- - ClientSideWeightedRoundRobin defines the configuration when the load balancer type is - set to ClientSideWeightedRoundRobin. + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. properties: blackoutPeriod: description: |- @@ -47639,7 +47631,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. + Supported for RoundRobin, LeastRequest, and BackendUtilization load balancers. properties: window: description: |- @@ -47660,13 +47652,13 @@ spec: "LeastRequest", "Random", "RoundRobin", - "ClientSideWeightedRoundRobin". + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin - - ClientSideWeightedRoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the configuration related @@ -47716,18 +47708,17 @@ spec: field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' - - message: If LoadBalancer type is ClientSideWeightedRoundRobin, - clientSideWeightedRoundRobin field needs to be set. - rule: 'self.type == ''ClientSideWeightedRoundRobin'' - ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' + - message: If LoadBalancer type is BackendUtilization, + backendUtilization field needs to be set. + rule: 'self.type == ''BackendUtilization'' ? has(self.backendUtilization) + : !has(self.backendUtilization)' - message: Currently SlowStart is only supported for RoundRobin, - LeastRequest, and ClientSideWeightedRoundRobin load - balancers. + LeastRequest, and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. - rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] + rule: 'self.type in [''ConsistentHash'', ''BackendUtilization''] ? !has(self.zoneAware) : true ' proxyProtocol: description: ProxyProtocol enables the Proxy Protocol @@ -48632,10 +48623,10 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: - clientSideWeightedRoundRobin: + backendUtilization: description: |- - ClientSideWeightedRoundRobin defines the configuration when the load balancer type is - set to ClientSideWeightedRoundRobin. + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. properties: blackoutPeriod: description: |- @@ -48834,7 +48825,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. + Supported for RoundRobin, LeastRequest, and BackendUtilization load balancers. properties: window: description: |- @@ -48855,13 +48846,13 @@ spec: "LeastRequest", "Random", "RoundRobin", - "ClientSideWeightedRoundRobin". + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin - - ClientSideWeightedRoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the configuration related @@ -48911,18 +48902,17 @@ spec: field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' - - message: If LoadBalancer type is ClientSideWeightedRoundRobin, - clientSideWeightedRoundRobin field needs to be set. - rule: 'self.type == ''ClientSideWeightedRoundRobin'' - ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' + - message: If LoadBalancer type is BackendUtilization, + backendUtilization field needs to be set. + rule: 'self.type == ''BackendUtilization'' ? has(self.backendUtilization) + : !has(self.backendUtilization)' - message: Currently SlowStart is only supported for RoundRobin, - LeastRequest, and ClientSideWeightedRoundRobin load - balancers. + LeastRequest, and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. - rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] + rule: 'self.type in [''ConsistentHash'', ''BackendUtilization''] ? !has(self.zoneAware) : true ' proxyProtocol: description: ProxyProtocol enables the Proxy Protocol @@ -50038,10 +50028,10 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: - clientSideWeightedRoundRobin: + backendUtilization: description: |- - ClientSideWeightedRoundRobin defines the configuration when the load balancer type is - set to ClientSideWeightedRoundRobin. + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. properties: blackoutPeriod: description: |- @@ -50244,7 +50234,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. + Supported for RoundRobin, LeastRequest, and BackendUtilization load balancers. properties: window: description: |- @@ -50265,13 +50255,13 @@ spec: "LeastRequest", "Random", "RoundRobin", - "ClientSideWeightedRoundRobin". + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin - - ClientSideWeightedRoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the configuration @@ -50322,20 +50312,19 @@ spec: consistentHash field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' - - message: If LoadBalancer type is ClientSideWeightedRoundRobin, - clientSideWeightedRoundRobin field needs to - be set. - rule: 'self.type == ''ClientSideWeightedRoundRobin'' - ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' + - message: If LoadBalancer type is BackendUtilization, + backendUtilization field needs to be set. + rule: 'self.type == ''BackendUtilization'' ? has(self.backendUtilization) + : !has(self.backendUtilization)' - message: Currently SlowStart is only supported - for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin + for RoundRobin, LeastRequest, and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. - rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] + rule: 'self.type in [''ConsistentHash'', ''BackendUtilization''] ? !has(self.zoneAware) : true ' proxyProtocol: description: ProxyProtocol enables the Proxy Protocol @@ -51504,10 +51493,10 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: - clientSideWeightedRoundRobin: + backendUtilization: description: |- - ClientSideWeightedRoundRobin defines the configuration when the load balancer type is - set to ClientSideWeightedRoundRobin. + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. properties: blackoutPeriod: description: |- @@ -51706,7 +51695,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. + Supported for RoundRobin, LeastRequest, and BackendUtilization load balancers. properties: window: description: |- @@ -51727,13 +51716,13 @@ spec: "LeastRequest", "Random", "RoundRobin", - "ClientSideWeightedRoundRobin". + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin - - ClientSideWeightedRoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the configuration related @@ -51783,18 +51772,17 @@ spec: field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' - - message: If LoadBalancer type is ClientSideWeightedRoundRobin, - clientSideWeightedRoundRobin field needs to be set. - rule: 'self.type == ''ClientSideWeightedRoundRobin'' - ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' + - message: If LoadBalancer type is BackendUtilization, + backendUtilization field needs to be set. + rule: 'self.type == ''BackendUtilization'' ? has(self.backendUtilization) + : !has(self.backendUtilization)' - message: Currently SlowStart is only supported for RoundRobin, - LeastRequest, and ClientSideWeightedRoundRobin load - balancers. + LeastRequest, and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. - rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] + rule: 'self.type in [''ConsistentHash'', ''BackendUtilization''] ? !has(self.zoneAware) : true ' proxyProtocol: description: ProxyProtocol enables the Proxy Protocol diff --git a/test/helm/gateway-crds-helm/envoy-gateway-crds.out.yaml b/test/helm/gateway-crds-helm/envoy-gateway-crds.out.yaml index 2b60735c40..fb15f6925a 100644 --- a/test/helm/gateway-crds-helm/envoy-gateway-crds.out.yaml +++ b/test/helm/gateway-crds-helm/envoy-gateway-crds.out.yaml @@ -1183,10 +1183,10 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: - clientSideWeightedRoundRobin: + backendUtilization: description: |- - ClientSideWeightedRoundRobin defines the configuration when the load balancer type is - set to ClientSideWeightedRoundRobin. + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. properties: blackoutPeriod: description: |- @@ -1376,7 +1376,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. + Supported for RoundRobin, LeastRequest, and BackendUtilization load balancers. properties: window: description: |- @@ -1397,13 +1397,13 @@ spec: "LeastRequest", "Random", "RoundRobin", - "ClientSideWeightedRoundRobin". + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin - - ClientSideWeightedRoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the configuration related to the @@ -1449,17 +1449,17 @@ spec: field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' - - message: If LoadBalancer type is ClientSideWeightedRoundRobin, clientSideWeightedRoundRobin + - message: If LoadBalancer type is BackendUtilization, backendUtilization field needs to be set. - rule: 'self.type == ''ClientSideWeightedRoundRobin'' ? has(self.clientSideWeightedRoundRobin) - : !has(self.clientSideWeightedRoundRobin)' + rule: 'self.type == ''BackendUtilization'' ? has(self.backendUtilization) + : !has(self.backendUtilization)' - message: Currently SlowStart is only supported for RoundRobin, LeastRequest, - and ClientSideWeightedRoundRobin load balancers. + and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. - rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] + rule: 'self.type in [''ConsistentHash'', ''BackendUtilization''] ? !has(self.zoneAware) : true ' mergeType: description: |- @@ -6047,10 +6047,10 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: - clientSideWeightedRoundRobin: + backendUtilization: description: |- - ClientSideWeightedRoundRobin defines the configuration when the load balancer type is - set to ClientSideWeightedRoundRobin. + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. properties: blackoutPeriod: description: |- @@ -6247,7 +6247,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. + Supported for RoundRobin, LeastRequest, and BackendUtilization load balancers. properties: window: description: |- @@ -6268,13 +6268,13 @@ spec: "LeastRequest", "Random", "RoundRobin", - "ClientSideWeightedRoundRobin". + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin - - ClientSideWeightedRoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the configuration related @@ -6322,18 +6322,17 @@ spec: field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' - - message: If LoadBalancer type is ClientSideWeightedRoundRobin, - clientSideWeightedRoundRobin field needs to be set. - rule: 'self.type == ''ClientSideWeightedRoundRobin'' ? - has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' + - message: If LoadBalancer type is BackendUtilization, backendUtilization + field needs to be set. + rule: 'self.type == ''BackendUtilization'' ? has(self.backendUtilization) + : !has(self.backendUtilization)' - message: Currently SlowStart is only supported for RoundRobin, - LeastRequest, and ClientSideWeightedRoundRobin load - balancers. + LeastRequest, and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. - rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] + rule: 'self.type in [''ConsistentHash'', ''BackendUtilization''] ? !has(self.zoneAware) : true ' proxyProtocol: description: ProxyProtocol enables the Proxy Protocol when @@ -19847,10 +19846,10 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: - clientSideWeightedRoundRobin: + backendUtilization: description: |- - ClientSideWeightedRoundRobin defines the configuration when the load balancer type is - set to ClientSideWeightedRoundRobin. + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. properties: blackoutPeriod: description: |- @@ -20065,7 +20064,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. + Supported for RoundRobin, LeastRequest, and BackendUtilization load balancers. properties: window: description: |- @@ -20086,13 +20085,13 @@ spec: "LeastRequest", "Random", "RoundRobin", - "ClientSideWeightedRoundRobin". + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin - - ClientSideWeightedRoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the @@ -20146,24 +20145,22 @@ spec: consistentHash field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' - - message: If LoadBalancer type is ClientSideWeightedRoundRobin, - clientSideWeightedRoundRobin field - needs to be set. - rule: 'self.type == ''ClientSideWeightedRoundRobin'' - ? has(self.clientSideWeightedRoundRobin) - : !has(self.clientSideWeightedRoundRobin)' + - message: If LoadBalancer type is BackendUtilization, + backendUtilization field needs to + be set. + rule: 'self.type == ''BackendUtilization'' + ? has(self.backendUtilization) : !has(self.backendUtilization)' - message: Currently SlowStart is only supported for RoundRobin, LeastRequest, - and ClientSideWeightedRoundRobin load - balancers. + and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. rule: 'self.type in [''ConsistentHash'', - ''ClientSideWeightedRoundRobin''] - ? !has(self.zoneAware) : true ' + ''BackendUtilization''] ? !has(self.zoneAware) + : true ' proxyProtocol: description: ProxyProtocol enables the Proxy Protocol when communicating with @@ -21160,10 +21157,10 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: - clientSideWeightedRoundRobin: + backendUtilization: description: |- - ClientSideWeightedRoundRobin defines the configuration when the load balancer type is - set to ClientSideWeightedRoundRobin. + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. properties: blackoutPeriod: description: |- @@ -21378,7 +21375,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. + Supported for RoundRobin, LeastRequest, and BackendUtilization load balancers. properties: window: description: |- @@ -21399,13 +21396,13 @@ spec: "LeastRequest", "Random", "RoundRobin", - "ClientSideWeightedRoundRobin". + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin - - ClientSideWeightedRoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the @@ -21459,24 +21456,22 @@ spec: consistentHash field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' - - message: If LoadBalancer type is ClientSideWeightedRoundRobin, - clientSideWeightedRoundRobin field - needs to be set. - rule: 'self.type == ''ClientSideWeightedRoundRobin'' - ? has(self.clientSideWeightedRoundRobin) - : !has(self.clientSideWeightedRoundRobin)' + - message: If LoadBalancer type is BackendUtilization, + backendUtilization field needs to + be set. + rule: 'self.type == ''BackendUtilization'' + ? has(self.backendUtilization) : !has(self.backendUtilization)' - message: Currently SlowStart is only supported for RoundRobin, LeastRequest, - and ClientSideWeightedRoundRobin load - balancers. + and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. rule: 'self.type in [''ConsistentHash'', - ''ClientSideWeightedRoundRobin''] - ? !has(self.zoneAware) : true ' + ''BackendUtilization''] ? !has(self.zoneAware) + : true ' proxyProtocol: description: ProxyProtocol enables the Proxy Protocol when communicating with @@ -22617,10 +22612,10 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: - clientSideWeightedRoundRobin: + backendUtilization: description: |- - ClientSideWeightedRoundRobin defines the configuration when the load balancer type is - set to ClientSideWeightedRoundRobin. + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. properties: blackoutPeriod: description: |- @@ -22827,7 +22822,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. + Supported for RoundRobin, LeastRequest, and BackendUtilization load balancers. properties: window: description: |- @@ -22848,13 +22843,13 @@ spec: "LeastRequest", "Random", "RoundRobin", - "ClientSideWeightedRoundRobin". + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin - - ClientSideWeightedRoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the configuration @@ -22907,21 +22902,19 @@ spec: consistentHash field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' - - message: If LoadBalancer type is ClientSideWeightedRoundRobin, - clientSideWeightedRoundRobin field needs - to be set. - rule: 'self.type == ''ClientSideWeightedRoundRobin'' - ? has(self.clientSideWeightedRoundRobin) - : !has(self.clientSideWeightedRoundRobin)' + - message: If LoadBalancer type is BackendUtilization, + backendUtilization field needs to be set. + rule: 'self.type == ''BackendUtilization'' + ? has(self.backendUtilization) : !has(self.backendUtilization)' - message: Currently SlowStart is only supported - for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin + for RoundRobin, LeastRequest, and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. - rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] + rule: 'self.type in [''ConsistentHash'', ''BackendUtilization''] ? !has(self.zoneAware) : true ' proxyProtocol: description: ProxyProtocol enables the Proxy @@ -23974,10 +23967,10 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: - clientSideWeightedRoundRobin: + backendUtilization: description: |- - ClientSideWeightedRoundRobin defines the configuration when the load balancer type is - set to ClientSideWeightedRoundRobin. + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. properties: blackoutPeriod: description: |- @@ -24178,7 +24171,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. + Supported for RoundRobin, LeastRequest, and BackendUtilization load balancers. properties: window: description: |- @@ -24199,13 +24192,13 @@ spec: "LeastRequest", "Random", "RoundRobin", - "ClientSideWeightedRoundRobin". + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin - - ClientSideWeightedRoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the configuration @@ -24256,19 +24249,18 @@ spec: consistentHash field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' - - message: If LoadBalancer type is ClientSideWeightedRoundRobin, - clientSideWeightedRoundRobin field needs to be - set. - rule: 'self.type == ''ClientSideWeightedRoundRobin'' - ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' + - message: If LoadBalancer type is BackendUtilization, + backendUtilization field needs to be set. + rule: 'self.type == ''BackendUtilization'' ? has(self.backendUtilization) + : !has(self.backendUtilization)' - message: Currently SlowStart is only supported for - RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin + RoundRobin, LeastRequest, and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. - rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] + rule: 'self.type in [''ConsistentHash'', ''BackendUtilization''] ? !has(self.zoneAware) : true ' proxyProtocol: description: ProxyProtocol enables the Proxy Protocol @@ -26617,10 +26609,10 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: - clientSideWeightedRoundRobin: + backendUtilization: description: |- - ClientSideWeightedRoundRobin defines the configuration when the load balancer type is - set to ClientSideWeightedRoundRobin. + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. properties: blackoutPeriod: description: |- @@ -26819,7 +26811,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. + Supported for RoundRobin, LeastRequest, and BackendUtilization load balancers. properties: window: description: |- @@ -26840,13 +26832,13 @@ spec: "LeastRequest", "Random", "RoundRobin", - "ClientSideWeightedRoundRobin". + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin - - ClientSideWeightedRoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the configuration related @@ -26896,18 +26888,17 @@ spec: field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' - - message: If LoadBalancer type is ClientSideWeightedRoundRobin, - clientSideWeightedRoundRobin field needs to be set. - rule: 'self.type == ''ClientSideWeightedRoundRobin'' - ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' + - message: If LoadBalancer type is BackendUtilization, + backendUtilization field needs to be set. + rule: 'self.type == ''BackendUtilization'' ? has(self.backendUtilization) + : !has(self.backendUtilization)' - message: Currently SlowStart is only supported for RoundRobin, - LeastRequest, and ClientSideWeightedRoundRobin load - balancers. + LeastRequest, and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. - rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] + rule: 'self.type in [''ConsistentHash'', ''BackendUtilization''] ? !has(self.zoneAware) : true ' proxyProtocol: description: ProxyProtocol enables the Proxy Protocol @@ -27812,10 +27803,10 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: - clientSideWeightedRoundRobin: + backendUtilization: description: |- - ClientSideWeightedRoundRobin defines the configuration when the load balancer type is - set to ClientSideWeightedRoundRobin. + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. properties: blackoutPeriod: description: |- @@ -28014,7 +28005,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. + Supported for RoundRobin, LeastRequest, and BackendUtilization load balancers. properties: window: description: |- @@ -28035,13 +28026,13 @@ spec: "LeastRequest", "Random", "RoundRobin", - "ClientSideWeightedRoundRobin". + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin - - ClientSideWeightedRoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the configuration related @@ -28091,18 +28082,17 @@ spec: field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' - - message: If LoadBalancer type is ClientSideWeightedRoundRobin, - clientSideWeightedRoundRobin field needs to be set. - rule: 'self.type == ''ClientSideWeightedRoundRobin'' - ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' + - message: If LoadBalancer type is BackendUtilization, + backendUtilization field needs to be set. + rule: 'self.type == ''BackendUtilization'' ? has(self.backendUtilization) + : !has(self.backendUtilization)' - message: Currently SlowStart is only supported for RoundRobin, - LeastRequest, and ClientSideWeightedRoundRobin load - balancers. + LeastRequest, and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. - rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] + rule: 'self.type in [''ConsistentHash'', ''BackendUtilization''] ? !has(self.zoneAware) : true ' proxyProtocol: description: ProxyProtocol enables the Proxy Protocol @@ -29218,10 +29208,10 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: - clientSideWeightedRoundRobin: + backendUtilization: description: |- - ClientSideWeightedRoundRobin defines the configuration when the load balancer type is - set to ClientSideWeightedRoundRobin. + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. properties: blackoutPeriod: description: |- @@ -29424,7 +29414,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. + Supported for RoundRobin, LeastRequest, and BackendUtilization load balancers. properties: window: description: |- @@ -29445,13 +29435,13 @@ spec: "LeastRequest", "Random", "RoundRobin", - "ClientSideWeightedRoundRobin". + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin - - ClientSideWeightedRoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the configuration @@ -29502,20 +29492,19 @@ spec: consistentHash field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' - - message: If LoadBalancer type is ClientSideWeightedRoundRobin, - clientSideWeightedRoundRobin field needs to - be set. - rule: 'self.type == ''ClientSideWeightedRoundRobin'' - ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' + - message: If LoadBalancer type is BackendUtilization, + backendUtilization field needs to be set. + rule: 'self.type == ''BackendUtilization'' ? has(self.backendUtilization) + : !has(self.backendUtilization)' - message: Currently SlowStart is only supported - for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin + for RoundRobin, LeastRequest, and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. - rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] + rule: 'self.type in [''ConsistentHash'', ''BackendUtilization''] ? !has(self.zoneAware) : true ' proxyProtocol: description: ProxyProtocol enables the Proxy Protocol @@ -30684,10 +30673,10 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: - clientSideWeightedRoundRobin: + backendUtilization: description: |- - ClientSideWeightedRoundRobin defines the configuration when the load balancer type is - set to ClientSideWeightedRoundRobin. + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. properties: blackoutPeriod: description: |- @@ -30886,7 +30875,7 @@ spec: description: |- SlowStart defines the configuration related to the slow start load balancer policy. If set, during slow start window, traffic sent to the newly added hosts will gradually increase. - Supported for RoundRobin, LeastRequest, and ClientSideWeightedRoundRobin load balancers. + Supported for RoundRobin, LeastRequest, and BackendUtilization load balancers. properties: window: description: |- @@ -30907,13 +30896,13 @@ spec: "LeastRequest", "Random", "RoundRobin", - "ClientSideWeightedRoundRobin". + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin - - ClientSideWeightedRoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the configuration related @@ -30963,18 +30952,17 @@ spec: field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' - - message: If LoadBalancer type is ClientSideWeightedRoundRobin, - clientSideWeightedRoundRobin field needs to be set. - rule: 'self.type == ''ClientSideWeightedRoundRobin'' - ? has(self.clientSideWeightedRoundRobin) : !has(self.clientSideWeightedRoundRobin)' + - message: If LoadBalancer type is BackendUtilization, + backendUtilization field needs to be set. + rule: 'self.type == ''BackendUtilization'' ? has(self.backendUtilization) + : !has(self.backendUtilization)' - message: Currently SlowStart is only supported for RoundRobin, - LeastRequest, and ClientSideWeightedRoundRobin load - balancers. + LeastRequest, and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers. - rule: 'self.type in [''ConsistentHash'', ''ClientSideWeightedRoundRobin''] + rule: 'self.type in [''ConsistentHash'', ''BackendUtilization''] ? !has(self.zoneAware) : true ' proxyProtocol: description: ProxyProtocol enables the Proxy Protocol From 44bfe7b9d28fc124ed21806c4c5a0218b57a634d Mon Sep 17 00:00:00 2001 From: "anurag.ag" Date: Wed, 21 Jan 2026 14:23:01 +0530 Subject: [PATCH 11/23] Update: Replace `ClientSideWeightedRoundRobin` references with `BackendUtilization` in load balancing tests and documentation. Signed-off-by: anurag.ag --- .../en/latest/concepts/load-balancing.md | 2 +- test/e2e/tests/load_balancing.go | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/site/content/en/latest/concepts/load-balancing.md b/site/content/en/latest/concepts/load-balancing.md index c7f0be2045..81fb4133df 100644 --- a/site/content/en/latest/concepts/load-balancing.md +++ b/site/content/en/latest/concepts/load-balancing.md @@ -23,7 +23,7 @@ Envoy Gateway supports several load balancing strategies that determine how traf - **Random** – Chooses a backend at random to balance load - **Least Request** – Sends the request to the backend with the fewest active requests (this is the default) - **Consistent Hash** – Routes requests based on a hash (e.g., client IP or header), which helps keep repeat requests going to the same backend (useful for session affinity) -- **Client-Side Weighted Round Robin (CS-WRR)** – Uses client-observed load reports (e.g., ORCA metrics) to dynamically weight endpoints; if no metrics are available, it behaves similar to even-weight round robin +- **Backend Utilization** – Uses client-observed load reports (e.g., ORCA metrics) to dynamically weight endpoints; if no metrics are available, it behaves similar to even-weight round robin If no load balancing strategy is specified, Envoy Gateway uses **Least Request** by default. diff --git a/test/e2e/tests/load_balancing.go b/test/e2e/tests/load_balancing.go index 25a57c0ea0..40ff7c8614 100644 --- a/test/e2e/tests/load_balancing.go +++ b/test/e2e/tests/load_balancing.go @@ -61,7 +61,7 @@ var BackendUtilizationLoadBalancingTest = suite.ConformanceTest{ ) ns := "gateway-conformance-infra" - routeNN := types.NamespacedName{Name: "client-side-wrr-lb-route", Namespace: ns} + routeNN := types.NamespacedName{Name: "backend-utilization-lb-route", Namespace: ns} gwNN := types.NamespacedName{Name: "same-namespace", Namespace: ns} ancestorRef := gwapiv1.ParentReference{ @@ -70,7 +70,7 @@ var BackendUtilizationLoadBalancingTest = suite.ConformanceTest{ Namespace: gatewayapi.NamespacePtr(gwNN.Namespace), Name: gwapiv1.ObjectName(gwNN.Name), } - BackendTrafficPolicyMustBeAccepted(t, suite.Client, types.NamespacedName{Name: "client-side-wrr-lb-policy", Namespace: ns}, suite.ControllerName, ancestorRef) + BackendTrafficPolicyMustBeAccepted(t, suite.Client, types.NamespacedName{Name: "backend-utilization-lb-policy", Namespace: ns}, suite.ControllerName, ancestorRef) WaitForPods(t, suite.Client, ns, map[string]string{"app": "lb-backend-bu"}, corev1.PodRunning, &PodReady) gwAddr := kubernetes.GatewayAndRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN), &gwapiv1.HTTPRoute{}, false, routeNN) @@ -100,7 +100,7 @@ var BackendUtilizationLoadBalancingTest = suite.ConformanceTest{ if err := wait.PollUntilContextTimeout(context.TODO(), time.Second, 30*time.Second, true, func(_ context.Context) (bool, error) { return runTrafficTest(t, suite, &req, &expectedResponse, sendRequests, compareFunc), nil }); err != nil { - tlog.Errorf(t, "failed to run client-side weighted round robin load balancing test: %v", err) + tlog.Errorf(t, "failed to run backend utilization load balancing test: %v", err) } }) }, @@ -723,7 +723,7 @@ var BackendUtilizationOOBLoadBalancingTest = suite.ConformanceTest{ ) ns := "gateway-conformance-infra" - routeNN := types.NamespacedName{Name: "client-side-wrr-lb-route-oob", Namespace: ns} + routeNN := types.NamespacedName{Name: "backend-utilization-lb-route-oob", Namespace: ns} gwNN := types.NamespacedName{Name: "same-namespace", Namespace: ns} ancestorRef := gwapiv1.ParentReference{ @@ -732,7 +732,7 @@ var BackendUtilizationOOBLoadBalancingTest = suite.ConformanceTest{ Namespace: gatewayapi.NamespacePtr(gwNN.Namespace), Name: gwapiv1.ObjectName(gwNN.Name), } - BackendTrafficPolicyMustBeAccepted(t, suite.Client, types.NamespacedName{Name: "client-side-wrr-lb-policy-oob", Namespace: ns}, suite.ControllerName, ancestorRef) + BackendTrafficPolicyMustBeAccepted(t, suite.Client, types.NamespacedName{Name: "backend-utilization-lb-policy-oob", Namespace: ns}, suite.ControllerName, ancestorRef) WaitForPods(t, suite.Client, ns, map[string]string{"app": "lb-backend-bu-oob"}, corev1.PodRunning, &PodReady) gwAddr := kubernetes.GatewayAndRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN), &gwapiv1.HTTPRoute{}, false, routeNN) @@ -762,7 +762,7 @@ var BackendUtilizationOOBLoadBalancingTest = suite.ConformanceTest{ if err := wait.PollUntilContextTimeout(context.TODO(), time.Second, 30*time.Second, true, func(_ context.Context) (bool, error) { return runTrafficTest(t, suite, &req, &expectedResponse, sendRequests, compareFunc), nil }); err != nil { - tlog.Errorf(t, "failed to run client-side WRR OOB test: %v", err) + tlog.Errorf(t, "failed to run backend utilization OOB test: %v", err) } }) }, @@ -780,7 +780,7 @@ var BackendUtilizationPenaltyLoadBalancingTest = suite.ConformanceTest{ ) ns := "gateway-conformance-infra" - routeNN := types.NamespacedName{Name: "client-side-wrr-lb-route-penalty", Namespace: ns} + routeNN := types.NamespacedName{Name: "backend-utilization-lb-route-penalty", Namespace: ns} gwNN := types.NamespacedName{Name: "same-namespace", Namespace: ns} ancestorRef := gwapiv1.ParentReference{ @@ -789,7 +789,7 @@ var BackendUtilizationPenaltyLoadBalancingTest = suite.ConformanceTest{ Namespace: gatewayapi.NamespacePtr(gwNN.Namespace), Name: gwapiv1.ObjectName(gwNN.Name), } - BackendTrafficPolicyMustBeAccepted(t, suite.Client, types.NamespacedName{Name: "client-side-wrr-lb-policy-penalty", Namespace: ns}, suite.ControllerName, ancestorRef) + BackendTrafficPolicyMustBeAccepted(t, suite.Client, types.NamespacedName{Name: "backend-utilization-lb-policy-penalty", Namespace: ns}, suite.ControllerName, ancestorRef) WaitForPods(t, suite.Client, ns, map[string]string{"app": "lb-backend-bu-penalty"}, corev1.PodRunning, &PodReady) gwAddr := kubernetes.GatewayAndRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN), &gwapiv1.HTTPRoute{}, false, routeNN) @@ -819,7 +819,7 @@ var BackendUtilizationPenaltyLoadBalancingTest = suite.ConformanceTest{ if err := wait.PollUntilContextTimeout(context.TODO(), time.Second, 30*time.Second, true, func(_ context.Context) (bool, error) { return runTrafficTest(t, suite, &req, &expectedResponse, sendRequests, compareFunc), nil }); err != nil { - tlog.Errorf(t, "failed to run client-side WRR penalty test: %v", err) + tlog.Errorf(t, "failed to run backend utilization penalty test: %v", err) } }) }, From afb690d84088c54b0d8819bc2f739c995fb7d39f Mon Sep 17 00:00:00 2001 From: "anurag.ag" Date: Wed, 21 Jan 2026 18:17:50 +0530 Subject: [PATCH 12/23] Update: Replace `lb-backend-bu` references with `lb-backend-utilization` across tests, configurations, and load balancing policies for consistency. Signed-off-by: anurag.ag --- internal/gatewayapi/clustersettings.go | 24 +++++++++---------- .../load_balancing_backend_utilization.yaml | 24 +++++++++---------- test/e2e/tests/load_balancing.go | 4 ++-- .../FuzzGatewayAPIToXDS/traffic_policy | 4 ++-- 4 files changed, 28 insertions(+), 28 deletions(-) diff --git a/internal/gatewayapi/clustersettings.go b/internal/gatewayapi/clustersettings.go index 08994e70df..93d7757602 100644 --- a/internal/gatewayapi/clustersettings.go +++ b/internal/gatewayapi/clustersettings.go @@ -345,28 +345,28 @@ func buildLoadBalancer(policy *egv1a1.ClusterSettings) (*ir.LoadBalancer, error) lb = &ir.LoadBalancer{ BackendUtilization: &ir.BackendUtilization{}, } - bu := policy.LoadBalancer.BackendUtilization - if bu != nil { - if bu.BlackoutPeriod != nil { - if d, err := time.ParseDuration(string(*bu.BlackoutPeriod)); err == nil { + backendUtilization := policy.LoadBalancer.BackendUtilization + if backendUtilization != nil { + if backendUtilization.BlackoutPeriod != nil { + if d, err := time.ParseDuration(string(*backendUtilization.BlackoutPeriod)); err == nil { lb.BackendUtilization.BlackoutPeriod = ir.MetaV1DurationPtr(d) } } - if bu.WeightExpirationPeriod != nil { - if d, err := time.ParseDuration(string(*bu.WeightExpirationPeriod)); err == nil { + if backendUtilization.WeightExpirationPeriod != nil { + if d, err := time.ParseDuration(string(*backendUtilization.WeightExpirationPeriod)); err == nil { lb.BackendUtilization.WeightExpirationPeriod = ir.MetaV1DurationPtr(d) } } - if bu.WeightUpdatePeriod != nil { - if d, err := time.ParseDuration(string(*bu.WeightUpdatePeriod)); err == nil { + if backendUtilization.WeightUpdatePeriod != nil { + if d, err := time.ParseDuration(string(*backendUtilization.WeightUpdatePeriod)); err == nil { lb.BackendUtilization.WeightUpdatePeriod = ir.MetaV1DurationPtr(d) } } - if bu.ErrorUtilizationPenalty != nil { - lb.BackendUtilization.ErrorUtilizationPenalty = ptr.To(*bu.ErrorUtilizationPenalty) + if backendUtilization.ErrorUtilizationPenalty != nil { + lb.BackendUtilization.ErrorUtilizationPenalty = ptr.To(*backendUtilization.ErrorUtilizationPenalty) } - if len(bu.MetricNamesForComputingUtilization) > 0 { - lb.BackendUtilization.MetricNamesForComputingUtilization = append([]string(nil), bu.MetricNamesForComputingUtilization...) + if len(backendUtilization.MetricNamesForComputingUtilization) > 0 { + lb.BackendUtilization.MetricNamesForComputingUtilization = append([]string(nil), backendUtilization.MetricNamesForComputingUtilization...) } } if policy.LoadBalancer.SlowStart != nil && policy.LoadBalancer.SlowStart.Window != nil { diff --git a/test/e2e/testdata/load_balancing_backend_utilization.yaml b/test/e2e/testdata/load_balancing_backend_utilization.yaml index 33bece851f..3cb06165ca 100644 --- a/test/e2e/testdata/load_balancing_backend_utilization.yaml +++ b/test/e2e/testdata/load_balancing_backend_utilization.yaml @@ -1,11 +1,11 @@ apiVersion: v1 kind: Service metadata: - name: lb-backend-bu + name: lb-backend-utilization namespace: gateway-conformance-infra spec: selector: - app: lb-backend-bu + app: lb-backend-utilization ports: - protocol: TCP port: 8080 @@ -14,19 +14,19 @@ spec: apiVersion: apps/v1 kind: Deployment metadata: - name: lb-backend-bu + name: lb-backend-utilization namespace: gateway-conformance-infra labels: - app: lb-backend-bu + app: lb-backend-utilization spec: replicas: 3 selector: matchLabels: - app: lb-backend-bu + app: lb-backend-utilization template: metadata: labels: - app: lb-backend-bu + app: lb-backend-utilization spec: containers: - name: backend @@ -42,7 +42,7 @@ spec: fieldRef: fieldPath: metadata.namespace - name: SERVICE_NAME - value: lb-backend-bu + value: lb-backend-utilization resources: requests: cpu: 10m @@ -50,13 +50,13 @@ spec: apiVersion: gateway.envoyproxy.io/v1alpha1 kind: BackendTrafficPolicy metadata: - name: client-side-wrr-lb-policy + name: backend-utilization-lb-policy namespace: gateway-conformance-infra spec: targetRefs: - group: gateway.networking.k8s.io kind: HTTPRoute - name: client-side-wrr-lb-route + name: backend-utilization-lb-route loadBalancer: type: BackendUtilization backendUtilization: @@ -69,7 +69,7 @@ spec: apiVersion: gateway.networking.k8s.io/v1 kind: HTTPRoute metadata: - name: client-side-wrr-lb-route + name: backend-utilization-lb-route namespace: gateway-conformance-infra spec: parentRefs: @@ -78,7 +78,7 @@ spec: - matches: - path: type: PathPrefix - value: /bu + value: /backend-utilization backendRefs: - - name: lb-backend-bu + - name: lb-backend-utilization port: 8080 diff --git a/test/e2e/tests/load_balancing.go b/test/e2e/tests/load_balancing.go index 40ff7c8614..43d7ae2bc6 100644 --- a/test/e2e/tests/load_balancing.go +++ b/test/e2e/tests/load_balancing.go @@ -71,14 +71,14 @@ var BackendUtilizationLoadBalancingTest = suite.ConformanceTest{ Name: gwapiv1.ObjectName(gwNN.Name), } BackendTrafficPolicyMustBeAccepted(t, suite.Client, types.NamespacedName{Name: "backend-utilization-lb-policy", Namespace: ns}, suite.ControllerName, ancestorRef) - WaitForPods(t, suite.Client, ns, map[string]string{"app": "lb-backend-bu"}, corev1.PodRunning, &PodReady) + WaitForPods(t, suite.Client, ns, map[string]string{"app": "lb-backend-utilization"}, corev1.PodRunning, &PodReady) gwAddr := kubernetes.GatewayAndRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN), &gwapiv1.HTTPRoute{}, false, routeNN) t.Run("traffic should be split roughly evenly (defaults to equal weights without ORCA)", func(t *testing.T) { expectedResponse := http.ExpectedResponse{ Request: http.Request{ - Path: "/bu", + Path: "/backend-utilization", }, Response: http.Response{ StatusCodes: []int{200}, diff --git a/test/fuzz/testdata/FuzzGatewayAPIToXDS/traffic_policy b/test/fuzz/testdata/FuzzGatewayAPIToXDS/traffic_policy index 8f0c50225e..ddebdd1a97 100644 --- a/test/fuzz/testdata/FuzzGatewayAPIToXDS/traffic_policy +++ b/test/fuzz/testdata/FuzzGatewayAPIToXDS/traffic_policy @@ -49,13 +49,13 @@ spec: apiVersion: gateway.envoyproxy.io/v1alpha1 kind: BackendTrafficPolicy metadata: - name: bu-lb-policy + name: backend-utilization-lb-policy namespace: gateway-conformance-infra spec: targetRefs: - group: gateway.networking.k8s.io kind: HTTPRoute - name: bu-lb-route + name: backend-utilization-lb-route loadBalancer: type: BackendUtilization backendUtilization: From 37852641e22e9e55d5547ce5526b4ed28f5da55e Mon Sep 17 00:00:00 2001 From: "anurag.ag" Date: Wed, 21 Jan 2026 18:27:17 +0530 Subject: [PATCH 13/23] Remove: Delete obsolete BackendUtilization OOB and penalty load balancing tests. Signed-off-by: anurag.ag --- test/e2e/tests/load_balancing.go | 114 ------------------------------- 1 file changed, 114 deletions(-) diff --git a/test/e2e/tests/load_balancing.go b/test/e2e/tests/load_balancing.go index 43d7ae2bc6..a54943175e 100644 --- a/test/e2e/tests/load_balancing.go +++ b/test/e2e/tests/load_balancing.go @@ -710,117 +710,3 @@ var EndpointOverrideLoadBalancingTest = suite.ConformanceTest{ }) }, } - -var BackendUtilizationOOBLoadBalancingTest = suite.ConformanceTest{ - ShortName: "BackendUtilizationOOBLoadBalancing", - Description: "Test for backend utilization with OOB enabled", - Manifests: []string{"testdata/load_balancing_backend_utilization.yaml"}, - Test: func(t *testing.T, suite *suite.ConformanceTestSuite) { - const ( - sendRequests = 90 - replicas = 3 - offset = 6 - ) - - ns := "gateway-conformance-infra" - routeNN := types.NamespacedName{Name: "backend-utilization-lb-route-oob", Namespace: ns} - gwNN := types.NamespacedName{Name: "same-namespace", Namespace: ns} - - ancestorRef := gwapiv1.ParentReference{ - Group: gatewayapi.GroupPtr(gwapiv1.GroupName), - Kind: gatewayapi.KindPtr(resource.KindGateway), - Namespace: gatewayapi.NamespacePtr(gwNN.Namespace), - Name: gwapiv1.ObjectName(gwNN.Name), - } - BackendTrafficPolicyMustBeAccepted(t, suite.Client, types.NamespacedName{Name: "backend-utilization-lb-policy-oob", Namespace: ns}, suite.ControllerName, ancestorRef) - WaitForPods(t, suite.Client, ns, map[string]string{"app": "lb-backend-bu-oob"}, corev1.PodRunning, &PodReady) - - gwAddr := kubernetes.GatewayAndRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN), &gwapiv1.HTTPRoute{}, false, routeNN) - - t.Run("traffic should be roughly even with OOB enabled (no ORCA signals)", func(t *testing.T) { - expectedResponse := http.ExpectedResponse{ - Request: http.Request{ - Path: "/buoob", - }, - Response: http.Response{ - StatusCodes: []int{200}, - }, - Namespace: ns, - } - req := http.MakeRequest(t, &expectedResponse, gwAddr, "HTTP", "http") - - compareFunc := func(trafficMap map[string]int) bool { - even := sendRequests / replicas - for _, count := range trafficMap { - if !AlmostEquals(count, even, offset) { - return false - } - } - return true - } - - if err := wait.PollUntilContextTimeout(context.TODO(), time.Second, 30*time.Second, true, func(_ context.Context) (bool, error) { - return runTrafficTest(t, suite, &req, &expectedResponse, sendRequests, compareFunc), nil - }); err != nil { - tlog.Errorf(t, "failed to run backend utilization OOB test: %v", err) - } - }) - }, -} - -var BackendUtilizationPenaltyLoadBalancingTest = suite.ConformanceTest{ - ShortName: "BackendUtilizationPenaltyLoadBalancing", - Description: "Test for backend utilization with error penalty", - Manifests: []string{"testdata/load_balancing_backend_utilization.yaml"}, - Test: func(t *testing.T, suite *suite.ConformanceTestSuite) { - const ( - sendRequests = 90 - replicas = 3 - offset = 6 - ) - - ns := "gateway-conformance-infra" - routeNN := types.NamespacedName{Name: "backend-utilization-lb-route-penalty", Namespace: ns} - gwNN := types.NamespacedName{Name: "same-namespace", Namespace: ns} - - ancestorRef := gwapiv1.ParentReference{ - Group: gatewayapi.GroupPtr(gwapiv1.GroupName), - Kind: gatewayapi.KindPtr(resource.KindGateway), - Namespace: gatewayapi.NamespacePtr(gwNN.Namespace), - Name: gwapiv1.ObjectName(gwNN.Name), - } - BackendTrafficPolicyMustBeAccepted(t, suite.Client, types.NamespacedName{Name: "backend-utilization-lb-policy-penalty", Namespace: ns}, suite.ControllerName, ancestorRef) - WaitForPods(t, suite.Client, ns, map[string]string{"app": "lb-backend-bu-penalty"}, corev1.PodRunning, &PodReady) - - gwAddr := kubernetes.GatewayAndRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN), &gwapiv1.HTTPRoute{}, false, routeNN) - - t.Run("traffic should be roughly even without ORCA, even with penalty configured", func(t *testing.T) { - expectedResponse := http.ExpectedResponse{ - Request: http.Request{ - Path: "/bupenalty", - }, - Response: http.Response{ - StatusCodes: []int{200}, - }, - Namespace: ns, - } - req := http.MakeRequest(t, &expectedResponse, gwAddr, "HTTP", "http") - - compareFunc := func(trafficMap map[string]int) bool { - even := sendRequests / replicas - for _, count := range trafficMap { - if !AlmostEquals(count, even, offset) { - return false - } - } - return true - } - - if err := wait.PollUntilContextTimeout(context.TODO(), time.Second, 30*time.Second, true, func(_ context.Context) (bool, error) { - return runTrafficTest(t, suite, &req, &expectedResponse, sendRequests, compareFunc), nil - }); err != nil { - tlog.Errorf(t, "failed to run backend utilization penalty test: %v", err) - } - }) - }, -} From 7d7528f2320177ee3ca3238a36ad79bda290c5bf Mon Sep 17 00:00:00 2001 From: "anurag.ag" Date: Thu, 29 Jan 2026 05:37:05 +0530 Subject: [PATCH 14/23] Update: Add detailed documentation and configuration examples for Backend Utilization (ORCA) load balancing in Gateway CRDs and related docs. Refine header handling and metric formats. Signed-off-by: anurag.ag --- api/v1alpha1/loadbalancer_types.go | 13 +++++ site/content/en/latest/api/extension_types.md | 13 +++++ .../en/latest/concepts/load-balancing.md | 51 ++++++++++++++++++- 3 files changed, 76 insertions(+), 1 deletion(-) diff --git a/api/v1alpha1/loadbalancer_types.go b/api/v1alpha1/loadbalancer_types.go index b162e301df..40ca2d6009 100644 --- a/api/v1alpha1/loadbalancer_types.go +++ b/api/v1alpha1/loadbalancer_types.go @@ -159,7 +159,20 @@ type Cookie struct { } // BackendUtilization defines configuration for Envoy's Backend Utilization policy. +// It uses Open Resource Cost Application (ORCA) load metrics reported by endpoints to make load balancing decisions. +// These metrics are typically sent by the backend service in response headers or trailers. +// +// The backend should report these metrics in header/trailer as one of the following formats: +// - Binary: `endpoint-load-metrics-bin` with base64-encoded serialized `OrcaLoadReport` proto. +// - JSON: `endpoint-load-metrics` with JSON-encoded `OrcaLoadReport` proto, e.g., `JSON {"cpu_utilization": 0.3}`. +// - TEXT: `endpoint-load-metrics` with comma-separated key-value pairs, e.g., `TEXT cpu=0.3,mem=0.8`. +// +// By default, Envoy will forward these ORCA response headers/trailers from the upstream service to the downstream client. +// If the downstream client also uses this information for load balancing, it might lead to unexpected behavior. +// To avoid this, you can use the `HTTPRoute` or `BackendTrafficPolicy` to remove the load report headers before sending the response to the client. +// // See Envoy proto: envoy.extensions.load_balancing_policies.client_side_weighted_round_robin.v3.ClientSideWeightedRoundRobin +// See ORCA Load Report proto: xds.data.orca.v3.orca_load_report.proto type BackendUtilization struct { // A given endpoint must report load metrics continuously for at least this long before the endpoint weight will be used. // Default is 10s. diff --git a/site/content/en/latest/api/extension_types.md b/site/content/en/latest/api/extension_types.md index f503c556be..e73d351e5a 100644 --- a/site/content/en/latest/api/extension_types.md +++ b/site/content/en/latest/api/extension_types.md @@ -570,7 +570,20 @@ _Appears in:_ BackendUtilization defines configuration for Envoy's Backend Utilization policy. +It uses Open Resource Cost Application (ORCA) load metrics reported by endpoints to make load balancing decisions. +These metrics are typically sent by the backend service in response headers or trailers. + +The backend should report these metrics in header/trailer as one of the following formats: +- Binary: `endpoint-load-metrics-bin` with base64-encoded serialized `OrcaLoadReport` proto. +- JSON: `endpoint-load-metrics` with JSON-encoded `OrcaLoadReport` proto, e.g., `JSON {"cpu_utilization": 0.3}`. +- TEXT: `endpoint-load-metrics` with comma-separated key-value pairs, e.g., `TEXT cpu=0.3,mem=0.8`. + +By default, Envoy will forward these ORCA response headers/trailers from the upstream service to the downstream client. +If the downstream client also uses this information for load balancing, it might lead to unexpected behavior. +To avoid this, you can use the `HTTPRoute` or `BackendTrafficPolicy` to remove the load report headers before sending the response to the client. + See Envoy proto: envoy.extensions.load_balancing_policies.client_side_weighted_round_robin.v3.ClientSideWeightedRoundRobin +See ORCA Load Report proto: xds.data.orca.v3.orca_load_report.proto _Appears in:_ - [LoadBalancer](#loadbalancer) diff --git a/site/content/en/latest/concepts/load-balancing.md b/site/content/en/latest/concepts/load-balancing.md index 81fb4133df..db6e6c4722 100644 --- a/site/content/en/latest/concepts/load-balancing.md +++ b/site/content/en/latest/concepts/load-balancing.md @@ -23,7 +23,7 @@ Envoy Gateway supports several load balancing strategies that determine how traf - **Random** – Chooses a backend at random to balance load - **Least Request** – Sends the request to the backend with the fewest active requests (this is the default) - **Consistent Hash** – Routes requests based on a hash (e.g., client IP or header), which helps keep repeat requests going to the same backend (useful for session affinity) -- **Backend Utilization** – Uses client-observed load reports (e.g., ORCA metrics) to dynamically weight endpoints; if no metrics are available, it behaves similar to even-weight round robin +- **Backend Utilization** – Uses client-observed load reports (e.g., Open Resource Cost Aggregation (ORCA) metrics) to dynamically weight endpoints; if no metrics are available, it behaves similar to even-weight round-robin. If no load balancing strategy is specified, Envoy Gateway uses **Least Request** by default. @@ -66,6 +66,55 @@ spec: ``` In this setup, traffic matching /round is distributed evenly across all available backend service instances. For example, if there are four replicas of the backend service, each one should receive roughly 25% of the requests. +## Backend Utilization (ORCA) + +Backend Utilization load balancing uses Open Resource Cost Application (ORCA) metrics to make load balancing decisions. These metrics are reported by the backend service in response headers or trailers. + +### ORCA Load Metrics + +The backend service (or its sidecar) reports load metrics in response headers or trailers (for streaming requests). ORCA supports multiple formats for these metrics: + +- **JSON**: Use the `endpoint-load-metrics` header with a JSON object. + ```http + endpoint-load-metrics: JSON {"cpu_utilization": 0.3, "mem_utilization": 0.8} + ``` +- **TEXT**: Use the `endpoint-load-metrics` header with comma-separated key-value pairs. + ```http + endpoint-load-metrics: TEXT cpu=0.3,mem=0.8,foo_bytes=123 + ``` +- **Binary Proto**: Use the `endpoint-load-metrics-bin` header with a base64-encoded serialized `OrcaLoadReport` proto. + ```http + endpoint-load-metrics-bin: Cg4KCHNvbWUta2V5Eg0AAAAAAADwPw== + ``` + +For more details, see: +- [ORCA Load Report Proto](https://www.envoyproxy.io/docs/envoy/latest/xds/data/orca/v3/orca_load_report.proto) +- [ORCA Design Document](https://docs.google.com/document/d/1NSnK3346BkBo1JUU3I9I5NYYnaJZQPt8_Z_XCBCI3uA) + +### Automatic Header Forwarding + +By default, Envoy forwards the ORCA response headers/trailers from the upstream cluster to the downstream client. This means that if the downstream client is also configured to use client-side weighted round-robin, it will load balance against Envoy based on upstream weights. + +To avoid this, you can configure an `HTTPRoute` or `BackendTrafficPolicy` to remove the ORCA headers before they reach the client. + +Example of removing the ORCA headers using `HTTPRoute`: + +```yaml +apiVersion: gateway.networking.k8s.io/v1 +kind: HTTPRoute +metadata: + name: backend-utilization-route +spec: + rules: + - filters: + - type: ResponseHeaderModifier + responseHeaderModifier: + remove: ["endpoint-load-metrics", "endpoint-load-metrics-bin"] + backendRefs: + - name: backend + port: 3000 +``` + ## Related Resources - [BackendTrafficPolicy](gateway_api_extensions/backend-traffic-policy.md) - [Task: Load Balancing](../tasks/traffic/load-balancing.md) From c3e06cb2d70eb27757990e28f623148319d992dd Mon Sep 17 00:00:00 2001 From: "anurag.ag" <6075379+altaiezior@users.noreply.github.com> Date: Tue, 3 Feb 2026 04:19:00 +0530 Subject: [PATCH 15/23] Update: Rename `ErrorUtilizationPenalty` to `ErrorUtilizationPenaltyPercent` across API, tests, and internal logic for clarity and precision. Adjust related documentation and validations. Signed-off-by: anurag.ag <6075379+altaiezior@users.noreply.github.com> --- api/v1alpha1/loadbalancer_types.go | 4 +- api/v1alpha1/zz_generated.deepcopy.go | 4 +- ....envoyproxy.io_backendtrafficpolicies.yaml | 4 +- ....envoyproxy.io_envoyextensionpolicies.yaml | 4 +- .../gateway.envoyproxy.io_envoyproxies.yaml | 16 ++++---- ...ateway.envoyproxy.io_securitypolicies.yaml | 16 ++++---- ....envoyproxy.io_backendtrafficpolicies.yaml | 4 +- ....envoyproxy.io_envoyextensionpolicies.yaml | 4 +- .../gateway.envoyproxy.io_envoyproxies.yaml | 16 ++++---- ...ateway.envoyproxy.io_securitypolicies.yaml | 16 ++++---- internal/gatewayapi/clustersettings.go | 5 ++- ...clustersettings_backendutilization_test.go | 6 +-- ...endtrafficpolicy-with-loadbalancer.in.yaml | 2 +- ...ndtrafficpolicy-with-loadbalancer.out.yaml | 8 +++- internal/ir/xds.go | 2 +- internal/ir/zz_generated.deepcopy.go | 4 +- internal/xds/translator/cluster.go | 4 +- .../testdata/in/xds-ir/load-balancer.yaml | 2 +- site/content/en/latest/api/extension_types.md | 2 +- .../backendtrafficpolicy_test.go | 4 +- .../FuzzGatewayAPIToXDS/traffic_policy | 2 +- test/helm/gateway-crds-helm/all.out.yaml | 40 +++++++++---------- .../envoy-gateway-crds.out.yaml | 40 +++++++++---------- 23 files changed, 107 insertions(+), 102 deletions(-) diff --git a/api/v1alpha1/loadbalancer_types.go b/api/v1alpha1/loadbalancer_types.go index 40ca2d6009..8d03b6cff6 100644 --- a/api/v1alpha1/loadbalancer_types.go +++ b/api/v1alpha1/loadbalancer_types.go @@ -187,7 +187,7 @@ type BackendUtilization struct { // +optional WeightUpdatePeriod *gwapiv1.Duration `json:"weightUpdatePeriod,omitempty"` - // ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + // ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). // This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. // // For example: @@ -201,7 +201,7 @@ type BackendUtilization struct { // Must be non-negative. // +kubebuilder:validation:Minimum=0 // +optional - ErrorUtilizationPenalty *uint32 `json:"errorUtilizationPenalty,omitempty"` + ErrorUtilizationPenaltyPercent *uint32 `json:"errorUtilizationPenaltyPercent,omitempty"` // Metric names used to compute utilization if application_utilization is not set. // For map fields in ORCA proto, use the form ".", e.g., "named_metrics.foo". diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index 4117c7542e..4878e8bedf 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -827,8 +827,8 @@ func (in *BackendUtilization) DeepCopyInto(out *BackendUtilization) { *out = new(v1.Duration) **out = **in } - if in.ErrorUtilizationPenalty != nil { - in, out := &in.ErrorUtilizationPenalty, &out.ErrorUtilizationPenalty + if in.ErrorUtilizationPenaltyPercent != nil { + in, out := &in.ErrorUtilizationPenaltyPercent, &out.ErrorUtilizationPenaltyPercent *out = new(uint32) **out = **in } diff --git a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml index 95041b1118..500bd4d7fc 100644 --- a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml +++ b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml @@ -717,9 +717,9 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - errorUtilizationPenalty: + errorUtilizationPenaltyPercent: description: |- - ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. For example: diff --git a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml index 1718c88e7a..4503fafdb4 100644 --- a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml +++ b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml @@ -747,9 +747,9 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - errorUtilizationPenalty: + errorUtilizationPenaltyPercent: description: |- - ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. For example: diff --git a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyproxies.yaml b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyproxies.yaml index 3656de72da..2bd147bbd9 100644 --- a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyproxies.yaml +++ b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyproxies.yaml @@ -11818,9 +11818,9 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - errorUtilizationPenalty: + errorUtilizationPenaltyPercent: description: |- - ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. For example: @@ -13129,9 +13129,9 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - errorUtilizationPenalty: + errorUtilizationPenaltyPercent: description: |- - ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. For example: @@ -14596,9 +14596,9 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - errorUtilizationPenalty: + errorUtilizationPenaltyPercent: description: |- - ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. For example: @@ -15979,9 +15979,9 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - errorUtilizationPenalty: + errorUtilizationPenaltyPercent: description: |- - ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. For example: diff --git a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_securitypolicies.yaml b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_securitypolicies.yaml index daddd5b620..f6b09185a8 100644 --- a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_securitypolicies.yaml +++ b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_securitypolicies.yaml @@ -1367,9 +1367,9 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - errorUtilizationPenalty: + errorUtilizationPenaltyPercent: description: |- - ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. For example: @@ -2561,9 +2561,9 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - errorUtilizationPenalty: + errorUtilizationPenaltyPercent: description: |- - ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. For example: @@ -3966,9 +3966,9 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - errorUtilizationPenalty: + errorUtilizationPenaltyPercent: description: |- - ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. For example: @@ -5431,9 +5431,9 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - errorUtilizationPenalty: + errorUtilizationPenaltyPercent: description: |- - ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. For example: diff --git a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml index 6d756d8dbe..dea343f2ae 100644 --- a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml +++ b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml @@ -716,9 +716,9 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - errorUtilizationPenalty: + errorUtilizationPenaltyPercent: description: |- - ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. For example: diff --git a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml index eb1df174ff..10dc1ea100 100644 --- a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml +++ b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml @@ -746,9 +746,9 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - errorUtilizationPenalty: + errorUtilizationPenaltyPercent: description: |- - ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. For example: diff --git a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyproxies.yaml b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyproxies.yaml index c3fee8db5a..ca6fdfadf4 100644 --- a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyproxies.yaml +++ b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyproxies.yaml @@ -11817,9 +11817,9 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - errorUtilizationPenalty: + errorUtilizationPenaltyPercent: description: |- - ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. For example: @@ -13128,9 +13128,9 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - errorUtilizationPenalty: + errorUtilizationPenaltyPercent: description: |- - ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. For example: @@ -14595,9 +14595,9 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - errorUtilizationPenalty: + errorUtilizationPenaltyPercent: description: |- - ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. For example: @@ -15978,9 +15978,9 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - errorUtilizationPenalty: + errorUtilizationPenaltyPercent: description: |- - ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. For example: diff --git a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_securitypolicies.yaml b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_securitypolicies.yaml index 187bd4a9aa..acb0d8c8ae 100644 --- a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_securitypolicies.yaml +++ b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_securitypolicies.yaml @@ -1366,9 +1366,9 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - errorUtilizationPenalty: + errorUtilizationPenaltyPercent: description: |- - ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. For example: @@ -2560,9 +2560,9 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - errorUtilizationPenalty: + errorUtilizationPenaltyPercent: description: |- - ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. For example: @@ -3965,9 +3965,9 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - errorUtilizationPenalty: + errorUtilizationPenaltyPercent: description: |- - ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. For example: @@ -5430,9 +5430,9 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - errorUtilizationPenalty: + errorUtilizationPenaltyPercent: description: |- - ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. For example: diff --git a/internal/gatewayapi/clustersettings.go b/internal/gatewayapi/clustersettings.go index 93d7757602..adb7d000a1 100644 --- a/internal/gatewayapi/clustersettings.go +++ b/internal/gatewayapi/clustersettings.go @@ -362,12 +362,13 @@ func buildLoadBalancer(policy *egv1a1.ClusterSettings) (*ir.LoadBalancer, error) lb.BackendUtilization.WeightUpdatePeriod = ir.MetaV1DurationPtr(d) } } - if backendUtilization.ErrorUtilizationPenalty != nil { - lb.BackendUtilization.ErrorUtilizationPenalty = ptr.To(*backendUtilization.ErrorUtilizationPenalty) + if backendUtilization.ErrorUtilizationPenaltyPercent != nil { + lb.BackendUtilization.ErrorUtilizationPenaltyPercent = ptr.To(*backendUtilization.ErrorUtilizationPenaltyPercent) } if len(backendUtilization.MetricNamesForComputingUtilization) > 0 { lb.BackendUtilization.MetricNamesForComputingUtilization = append([]string(nil), backendUtilization.MetricNamesForComputingUtilization...) } + lb.BackendUtilization.RemoveResponseHeaders = ptr.To(ptr.Deref(backendUtilization.RemoveResponseHeaders, true)) } if policy.LoadBalancer.SlowStart != nil && policy.LoadBalancer.SlowStart.Window != nil { d, err := time.ParseDuration(string(*policy.LoadBalancer.SlowStart.Window)) diff --git a/internal/gatewayapi/clustersettings_backendutilization_test.go b/internal/gatewayapi/clustersettings_backendutilization_test.go index b5e069e6e1..bd4b40b82f 100644 --- a/internal/gatewayapi/clustersettings_backendutilization_test.go +++ b/internal/gatewayapi/clustersettings_backendutilization_test.go @@ -22,7 +22,7 @@ func TestBuildLoadBalancer_BackendUtilization(t *testing.T) { BlackoutPeriod: ptr.To(gwapiv1.Duration("10s")), WeightExpirationPeriod: ptr.To(gwapiv1.Duration("3m")), WeightUpdatePeriod: ptr.To(gwapiv1.Duration("1s")), - ErrorUtilizationPenalty: ptr.To[uint32](150), + ErrorUtilizationPenaltyPercent: ptr.To[uint32](150), MetricNamesForComputingUtilization: []string{"named_metrics.foo", "cpu_utilization"}, } @@ -42,7 +42,7 @@ func TestBuildLoadBalancer_BackendUtilization(t *testing.T) { require.Equal(t, ir.MetaV1DurationPtr(10*time.Second), got.BlackoutPeriod) require.Equal(t, ir.MetaV1DurationPtr(3*time.Minute), got.WeightExpirationPeriod) require.Equal(t, ir.MetaV1DurationPtr(1*time.Second), got.WeightUpdatePeriod) - require.NotNil(t, got.ErrorUtilizationPenalty) - require.EqualValues(t, 150, *got.ErrorUtilizationPenalty) + require.NotNil(t, got.ErrorUtilizationPenaltyPercent) + require.EqualValues(t, 150, *got.ErrorUtilizationPenaltyPercent) require.Equal(t, []string{"named_metrics.foo", "cpu_utilization"}, got.MetricNamesForComputingUtilization) } diff --git a/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer.in.yaml b/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer.in.yaml index c9d24baf25..56b54f786d 100644 --- a/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer.in.yaml +++ b/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer.in.yaml @@ -250,6 +250,6 @@ backendTrafficPolicies: blackoutPeriod: 10s weightExpirationPeriod: 60s weightUpdatePeriod: 10s - errorUtilizationPenalty: 100 + errorUtilizationPenaltyPercent: 100 metricNamesForComputingUtilization: - "cpu_utilization" diff --git a/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer.out.yaml b/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer.out.yaml index 514cc92636..0d27bf71ab 100644 --- a/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer.out.yaml +++ b/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer.out.yaml @@ -149,7 +149,7 @@ backendTrafficPolicies: loadBalancer: backendUtilization: blackoutPeriod: 10s - errorUtilizationPenalty: 100 + errorUtilizationPenaltyPercent: 100 metricNamesForComputingUtilization: - cpu_utilization weightExpirationPeriod: 60s @@ -869,13 +869,17 @@ xdsIR: distinct: false name: "" prefix: /test5 + removeResponseHeaders: + - endpoint-load-metrics + - endpoint-load-metrics-bin traffic: loadBalancer: backendUtilization: blackoutPeriod: 10s - errorUtilizationPenalty: 100 + errorUtilizationPenaltyPercent: 100 metricNamesForComputingUtilization: - cpu_utilization + removeResponseHeaders: true slowStart: window: 5m0s weightExpirationPeriod: 1m0s diff --git a/internal/ir/xds.go b/internal/ir/xds.go index 149906a9c8..1bcb6af1b9 100644 --- a/internal/ir/xds.go +++ b/internal/ir/xds.go @@ -2775,7 +2775,7 @@ type BackendUtilization struct { BlackoutPeriod *metav1.Duration `json:"blackoutPeriod,omitempty" yaml:"blackoutPeriod,omitempty"` WeightExpirationPeriod *metav1.Duration `json:"weightExpirationPeriod,omitempty" yaml:"weightExpirationPeriod,omitempty"` WeightUpdatePeriod *metav1.Duration `json:"weightUpdatePeriod,omitempty" yaml:"weightUpdatePeriod,omitempty"` - ErrorUtilizationPenalty *uint32 `json:"errorUtilizationPenalty,omitempty" yaml:"errorUtilizationPenalty,omitempty"` + ErrorUtilizationPenaltyPercent *uint32 `json:"errorUtilizationPenaltyPercent,omitempty" yaml:"errorUtilizationPenaltyPercent,omitempty"` MetricNamesForComputingUtilization []string `json:"metricNamesForComputingUtilization,omitempty" yaml:"metricNamesForComputingUtilization,omitempty"` SlowStart *SlowStart `json:"slowStart,omitempty" yaml:"slowStart,omitempty"` } diff --git a/internal/ir/zz_generated.deepcopy.go b/internal/ir/zz_generated.deepcopy.go index d5a2b3a17c..d2dc777994 100644 --- a/internal/ir/zz_generated.deepcopy.go +++ b/internal/ir/zz_generated.deepcopy.go @@ -491,8 +491,8 @@ func (in *BackendUtilization) DeepCopyInto(out *BackendUtilization) { *out = new(metav1.Duration) **out = **in } - if in.ErrorUtilizationPenalty != nil { - in, out := &in.ErrorUtilizationPenalty, &out.ErrorUtilizationPenalty + if in.ErrorUtilizationPenaltyPercent != nil { + in, out := &in.ErrorUtilizationPenaltyPercent, &out.ErrorUtilizationPenaltyPercent *out = new(uint32) **out = **in } diff --git a/internal/xds/translator/cluster.go b/internal/xds/translator/cluster.go index aa99de6a48..1c5d3f109d 100644 --- a/internal/xds/translator/cluster.go +++ b/internal/xds/translator/cluster.go @@ -456,8 +456,8 @@ func buildXdsCluster(args *xdsClusterArgs) (*buildClusterResult, error) { SlowStartWindow: durationpb.New(v.SlowStart.Window.Duration), } } - if v.ErrorUtilizationPenalty != nil { - cswrr.ErrorUtilizationPenalty = wrapperspb.Float(float32(*v.ErrorUtilizationPenalty) / 100.0) + if v.ErrorUtilizationPenaltyPercent != nil { + cswrr.ErrorUtilizationPenalty = wrapperspb.Float(float32(*v.ErrorUtilizationPenaltyPercent) / 100.0) } if len(v.MetricNamesForComputingUtilization) > 0 { cswrr.MetricNamesForComputingUtilization = append([]string(nil), v.MetricNamesForComputingUtilization...) diff --git a/internal/xds/translator/testdata/in/xds-ir/load-balancer.yaml b/internal/xds/translator/testdata/in/xds-ir/load-balancer.yaml index 7cf50724ac..c59f30a804 100644 --- a/internal/xds/translator/testdata/in/xds-ir/load-balancer.yaml +++ b/internal/xds/translator/testdata/in/xds-ir/load-balancer.yaml @@ -227,7 +227,7 @@ http: weightUpdatePeriod: 10s slowStart: window: 45s - errorUtilizationPenalty: 100 + errorUtilizationPenaltyPercent: 100 metricNamesForComputingUtilization: - "cpu_utilization" destination: diff --git a/site/content/en/latest/api/extension_types.md b/site/content/en/latest/api/extension_types.md index 9014adeed1..146d197621 100644 --- a/site/content/en/latest/api/extension_types.md +++ b/site/content/en/latest/api/extension_types.md @@ -593,7 +593,7 @@ _Appears in:_ | `blackoutPeriod` | _[Duration](https://gateway-api.sigs.k8s.io/reference/1.4/spec/#duration)_ | false | | A given endpoint must report load metrics continuously for at least this long before the endpoint weight will be used.
Default is 10s. | | `weightExpirationPeriod` | _[Duration](https://gateway-api.sigs.k8s.io/reference/1.4/spec/#duration)_ | false | | If a given endpoint has not reported load metrics in this long, stop using the reported weight. Defaults to 3m. | | `weightUpdatePeriod` | _[Duration](https://gateway-api.sigs.k8s.io/reference/1.4/spec/#duration)_ | false | | How often endpoint weights are recalculated. Values less than 100ms are capped at 100ms. Default 1s. | -| `errorUtilizationPenalty` | _integer_ | false | | ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps).
This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc.
For example:
- 100 => 1.0x
- 120 => 1.2x
- 200 => 2.0x
Note: In the internal IR/XDS configuration this value is converted back to a
floating point multiplier (value / 100.0).
Must be non-negative. | +| `errorUtilizationPenaltyPercent` | _integer_ | false | | ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps).
This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc.
For example:
- 100 => 1.0x
- 120 => 1.2x
- 200 => 2.0x
Note: In the internal IR/XDS configuration this value is converted back to a
floating point multiplier (value / 100.0).
Must be non-negative. | | `metricNamesForComputingUtilization` | _string array_ | false | | Metric names used to compute utilization if application_utilization is not set.
For map fields in ORCA proto, use the form ".", e.g., "named_metrics.foo". | diff --git a/test/cel-validation/backendtrafficpolicy_test.go b/test/cel-validation/backendtrafficpolicy_test.go index 014c48e717..e6fa2972d4 100644 --- a/test/cel-validation/backendtrafficpolicy_test.go +++ b/test/cel-validation/backendtrafficpolicy_test.go @@ -548,7 +548,7 @@ func TestBackendTrafficPolicyTarget(t *testing.T) { BlackoutPeriod: ptr.To(gwapiv1.Duration("10s")), WeightUpdatePeriod: ptr.To(gwapiv1.Duration("10s")), WeightExpirationPeriod: ptr.To(gwapiv1.Duration("10s")), - ErrorUtilizationPenalty: ptr.To[uint32](50), + ErrorUtilizationPenaltyPercent: ptr.To[uint32](50), MetricNamesForComputingUtilization: []string{"metric1", "metric2"}, }, }, @@ -649,7 +649,7 @@ func TestBackendTrafficPolicyTarget(t *testing.T) { ClusterSettings: egv1a1.ClusterSettings{ LoadBalancer: &egv1a1.LoadBalancer{ Type: egv1a1.BackendUtilizationLoadBalancerType, - BackendUtilization: &egv1a1.BackendUtilization{ErrorUtilizationPenalty: ptr.To[uint32](0)}, + BackendUtilization: &egv1a1.BackendUtilization{ErrorUtilizationPenaltyPercent: ptr.To[uint32](0)}, }, }, } diff --git a/test/fuzz/testdata/FuzzGatewayAPIToXDS/traffic_policy b/test/fuzz/testdata/FuzzGatewayAPIToXDS/traffic_policy index ddebdd1a97..81d2efa57e 100644 --- a/test/fuzz/testdata/FuzzGatewayAPIToXDS/traffic_policy +++ b/test/fuzz/testdata/FuzzGatewayAPIToXDS/traffic_policy @@ -59,4 +59,4 @@ spec: loadBalancer: type: BackendUtilization backendUtilization: - errorUtilizationPenalty: 120 + errorUtilizationPenaltyPercent: 120 diff --git a/test/helm/gateway-crds-helm/all.out.yaml b/test/helm/gateway-crds-helm/all.out.yaml index 4109807c29..f3655981a4 100644 --- a/test/helm/gateway-crds-helm/all.out.yaml +++ b/test/helm/gateway-crds-helm/all.out.yaml @@ -22014,9 +22014,9 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - errorUtilizationPenalty: + errorUtilizationPenaltyPercent: description: |- - ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. For example: @@ -26986,9 +26986,9 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - errorUtilizationPenalty: + errorUtilizationPenaltyPercent: description: |- - ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. For example: @@ -40790,9 +40790,9 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - errorUtilizationPenalty: + errorUtilizationPenaltyPercent: description: |- - ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. For example: @@ -42101,9 +42101,9 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - errorUtilizationPenalty: + errorUtilizationPenaltyPercent: description: |- - ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. For example: @@ -43568,9 +43568,9 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - errorUtilizationPenalty: + errorUtilizationPenaltyPercent: description: |- - ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. For example: @@ -44951,9 +44951,9 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - errorUtilizationPenalty: + errorUtilizationPenaltyPercent: description: |- - ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. For example: @@ -47671,9 +47671,9 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - errorUtilizationPenalty: + errorUtilizationPenaltyPercent: description: |- - ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. For example: @@ -48865,9 +48865,9 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - errorUtilizationPenalty: + errorUtilizationPenaltyPercent: description: |- - ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. For example: @@ -50270,9 +50270,9 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - errorUtilizationPenalty: + errorUtilizationPenaltyPercent: description: |- - ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. For example: @@ -51735,9 +51735,9 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - errorUtilizationPenalty: + errorUtilizationPenaltyPercent: description: |- - ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. For example: diff --git a/test/helm/gateway-crds-helm/envoy-gateway-crds.out.yaml b/test/helm/gateway-crds-helm/envoy-gateway-crds.out.yaml index 7c2c2c7cf4..30cfbd94ae 100644 --- a/test/helm/gateway-crds-helm/envoy-gateway-crds.out.yaml +++ b/test/helm/gateway-crds-helm/envoy-gateway-crds.out.yaml @@ -1194,9 +1194,9 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - errorUtilizationPenalty: + errorUtilizationPenaltyPercent: description: |- - ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. For example: @@ -6166,9 +6166,9 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - errorUtilizationPenalty: + errorUtilizationPenaltyPercent: description: |- - ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. For example: @@ -19970,9 +19970,9 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - errorUtilizationPenalty: + errorUtilizationPenaltyPercent: description: |- - ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. For example: @@ -21281,9 +21281,9 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - errorUtilizationPenalty: + errorUtilizationPenaltyPercent: description: |- - ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. For example: @@ -22748,9 +22748,9 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - errorUtilizationPenalty: + errorUtilizationPenaltyPercent: description: |- - ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. For example: @@ -24131,9 +24131,9 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - errorUtilizationPenalty: + errorUtilizationPenaltyPercent: description: |- - ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. For example: @@ -26851,9 +26851,9 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - errorUtilizationPenalty: + errorUtilizationPenaltyPercent: description: |- - ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. For example: @@ -28045,9 +28045,9 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - errorUtilizationPenalty: + errorUtilizationPenaltyPercent: description: |- - ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. For example: @@ -29450,9 +29450,9 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - errorUtilizationPenalty: + errorUtilizationPenaltyPercent: description: |- - ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. For example: @@ -30915,9 +30915,9 @@ spec: Default is 10s. pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ type: string - errorUtilizationPenalty: + errorUtilizationPenaltyPercent: description: |- - ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps). + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. For example: From 9c9dc2056c0e6946f3b563c8b3c46a96ea4f5be6 Mon Sep 17 00:00:00 2001 From: "anurag.ag" <6075379+altaiezior@users.noreply.github.com> Date: Tue, 3 Feb 2026 04:19:06 +0530 Subject: [PATCH 16/23] Update: Add support for `removeResponseHeaders` in `BackendUtilization`. Adjust logic, tests, and documentation to highlight default value and ORCA header removal. Signed-off-by: anurag.ag <6075379+altaiezior@users.noreply.github.com> --- api/v1alpha1/loadbalancer_types.go | 6 + api/v1alpha1/zz_generated.deepcopy.go | 5 + ....envoyproxy.io_backendtrafficpolicies.yaml | 6 + ....envoyproxy.io_envoyextensionpolicies.yaml | 6 + .../gateway.envoyproxy.io_envoyproxies.yaml | 24 ++ ...ateway.envoyproxy.io_securitypolicies.yaml | 24 ++ ....envoyproxy.io_backendtrafficpolicies.yaml | 6 + ....envoyproxy.io_envoyextensionpolicies.yaml | 6 + .../gateway.envoyproxy.io_envoyproxies.yaml | 24 ++ ...ateway.envoyproxy.io_securitypolicies.yaml | 24 ++ internal/gatewayapi/backendtrafficpolicy.go | 18 ++ ...y-with-loadbalancer-remove-headers.in.yaml | 50 ++++ ...-with-loadbalancer-remove-headers.out.yaml | 217 ++++++++++++++++++ internal/ir/xds.go | 1 + internal/ir/zz_generated.deepcopy.go | 5 + site/content/en/latest/api/extension_types.md | 1 + .../en/latest/concepts/load-balancing.md | 20 +- test/helm/gateway-crds-helm/all.out.yaml | 60 +++++ .../envoy-gateway-crds.out.yaml | 60 +++++ 19 files changed, 561 insertions(+), 2 deletions(-) create mode 100644 internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer-remove-headers.in.yaml create mode 100644 internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer-remove-headers.out.yaml diff --git a/api/v1alpha1/loadbalancer_types.go b/api/v1alpha1/loadbalancer_types.go index 8d03b6cff6..a19cd8bea7 100644 --- a/api/v1alpha1/loadbalancer_types.go +++ b/api/v1alpha1/loadbalancer_types.go @@ -207,6 +207,12 @@ type BackendUtilization struct { // For map fields in ORCA proto, use the form ".", e.g., "named_metrics.foo". // +optional MetricNamesForComputingUtilization []string `json:"metricNamesForComputingUtilization,omitempty"` + + // RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. + // Defaults to true. + // +optional + // +kubebuilder:default=true + RemoveResponseHeaders *bool `json:"removeResponseHeaders,omitempty"` } // ConsistentHashType defines the type of input to hash on. diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index 4878e8bedf..33fbf13503 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -837,6 +837,11 @@ func (in *BackendUtilization) DeepCopyInto(out *BackendUtilization) { *out = make([]string, len(*in)) copy(*out, *in) } + if in.RemoveResponseHeaders != nil { + in, out := &in.RemoveResponseHeaders, &out.RemoveResponseHeaders + *out = new(bool) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackendUtilization. diff --git a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml index 500bd4d7fc..3d2436e855 100644 --- a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml +++ b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml @@ -741,6 +741,12 @@ spec: items: type: string type: array + removeResponseHeaders: + default: true + description: |- + RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. + Defaults to true. + type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop using the reported weight. Defaults to diff --git a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml index 4503fafdb4..9d97bae4f3 100644 --- a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml +++ b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml @@ -771,6 +771,12 @@ spec: items: type: string type: array + removeResponseHeaders: + default: true + description: |- + RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. + Defaults to true. + type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop using the reported diff --git a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyproxies.yaml b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyproxies.yaml index 2bd147bbd9..7accdace26 100644 --- a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyproxies.yaml +++ b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyproxies.yaml @@ -11842,6 +11842,12 @@ spec: items: type: string type: array + removeResponseHeaders: + default: true + description: |- + RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. + Defaults to true. + type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics @@ -13153,6 +13159,12 @@ spec: items: type: string type: array + removeResponseHeaders: + default: true + description: |- + RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. + Defaults to true. + type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics @@ -14620,6 +14632,12 @@ spec: items: type: string type: array + removeResponseHeaders: + default: true + description: |- + RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. + Defaults to true. + type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this @@ -16003,6 +16021,12 @@ spec: items: type: string type: array + removeResponseHeaders: + default: true + description: |- + RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. + Defaults to true. + type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop using the diff --git a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_securitypolicies.yaml b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_securitypolicies.yaml index f6b09185a8..d7891846f3 100644 --- a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_securitypolicies.yaml +++ b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_securitypolicies.yaml @@ -1391,6 +1391,12 @@ spec: items: type: string type: array + removeResponseHeaders: + default: true + description: |- + RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. + Defaults to true. + type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop using the reported @@ -2585,6 +2591,12 @@ spec: items: type: string type: array + removeResponseHeaders: + default: true + description: |- + RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. + Defaults to true. + type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop using the reported @@ -3990,6 +4002,12 @@ spec: items: type: string type: array + removeResponseHeaders: + default: true + description: |- + RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. + Defaults to true. + type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop @@ -5455,6 +5473,12 @@ spec: items: type: string type: array + removeResponseHeaders: + default: true + description: |- + RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. + Defaults to true. + type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop using the reported diff --git a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml index dea343f2ae..9f6bda247b 100644 --- a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml +++ b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml @@ -740,6 +740,12 @@ spec: items: type: string type: array + removeResponseHeaders: + default: true + description: |- + RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. + Defaults to true. + type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop using the reported weight. Defaults to diff --git a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml index 10dc1ea100..2fb994a718 100644 --- a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml +++ b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml @@ -770,6 +770,12 @@ spec: items: type: string type: array + removeResponseHeaders: + default: true + description: |- + RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. + Defaults to true. + type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop using the reported diff --git a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyproxies.yaml b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyproxies.yaml index ca6fdfadf4..d155cc9965 100644 --- a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyproxies.yaml +++ b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyproxies.yaml @@ -11841,6 +11841,12 @@ spec: items: type: string type: array + removeResponseHeaders: + default: true + description: |- + RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. + Defaults to true. + type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics @@ -13152,6 +13158,12 @@ spec: items: type: string type: array + removeResponseHeaders: + default: true + description: |- + RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. + Defaults to true. + type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics @@ -14619,6 +14631,12 @@ spec: items: type: string type: array + removeResponseHeaders: + default: true + description: |- + RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. + Defaults to true. + type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this @@ -16002,6 +16020,12 @@ spec: items: type: string type: array + removeResponseHeaders: + default: true + description: |- + RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. + Defaults to true. + type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop using the diff --git a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_securitypolicies.yaml b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_securitypolicies.yaml index acb0d8c8ae..950fffa988 100644 --- a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_securitypolicies.yaml +++ b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_securitypolicies.yaml @@ -1390,6 +1390,12 @@ spec: items: type: string type: array + removeResponseHeaders: + default: true + description: |- + RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. + Defaults to true. + type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop using the reported @@ -2584,6 +2590,12 @@ spec: items: type: string type: array + removeResponseHeaders: + default: true + description: |- + RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. + Defaults to true. + type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop using the reported @@ -3989,6 +4001,12 @@ spec: items: type: string type: array + removeResponseHeaders: + default: true + description: |- + RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. + Defaults to true. + type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop @@ -5454,6 +5472,12 @@ spec: items: type: string type: array + removeResponseHeaders: + default: true + description: |- + RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. + Defaults to true. + type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop using the reported diff --git a/internal/gatewayapi/backendtrafficpolicy.go b/internal/gatewayapi/backendtrafficpolicy.go index 7cc3cc5ae8..cd43e26def 100644 --- a/internal/gatewayapi/backendtrafficpolicy.go +++ b/internal/gatewayapi/backendtrafficpolicy.go @@ -819,6 +819,24 @@ func (t *Translator) applyTrafficFeatureToRoute(route RouteContext, r.Traffic = tf.DeepCopy() + if r.Traffic != nil && r.Traffic.LoadBalancer != nil && + r.Traffic.LoadBalancer.BackendUtilization != nil && + ptr.Deref(r.Traffic.LoadBalancer.BackendUtilization.RemoveResponseHeaders, false) { + headersToRemove := []string{"endpoint-load-metrics", "endpoint-load-metrics-bin"} + for _, h := range headersToRemove { + found := false + for _, existing := range r.RemoveResponseHeaders { + if existing == h { + found = true + break + } + } + if !found { + r.RemoveResponseHeaders = append(r.RemoveResponseHeaders, h) + } + } + } + if localTo, err := buildClusterSettingsTimeout(&policy.Spec.ClusterSettings); err == nil { r.Traffic.Timeout = localTo } diff --git a/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer-remove-headers.in.yaml b/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer-remove-headers.in.yaml new file mode 100644 index 0000000000..0f0bb4fade --- /dev/null +++ b/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer-remove-headers.in.yaml @@ -0,0 +1,50 @@ +gateways: + - apiVersion: gateway.networking.k8s.io/v1 + kind: Gateway + metadata: + namespace: envoy-gateway + name: gateway-1 + spec: + gatewayClassName: envoy-gateway-class + listeners: + - name: http + protocol: HTTP + port: 80 + allowedRoutes: + namespaces: + from: All +httpRoutes: + - apiVersion: gateway.networking.k8s.io/v1 + kind: HTTPRoute + metadata: + namespace: default + name: httproute-1 + spec: + hostnames: + - gateway.envoyproxy.io + parentRefs: + - namespace: envoy-gateway + name: gateway-1 + sectionName: http + rules: + - matches: + - path: + value: "/" + backendRefs: + - name: service-1 + port: 8080 +backendTrafficPolicies: + - apiVersion: gateway.envoyproxy.io/v1alpha1 + kind: BackendTrafficPolicy + metadata: + namespace: default + name: policy-for-route + spec: + targetRefs: + - group: gateway.networking.k8s.io + kind: HTTPRoute + name: httproute-1 + loadBalancer: + type: BackendUtilization + backendUtilization: + removeResponseHeaders: true diff --git a/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer-remove-headers.out.yaml b/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer-remove-headers.out.yaml new file mode 100644 index 0000000000..1fe7ae82e0 --- /dev/null +++ b/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer-remove-headers.out.yaml @@ -0,0 +1,217 @@ +backendTrafficPolicies: +- apiVersion: gateway.envoyproxy.io/v1alpha1 + kind: BackendTrafficPolicy + metadata: + name: policy-for-route + namespace: default + spec: + loadBalancer: + backendUtilization: + removeResponseHeaders: true + type: BackendUtilization + targetRefs: + - group: gateway.networking.k8s.io + kind: HTTPRoute + name: httproute-1 + status: + ancestors: + - ancestorRef: + group: gateway.networking.k8s.io + kind: Gateway + name: gateway-1 + namespace: envoy-gateway + sectionName: http + conditions: + - lastTransitionTime: null + message: Policy has been accepted. + reason: Accepted + status: "True" + type: Accepted + controllerName: gateway.envoyproxy.io/gatewayclass-controller +gateways: +- apiVersion: gateway.networking.k8s.io/v1 + kind: Gateway + metadata: + name: gateway-1 + namespace: envoy-gateway + spec: + gatewayClassName: envoy-gateway-class + listeners: + - allowedRoutes: + namespaces: + from: All + name: http + port: 80 + protocol: HTTP + status: + listeners: + - attachedRoutes: 1 + conditions: + - lastTransitionTime: null + message: Sending translated listener configuration to the data plane + reason: Programmed + status: "True" + type: Programmed + - lastTransitionTime: null + message: Listener has been successfully translated + reason: Accepted + status: "True" + type: Accepted + - lastTransitionTime: null + message: Listener references have been resolved + reason: ResolvedRefs + status: "True" + type: ResolvedRefs + name: http + supportedKinds: + - group: gateway.networking.k8s.io + kind: HTTPRoute + - group: gateway.networking.k8s.io + kind: GRPCRoute +httpRoutes: +- apiVersion: gateway.networking.k8s.io/v1 + kind: HTTPRoute + metadata: + name: httproute-1 + namespace: default + spec: + hostnames: + - gateway.envoyproxy.io + parentRefs: + - name: gateway-1 + namespace: envoy-gateway + sectionName: http + rules: + - backendRefs: + - name: service-1 + port: 8080 + matches: + - path: + value: / + status: + parents: + - conditions: + - lastTransitionTime: null + message: Route is accepted + reason: Accepted + status: "True" + type: Accepted + - lastTransitionTime: null + message: Resolved all the Object references for the Route + reason: ResolvedRefs + status: "True" + type: ResolvedRefs + controllerName: gateway.envoyproxy.io/gatewayclass-controller + parentRef: + name: gateway-1 + namespace: envoy-gateway + sectionName: http +infraIR: + envoy-gateway/gateway-1: + proxy: + listeners: + - address: null + name: envoy-gateway/gateway-1/http + ports: + - containerPort: 10080 + name: http-80 + protocol: HTTP + servicePort: 80 + metadata: + labels: + gateway.envoyproxy.io/owning-gateway-name: gateway-1 + gateway.envoyproxy.io/owning-gateway-namespace: envoy-gateway + ownerReference: + kind: GatewayClass + name: envoy-gateway-class + name: envoy-gateway/gateway-1 + namespace: envoy-gateway-system +xdsIR: + envoy-gateway/gateway-1: + accessLog: + json: + - path: /dev/stdout + globalResources: + proxyServiceCluster: + metadata: + kind: Service + name: envoy-envoy-gateway-gateway-1-196ae069 + namespace: envoy-gateway-system + sectionName: "8080" + name: envoy-gateway/gateway-1 + settings: + - addressType: IP + endpoints: + - host: 7.6.5.4 + port: 8080 + zone: zone1 + metadata: + kind: Service + name: envoy-envoy-gateway-gateway-1-196ae069 + namespace: envoy-gateway-system + sectionName: "8080" + name: envoy-gateway/gateway-1 + protocol: TCP + http: + - address: 0.0.0.0 + externalPort: 80 + hostnames: + - '*' + isHTTP2: false + metadata: + kind: Gateway + name: gateway-1 + namespace: envoy-gateway + sectionName: http + name: envoy-gateway/gateway-1/http + path: + escapedSlashesAction: UnescapeAndRedirect + mergeSlashes: true + port: 10080 + routes: + - destination: + metadata: + kind: HTTPRoute + name: httproute-1 + namespace: default + name: httproute/default/httproute-1/rule/0 + settings: + - addressType: IP + endpoints: + - host: 7.7.7.7 + port: 8080 + metadata: + kind: Service + name: service-1 + namespace: default + sectionName: "8080" + name: httproute/default/httproute-1/rule/0/backend/0 + protocol: HTTP + weight: 1 + hostname: gateway.envoyproxy.io + isHTTP2: false + metadata: + kind: HTTPRoute + name: httproute-1 + namespace: default + policies: + - kind: BackendTrafficPolicy + name: policy-for-route + namespace: default + name: httproute/default/httproute-1/rule/0/match/0/gateway_envoyproxy_io + pathMatch: + distinct: false + name: "" + prefix: / + removeResponseHeaders: + - endpoint-load-metrics + - endpoint-load-metrics-bin + traffic: + loadBalancer: + backendUtilization: + removeResponseHeaders: true + readyListener: + address: 0.0.0.0 + ipFamily: IPv4 + path: /ready + port: 19003 diff --git a/internal/ir/xds.go b/internal/ir/xds.go index 1bcb6af1b9..7ee36c6e9f 100644 --- a/internal/ir/xds.go +++ b/internal/ir/xds.go @@ -2778,6 +2778,7 @@ type BackendUtilization struct { ErrorUtilizationPenaltyPercent *uint32 `json:"errorUtilizationPenaltyPercent,omitempty" yaml:"errorUtilizationPenaltyPercent,omitempty"` MetricNamesForComputingUtilization []string `json:"metricNamesForComputingUtilization,omitempty" yaml:"metricNamesForComputingUtilization,omitempty"` SlowStart *SlowStart `json:"slowStart,omitempty" yaml:"slowStart,omitempty"` + RemoveResponseHeaders *bool `json:"removeResponseHeaders,omitempty" yaml:"removeResponseHeaders,omitempty"` } // ConsistentHash load balancer settings diff --git a/internal/ir/zz_generated.deepcopy.go b/internal/ir/zz_generated.deepcopy.go index d2dc777994..9007c4cac2 100644 --- a/internal/ir/zz_generated.deepcopy.go +++ b/internal/ir/zz_generated.deepcopy.go @@ -506,6 +506,11 @@ func (in *BackendUtilization) DeepCopyInto(out *BackendUtilization) { *out = new(SlowStart) (*in).DeepCopyInto(*out) } + if in.RemoveResponseHeaders != nil { + in, out := &in.RemoveResponseHeaders, &out.RemoveResponseHeaders + *out = new(bool) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackendUtilization. diff --git a/site/content/en/latest/api/extension_types.md b/site/content/en/latest/api/extension_types.md index 146d197621..c1a553fac3 100644 --- a/site/content/en/latest/api/extension_types.md +++ b/site/content/en/latest/api/extension_types.md @@ -595,6 +595,7 @@ _Appears in:_ | `weightUpdatePeriod` | _[Duration](https://gateway-api.sigs.k8s.io/reference/1.4/spec/#duration)_ | false | | How often endpoint weights are recalculated. Values less than 100ms are capped at 100ms. Default 1s. | | `errorUtilizationPenaltyPercent` | _integer_ | false | | ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps).
This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc.
For example:
- 100 => 1.0x
- 120 => 1.2x
- 200 => 2.0x
Note: In the internal IR/XDS configuration this value is converted back to a
floating point multiplier (value / 100.0).
Must be non-negative. | | `metricNamesForComputingUtilization` | _string array_ | false | | Metric names used to compute utilization if application_utilization is not set.
For map fields in ORCA proto, use the form ".", e.g., "named_metrics.foo". | +| `removeResponseHeaders` | _boolean_ | false | true | RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client.
Defaults to true. | #### BasicAuth diff --git a/site/content/en/latest/concepts/load-balancing.md b/site/content/en/latest/concepts/load-balancing.md index db6e6c4722..b10d7c4d10 100644 --- a/site/content/en/latest/concepts/load-balancing.md +++ b/site/content/en/latest/concepts/load-balancing.md @@ -95,9 +95,25 @@ For more details, see: By default, Envoy forwards the ORCA response headers/trailers from the upstream cluster to the downstream client. This means that if the downstream client is also configured to use client-side weighted round-robin, it will load balance against Envoy based on upstream weights. -To avoid this, you can configure an `HTTPRoute` or `BackendTrafficPolicy` to remove the ORCA headers before they reach the client. +To avoid this, you can configure the `BackendTrafficPolicy` to remove the ORCA headers before they reach the client using the `removeResponseHeaders` field in `backendUtilization`. This field defaults to `true` when `BackendUtilization` is enabled. -Example of removing the ORCA headers using `HTTPRoute`: +```yaml +apiVersion: gateway.envoyproxy.io/v1alpha1 +kind: BackendTrafficPolicy +metadata: + name: backend-utilization-policy +spec: + targetRefs: + - group: gateway.networking.k8s.io + kind: HTTPRoute + name: backend-utilization-route + loadBalancer: + type: BackendUtilization + backendUtilization: + removeResponseHeaders: true # Default value +``` + +Alternatively, you can manually remove the ORCA headers using a `ResponseHeaderModifier` filter in the `HTTPRoute`: ```yaml apiVersion: gateway.networking.k8s.io/v1 diff --git a/test/helm/gateway-crds-helm/all.out.yaml b/test/helm/gateway-crds-helm/all.out.yaml index f3655981a4..9b0436fe62 100644 --- a/test/helm/gateway-crds-helm/all.out.yaml +++ b/test/helm/gateway-crds-helm/all.out.yaml @@ -22038,6 +22038,12 @@ spec: items: type: string type: array + removeResponseHeaders: + default: true + description: |- + RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. + Defaults to true. + type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop using the reported weight. Defaults to @@ -27010,6 +27016,12 @@ spec: items: type: string type: array + removeResponseHeaders: + default: true + description: |- + RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. + Defaults to true. + type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop using the reported @@ -40814,6 +40826,12 @@ spec: items: type: string type: array + removeResponseHeaders: + default: true + description: |- + RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. + Defaults to true. + type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics @@ -42125,6 +42143,12 @@ spec: items: type: string type: array + removeResponseHeaders: + default: true + description: |- + RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. + Defaults to true. + type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics @@ -43592,6 +43616,12 @@ spec: items: type: string type: array + removeResponseHeaders: + default: true + description: |- + RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. + Defaults to true. + type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this @@ -44975,6 +45005,12 @@ spec: items: type: string type: array + removeResponseHeaders: + default: true + description: |- + RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. + Defaults to true. + type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop using the @@ -47695,6 +47731,12 @@ spec: items: type: string type: array + removeResponseHeaders: + default: true + description: |- + RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. + Defaults to true. + type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop using the reported @@ -48889,6 +48931,12 @@ spec: items: type: string type: array + removeResponseHeaders: + default: true + description: |- + RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. + Defaults to true. + type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop using the reported @@ -50294,6 +50342,12 @@ spec: items: type: string type: array + removeResponseHeaders: + default: true + description: |- + RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. + Defaults to true. + type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop @@ -51759,6 +51813,12 @@ spec: items: type: string type: array + removeResponseHeaders: + default: true + description: |- + RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. + Defaults to true. + type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop using the reported diff --git a/test/helm/gateway-crds-helm/envoy-gateway-crds.out.yaml b/test/helm/gateway-crds-helm/envoy-gateway-crds.out.yaml index 30cfbd94ae..36ef8929c4 100644 --- a/test/helm/gateway-crds-helm/envoy-gateway-crds.out.yaml +++ b/test/helm/gateway-crds-helm/envoy-gateway-crds.out.yaml @@ -1218,6 +1218,12 @@ spec: items: type: string type: array + removeResponseHeaders: + default: true + description: |- + RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. + Defaults to true. + type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop using the reported weight. Defaults to @@ -6190,6 +6196,12 @@ spec: items: type: string type: array + removeResponseHeaders: + default: true + description: |- + RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. + Defaults to true. + type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop using the reported @@ -19994,6 +20006,12 @@ spec: items: type: string type: array + removeResponseHeaders: + default: true + description: |- + RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. + Defaults to true. + type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics @@ -21305,6 +21323,12 @@ spec: items: type: string type: array + removeResponseHeaders: + default: true + description: |- + RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. + Defaults to true. + type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics @@ -22772,6 +22796,12 @@ spec: items: type: string type: array + removeResponseHeaders: + default: true + description: |- + RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. + Defaults to true. + type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this @@ -24155,6 +24185,12 @@ spec: items: type: string type: array + removeResponseHeaders: + default: true + description: |- + RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. + Defaults to true. + type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop using the @@ -26875,6 +26911,12 @@ spec: items: type: string type: array + removeResponseHeaders: + default: true + description: |- + RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. + Defaults to true. + type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop using the reported @@ -28069,6 +28111,12 @@ spec: items: type: string type: array + removeResponseHeaders: + default: true + description: |- + RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. + Defaults to true. + type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop using the reported @@ -29474,6 +29522,12 @@ spec: items: type: string type: array + removeResponseHeaders: + default: true + description: |- + RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. + Defaults to true. + type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop @@ -30939,6 +30993,12 @@ spec: items: type: string type: array + removeResponseHeaders: + default: true + description: |- + RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. + Defaults to true. + type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop using the reported From ac1d840394dd775640c2693e4c4e09635d338ee0 Mon Sep 17 00:00:00 2001 From: "anurag.ag" <6075379+altaiezior@users.noreply.github.com> Date: Thu, 5 Feb 2026 01:45:27 +0530 Subject: [PATCH 17/23] Update: Replace `removeResponseHeaders` with `keepResponseHeaders` across API, internal logic, and templates. Adjust defaults, documentation, and validations to reflect behavior change. Signed-off-by: anurag.ag <6075379+altaiezior@users.noreply.github.com> --- api/v1alpha1/loadbalancer_types.go | 8 +- api/v1alpha1/zz_generated.deepcopy.go | 4 +- ....envoyproxy.io_backendtrafficpolicies.yaml | 12 +- ....envoyproxy.io_envoyextensionpolicies.yaml | 12 +- .../gateway.envoyproxy.io_envoyproxies.yaml | 48 +++---- ...ateway.envoyproxy.io_securitypolicies.yaml | 48 +++---- ....envoyproxy.io_backendtrafficpolicies.yaml | 12 +- ....envoyproxy.io_envoyextensionpolicies.yaml | 12 +- .../gateway.envoyproxy.io_envoyproxies.yaml | 48 +++---- ...ateway.envoyproxy.io_securitypolicies.yaml | 48 +++---- internal/gatewayapi/backendtrafficpolicy.go | 2 +- internal/gatewayapi/clustersettings.go | 2 +- ...y-with-loadbalancer-remove-headers.in.yaml | 2 +- ...-with-loadbalancer-remove-headers.out.yaml | 4 +- ...ndtrafficpolicy-with-loadbalancer.out.yaml | 2 +- internal/ir/xds.go | 2 +- internal/ir/zz_generated.deepcopy.go | 4 +- site/content/en/latest/api/extension_types.md | 2 +- .../en/latest/concepts/load-balancing.md | 24 +--- test/helm/gateway-crds-helm/all.out.yaml | 120 +++++++++--------- .../envoy-gateway-crds.out.yaml | 120 +++++++++--------- 21 files changed, 259 insertions(+), 277 deletions(-) diff --git a/api/v1alpha1/loadbalancer_types.go b/api/v1alpha1/loadbalancer_types.go index a19cd8bea7..b18fbae2e5 100644 --- a/api/v1alpha1/loadbalancer_types.go +++ b/api/v1alpha1/loadbalancer_types.go @@ -208,11 +208,11 @@ type BackendUtilization struct { // +optional MetricNamesForComputingUtilization []string `json:"metricNamesForComputingUtilization,omitempty"` - // RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. - // Defaults to true. + // KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + // Defaults to false. // +optional - // +kubebuilder:default=true - RemoveResponseHeaders *bool `json:"removeResponseHeaders,omitempty"` + // +kubebuilder:default=false + KeepResponseHeaders *bool `json:"keepResponseHeaders,omitempty"` } // ConsistentHashType defines the type of input to hash on. diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index 33fbf13503..cab23cddfb 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -837,8 +837,8 @@ func (in *BackendUtilization) DeepCopyInto(out *BackendUtilization) { *out = make([]string, len(*in)) copy(*out, *in) } - if in.RemoveResponseHeaders != nil { - in, out := &in.RemoveResponseHeaders, &out.RemoveResponseHeaders + if in.KeepResponseHeaders != nil { + in, out := &in.KeepResponseHeaders, &out.KeepResponseHeaders *out = new(bool) **out = **in } diff --git a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml index 3d2436e855..115d989778 100644 --- a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml +++ b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml @@ -734,6 +734,12 @@ spec: format: int32 minimum: 0 type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. @@ -741,12 +747,6 @@ spec: items: type: string type: array - removeResponseHeaders: - default: true - description: |- - RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. - Defaults to true. - type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop using the reported weight. Defaults to diff --git a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml index 9d97bae4f3..434c170bbe 100644 --- a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml +++ b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml @@ -764,6 +764,12 @@ spec: format: int32 minimum: 0 type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. @@ -771,12 +777,6 @@ spec: items: type: string type: array - removeResponseHeaders: - default: true - description: |- - RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. - Defaults to true. - type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop using the reported diff --git a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyproxies.yaml b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyproxies.yaml index 7accdace26..bd91575e29 100644 --- a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyproxies.yaml +++ b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyproxies.yaml @@ -11835,6 +11835,12 @@ spec: format: int32 minimum: 0 type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. @@ -11842,12 +11848,6 @@ spec: items: type: string type: array - removeResponseHeaders: - default: true - description: |- - RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. - Defaults to true. - type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics @@ -13152,6 +13152,12 @@ spec: format: int32 minimum: 0 type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. @@ -13159,12 +13165,6 @@ spec: items: type: string type: array - removeResponseHeaders: - default: true - description: |- - RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. - Defaults to true. - type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics @@ -14625,6 +14625,12 @@ spec: format: int32 minimum: 0 type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. @@ -14632,12 +14638,6 @@ spec: items: type: string type: array - removeResponseHeaders: - default: true - description: |- - RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. - Defaults to true. - type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this @@ -16014,6 +16014,12 @@ spec: format: int32 minimum: 0 type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. @@ -16021,12 +16027,6 @@ spec: items: type: string type: array - removeResponseHeaders: - default: true - description: |- - RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. - Defaults to true. - type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop using the diff --git a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_securitypolicies.yaml b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_securitypolicies.yaml index d7891846f3..d364593478 100644 --- a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_securitypolicies.yaml +++ b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_securitypolicies.yaml @@ -1384,6 +1384,12 @@ spec: format: int32 minimum: 0 type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. @@ -1391,12 +1397,6 @@ spec: items: type: string type: array - removeResponseHeaders: - default: true - description: |- - RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. - Defaults to true. - type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop using the reported @@ -2584,6 +2584,12 @@ spec: format: int32 minimum: 0 type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. @@ -2591,12 +2597,6 @@ spec: items: type: string type: array - removeResponseHeaders: - default: true - description: |- - RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. - Defaults to true. - type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop using the reported @@ -3995,6 +3995,12 @@ spec: format: int32 minimum: 0 type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. @@ -4002,12 +4008,6 @@ spec: items: type: string type: array - removeResponseHeaders: - default: true - description: |- - RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. - Defaults to true. - type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop @@ -5466,6 +5466,12 @@ spec: format: int32 minimum: 0 type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. @@ -5473,12 +5479,6 @@ spec: items: type: string type: array - removeResponseHeaders: - default: true - description: |- - RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. - Defaults to true. - type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop using the reported diff --git a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml index 9f6bda247b..21958f747c 100644 --- a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml +++ b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml @@ -733,6 +733,12 @@ spec: format: int32 minimum: 0 type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. @@ -740,12 +746,6 @@ spec: items: type: string type: array - removeResponseHeaders: - default: true - description: |- - RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. - Defaults to true. - type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop using the reported weight. Defaults to diff --git a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml index 2fb994a718..fc5c1a2869 100644 --- a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml +++ b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml @@ -763,6 +763,12 @@ spec: format: int32 minimum: 0 type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. @@ -770,12 +776,6 @@ spec: items: type: string type: array - removeResponseHeaders: - default: true - description: |- - RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. - Defaults to true. - type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop using the reported diff --git a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyproxies.yaml b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyproxies.yaml index d155cc9965..6ff4722269 100644 --- a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyproxies.yaml +++ b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyproxies.yaml @@ -11834,6 +11834,12 @@ spec: format: int32 minimum: 0 type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. @@ -11841,12 +11847,6 @@ spec: items: type: string type: array - removeResponseHeaders: - default: true - description: |- - RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. - Defaults to true. - type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics @@ -13151,6 +13151,12 @@ spec: format: int32 minimum: 0 type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. @@ -13158,12 +13164,6 @@ spec: items: type: string type: array - removeResponseHeaders: - default: true - description: |- - RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. - Defaults to true. - type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics @@ -14624,6 +14624,12 @@ spec: format: int32 minimum: 0 type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. @@ -14631,12 +14637,6 @@ spec: items: type: string type: array - removeResponseHeaders: - default: true - description: |- - RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. - Defaults to true. - type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this @@ -16013,6 +16013,12 @@ spec: format: int32 minimum: 0 type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. @@ -16020,12 +16026,6 @@ spec: items: type: string type: array - removeResponseHeaders: - default: true - description: |- - RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. - Defaults to true. - type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop using the diff --git a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_securitypolicies.yaml b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_securitypolicies.yaml index 950fffa988..9bc60a2ffe 100644 --- a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_securitypolicies.yaml +++ b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_securitypolicies.yaml @@ -1383,6 +1383,12 @@ spec: format: int32 minimum: 0 type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. @@ -1390,12 +1396,6 @@ spec: items: type: string type: array - removeResponseHeaders: - default: true - description: |- - RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. - Defaults to true. - type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop using the reported @@ -2583,6 +2583,12 @@ spec: format: int32 minimum: 0 type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. @@ -2590,12 +2596,6 @@ spec: items: type: string type: array - removeResponseHeaders: - default: true - description: |- - RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. - Defaults to true. - type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop using the reported @@ -3994,6 +3994,12 @@ spec: format: int32 minimum: 0 type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. @@ -4001,12 +4007,6 @@ spec: items: type: string type: array - removeResponseHeaders: - default: true - description: |- - RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. - Defaults to true. - type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop @@ -5465,6 +5465,12 @@ spec: format: int32 minimum: 0 type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. @@ -5472,12 +5478,6 @@ spec: items: type: string type: array - removeResponseHeaders: - default: true - description: |- - RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. - Defaults to true. - type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop using the reported diff --git a/internal/gatewayapi/backendtrafficpolicy.go b/internal/gatewayapi/backendtrafficpolicy.go index cd43e26def..63228d0adc 100644 --- a/internal/gatewayapi/backendtrafficpolicy.go +++ b/internal/gatewayapi/backendtrafficpolicy.go @@ -821,7 +821,7 @@ func (t *Translator) applyTrafficFeatureToRoute(route RouteContext, if r.Traffic != nil && r.Traffic.LoadBalancer != nil && r.Traffic.LoadBalancer.BackendUtilization != nil && - ptr.Deref(r.Traffic.LoadBalancer.BackendUtilization.RemoveResponseHeaders, false) { + !ptr.Deref(r.Traffic.LoadBalancer.BackendUtilization.KeepResponseHeaders, false) { headersToRemove := []string{"endpoint-load-metrics", "endpoint-load-metrics-bin"} for _, h := range headersToRemove { found := false diff --git a/internal/gatewayapi/clustersettings.go b/internal/gatewayapi/clustersettings.go index adb7d000a1..504c5fae09 100644 --- a/internal/gatewayapi/clustersettings.go +++ b/internal/gatewayapi/clustersettings.go @@ -368,7 +368,7 @@ func buildLoadBalancer(policy *egv1a1.ClusterSettings) (*ir.LoadBalancer, error) if len(backendUtilization.MetricNamesForComputingUtilization) > 0 { lb.BackendUtilization.MetricNamesForComputingUtilization = append([]string(nil), backendUtilization.MetricNamesForComputingUtilization...) } - lb.BackendUtilization.RemoveResponseHeaders = ptr.To(ptr.Deref(backendUtilization.RemoveResponseHeaders, true)) + lb.BackendUtilization.KeepResponseHeaders = ptr.To(ptr.Deref(backendUtilization.KeepResponseHeaders, false)) } if policy.LoadBalancer.SlowStart != nil && policy.LoadBalancer.SlowStart.Window != nil { d, err := time.ParseDuration(string(*policy.LoadBalancer.SlowStart.Window)) diff --git a/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer-remove-headers.in.yaml b/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer-remove-headers.in.yaml index 0f0bb4fade..1d0c017c11 100644 --- a/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer-remove-headers.in.yaml +++ b/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer-remove-headers.in.yaml @@ -47,4 +47,4 @@ backendTrafficPolicies: loadBalancer: type: BackendUtilization backendUtilization: - removeResponseHeaders: true + keepResponseHeaders: false diff --git a/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer-remove-headers.out.yaml b/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer-remove-headers.out.yaml index 1fe7ae82e0..bed503f900 100644 --- a/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer-remove-headers.out.yaml +++ b/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer-remove-headers.out.yaml @@ -7,7 +7,7 @@ backendTrafficPolicies: spec: loadBalancer: backendUtilization: - removeResponseHeaders: true + keepResponseHeaders: false type: BackendUtilization targetRefs: - group: gateway.networking.k8s.io @@ -209,7 +209,7 @@ xdsIR: traffic: loadBalancer: backendUtilization: - removeResponseHeaders: true + keepResponseHeaders: false readyListener: address: 0.0.0.0 ipFamily: IPv4 diff --git a/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer.out.yaml b/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer.out.yaml index 0d27bf71ab..02c215a293 100644 --- a/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer.out.yaml +++ b/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer.out.yaml @@ -877,9 +877,9 @@ xdsIR: backendUtilization: blackoutPeriod: 10s errorUtilizationPenaltyPercent: 100 + keepResponseHeaders: false metricNamesForComputingUtilization: - cpu_utilization - removeResponseHeaders: true slowStart: window: 5m0s weightExpirationPeriod: 1m0s diff --git a/internal/ir/xds.go b/internal/ir/xds.go index 7ee36c6e9f..8c24396b01 100644 --- a/internal/ir/xds.go +++ b/internal/ir/xds.go @@ -2778,7 +2778,7 @@ type BackendUtilization struct { ErrorUtilizationPenaltyPercent *uint32 `json:"errorUtilizationPenaltyPercent,omitempty" yaml:"errorUtilizationPenaltyPercent,omitempty"` MetricNamesForComputingUtilization []string `json:"metricNamesForComputingUtilization,omitempty" yaml:"metricNamesForComputingUtilization,omitempty"` SlowStart *SlowStart `json:"slowStart,omitempty" yaml:"slowStart,omitempty"` - RemoveResponseHeaders *bool `json:"removeResponseHeaders,omitempty" yaml:"removeResponseHeaders,omitempty"` + KeepResponseHeaders *bool `json:"keepResponseHeaders,omitempty" yaml:"keepResponseHeaders,omitempty"` } // ConsistentHash load balancer settings diff --git a/internal/ir/zz_generated.deepcopy.go b/internal/ir/zz_generated.deepcopy.go index 9007c4cac2..b28ad68fe2 100644 --- a/internal/ir/zz_generated.deepcopy.go +++ b/internal/ir/zz_generated.deepcopy.go @@ -506,8 +506,8 @@ func (in *BackendUtilization) DeepCopyInto(out *BackendUtilization) { *out = new(SlowStart) (*in).DeepCopyInto(*out) } - if in.RemoveResponseHeaders != nil { - in, out := &in.RemoveResponseHeaders, &out.RemoveResponseHeaders + if in.KeepResponseHeaders != nil { + in, out := &in.KeepResponseHeaders, &out.KeepResponseHeaders *out = new(bool) **out = **in } diff --git a/site/content/en/latest/api/extension_types.md b/site/content/en/latest/api/extension_types.md index c1a553fac3..01d3827bfb 100644 --- a/site/content/en/latest/api/extension_types.md +++ b/site/content/en/latest/api/extension_types.md @@ -595,7 +595,7 @@ _Appears in:_ | `weightUpdatePeriod` | _[Duration](https://gateway-api.sigs.k8s.io/reference/1.4/spec/#duration)_ | false | | How often endpoint weights are recalculated. Values less than 100ms are capped at 100ms. Default 1s. | | `errorUtilizationPenaltyPercent` | _integer_ | false | | ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps).
This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc.
For example:
- 100 => 1.0x
- 120 => 1.2x
- 200 => 2.0x
Note: In the internal IR/XDS configuration this value is converted back to a
floating point multiplier (value / 100.0).
Must be non-negative. | | `metricNamesForComputingUtilization` | _string array_ | false | | Metric names used to compute utilization if application_utilization is not set.
For map fields in ORCA proto, use the form ".", e.g., "named_metrics.foo". | -| `removeResponseHeaders` | _boolean_ | false | true | RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client.
Defaults to true. | +| `keepResponseHeaders` | _boolean_ | false | false | KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client.
Defaults to false. | #### BasicAuth diff --git a/site/content/en/latest/concepts/load-balancing.md b/site/content/en/latest/concepts/load-balancing.md index b10d7c4d10..c02b1290cb 100644 --- a/site/content/en/latest/concepts/load-balancing.md +++ b/site/content/en/latest/concepts/load-balancing.md @@ -91,11 +91,11 @@ For more details, see: - [ORCA Load Report Proto](https://www.envoyproxy.io/docs/envoy/latest/xds/data/orca/v3/orca_load_report.proto) - [ORCA Design Document](https://docs.google.com/document/d/1NSnK3346BkBo1JUU3I9I5NYYnaJZQPt8_Z_XCBCI3uA) -### Automatic Header Forwarding +### Automatic Header Removal By default, Envoy forwards the ORCA response headers/trailers from the upstream cluster to the downstream client. This means that if the downstream client is also configured to use client-side weighted round-robin, it will load balance against Envoy based on upstream weights. -To avoid this, you can configure the `BackendTrafficPolicy` to remove the ORCA headers before they reach the client using the `removeResponseHeaders` field in `backendUtilization`. This field defaults to `true` when `BackendUtilization` is enabled. +To prevent this, Envoy Gateway automatically removes these headers by default when `BackendUtilization` is enabled. You can change this behavior using the `keepResponseHeaders` field in `backendUtilization`. ```yaml apiVersion: gateway.envoyproxy.io/v1alpha1 @@ -110,25 +110,7 @@ spec: loadBalancer: type: BackendUtilization backendUtilization: - removeResponseHeaders: true # Default value -``` - -Alternatively, you can manually remove the ORCA headers using a `ResponseHeaderModifier` filter in the `HTTPRoute`: - -```yaml -apiVersion: gateway.networking.k8s.io/v1 -kind: HTTPRoute -metadata: - name: backend-utilization-route -spec: - rules: - - filters: - - type: ResponseHeaderModifier - responseHeaderModifier: - remove: ["endpoint-load-metrics", "endpoint-load-metrics-bin"] - backendRefs: - - name: backend - port: 3000 + keepResponseHeaders: true # Keep headers and forward them to the client ``` ## Related Resources diff --git a/test/helm/gateway-crds-helm/all.out.yaml b/test/helm/gateway-crds-helm/all.out.yaml index 9b0436fe62..f845a15f82 100644 --- a/test/helm/gateway-crds-helm/all.out.yaml +++ b/test/helm/gateway-crds-helm/all.out.yaml @@ -22031,6 +22031,12 @@ spec: format: int32 minimum: 0 type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. @@ -22038,12 +22044,6 @@ spec: items: type: string type: array - removeResponseHeaders: - default: true - description: |- - RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. - Defaults to true. - type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop using the reported weight. Defaults to @@ -27009,6 +27009,12 @@ spec: format: int32 minimum: 0 type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. @@ -27016,12 +27022,6 @@ spec: items: type: string type: array - removeResponseHeaders: - default: true - description: |- - RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. - Defaults to true. - type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop using the reported @@ -40819,6 +40819,12 @@ spec: format: int32 minimum: 0 type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. @@ -40826,12 +40832,6 @@ spec: items: type: string type: array - removeResponseHeaders: - default: true - description: |- - RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. - Defaults to true. - type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics @@ -42136,6 +42136,12 @@ spec: format: int32 minimum: 0 type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. @@ -42143,12 +42149,6 @@ spec: items: type: string type: array - removeResponseHeaders: - default: true - description: |- - RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. - Defaults to true. - type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics @@ -43609,6 +43609,12 @@ spec: format: int32 minimum: 0 type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. @@ -43616,12 +43622,6 @@ spec: items: type: string type: array - removeResponseHeaders: - default: true - description: |- - RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. - Defaults to true. - type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this @@ -44998,6 +44998,12 @@ spec: format: int32 minimum: 0 type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. @@ -45005,12 +45011,6 @@ spec: items: type: string type: array - removeResponseHeaders: - default: true - description: |- - RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. - Defaults to true. - type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop using the @@ -47724,6 +47724,12 @@ spec: format: int32 minimum: 0 type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. @@ -47731,12 +47737,6 @@ spec: items: type: string type: array - removeResponseHeaders: - default: true - description: |- - RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. - Defaults to true. - type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop using the reported @@ -48924,6 +48924,12 @@ spec: format: int32 minimum: 0 type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. @@ -48931,12 +48937,6 @@ spec: items: type: string type: array - removeResponseHeaders: - default: true - description: |- - RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. - Defaults to true. - type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop using the reported @@ -50335,6 +50335,12 @@ spec: format: int32 minimum: 0 type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. @@ -50342,12 +50348,6 @@ spec: items: type: string type: array - removeResponseHeaders: - default: true - description: |- - RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. - Defaults to true. - type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop @@ -51806,6 +51806,12 @@ spec: format: int32 minimum: 0 type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. @@ -51813,12 +51819,6 @@ spec: items: type: string type: array - removeResponseHeaders: - default: true - description: |- - RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. - Defaults to true. - type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop using the reported diff --git a/test/helm/gateway-crds-helm/envoy-gateway-crds.out.yaml b/test/helm/gateway-crds-helm/envoy-gateway-crds.out.yaml index 36ef8929c4..3d45d48ebc 100644 --- a/test/helm/gateway-crds-helm/envoy-gateway-crds.out.yaml +++ b/test/helm/gateway-crds-helm/envoy-gateway-crds.out.yaml @@ -1211,6 +1211,12 @@ spec: format: int32 minimum: 0 type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. @@ -1218,12 +1224,6 @@ spec: items: type: string type: array - removeResponseHeaders: - default: true - description: |- - RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. - Defaults to true. - type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop using the reported weight. Defaults to @@ -6189,6 +6189,12 @@ spec: format: int32 minimum: 0 type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. @@ -6196,12 +6202,6 @@ spec: items: type: string type: array - removeResponseHeaders: - default: true - description: |- - RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. - Defaults to true. - type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop using the reported @@ -19999,6 +19999,12 @@ spec: format: int32 minimum: 0 type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. @@ -20006,12 +20012,6 @@ spec: items: type: string type: array - removeResponseHeaders: - default: true - description: |- - RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. - Defaults to true. - type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics @@ -21316,6 +21316,12 @@ spec: format: int32 minimum: 0 type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. @@ -21323,12 +21329,6 @@ spec: items: type: string type: array - removeResponseHeaders: - default: true - description: |- - RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. - Defaults to true. - type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics @@ -22789,6 +22789,12 @@ spec: format: int32 minimum: 0 type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. @@ -22796,12 +22802,6 @@ spec: items: type: string type: array - removeResponseHeaders: - default: true - description: |- - RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. - Defaults to true. - type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this @@ -24178,6 +24178,12 @@ spec: format: int32 minimum: 0 type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. @@ -24185,12 +24191,6 @@ spec: items: type: string type: array - removeResponseHeaders: - default: true - description: |- - RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. - Defaults to true. - type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop using the @@ -26904,6 +26904,12 @@ spec: format: int32 minimum: 0 type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. @@ -26911,12 +26917,6 @@ spec: items: type: string type: array - removeResponseHeaders: - default: true - description: |- - RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. - Defaults to true. - type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop using the reported @@ -28104,6 +28104,12 @@ spec: format: int32 minimum: 0 type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. @@ -28111,12 +28117,6 @@ spec: items: type: string type: array - removeResponseHeaders: - default: true - description: |- - RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. - Defaults to true. - type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop using the reported @@ -29515,6 +29515,12 @@ spec: format: int32 minimum: 0 type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. @@ -29522,12 +29528,6 @@ spec: items: type: string type: array - removeResponseHeaders: - default: true - description: |- - RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. - Defaults to true. - type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop @@ -30986,6 +30986,12 @@ spec: format: int32 minimum: 0 type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean metricNamesForComputingUtilization: description: |- Metric names used to compute utilization if application_utilization is not set. @@ -30993,12 +30999,6 @@ spec: items: type: string type: array - removeResponseHeaders: - default: true - description: |- - RemoveResponseHeaders removes the ORCA load report headers/trailers before sending the response to the client. - Defaults to true. - type: boolean weightExpirationPeriod: description: If a given endpoint has not reported load metrics in this long, stop using the reported From 53f147358df739f0cd8d6f1eed5c7baa71b2da6d Mon Sep 17 00:00:00 2001 From: "anurag.ag" <6075379+altaiezior@users.noreply.github.com> Date: Mon, 9 Feb 2026 10:48:47 +0530 Subject: [PATCH 18/23] Refactor: Reorganize import order in `cluster_test.go` for consistency. Signed-off-by: anurag.ag <6075379+altaiezior@users.noreply.github.com> --- internal/xds/translator/cluster_test.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/internal/xds/translator/cluster_test.go b/internal/xds/translator/cluster_test.go index 8550d2ddc2..90275f573a 100644 --- a/internal/xds/translator/cluster_test.go +++ b/internal/xds/translator/cluster_test.go @@ -11,9 +11,8 @@ import ( bootstrapv3 "github.com/envoyproxy/go-control-plane/envoy/config/bootstrap/v3" clusterv3 "github.com/envoyproxy/go-control-plane/envoy/config/cluster/v3" - cswrrv3 "github.com/envoyproxy/go-control-plane/envoy/extensions/load_balancing_policies/client_side_weighted_round_robin/v3" endpointv3 "github.com/envoyproxy/go-control-plane/envoy/config/endpoint/v3" - + cswrrv3 "github.com/envoyproxy/go-control-plane/envoy/extensions/load_balancing_policies/client_side_weighted_round_robin/v3" "github.com/google/go-cmp/cmp" "github.com/stretchr/testify/require" "google.golang.org/protobuf/encoding/protojson" From abe5a048b2b6a0480c40ff36760637aed7d514a3 Mon Sep 17 00:00:00 2001 From: altaiezior <6075379+altaiezior@users.noreply.github.com> Date: Sat, 21 Mar 2026 01:51:03 +0530 Subject: [PATCH 19/23] Update: Fix formatting and alignment in `load_balancing.go` and `loadbalancer_types.go` for consistency. Signed-off-by: altaiezior <6075379+altaiezior@users.noreply.github.com> --- api/v1alpha1/loadbalancer_types.go | 8 ++++---- test/e2e/tests/load_balancing.go | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/api/v1alpha1/loadbalancer_types.go b/api/v1alpha1/loadbalancer_types.go index 37d62e1340..e7a4775101 100644 --- a/api/v1alpha1/loadbalancer_types.go +++ b/api/v1alpha1/loadbalancer_types.go @@ -11,10 +11,10 @@ import gwapiv1 "sigs.k8s.io/gateway-api/apis/v1" // +union // // +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 == 'BackendUtilization' ? has(self.backendUtilization) : !has(self.backendUtilization)",message="If LoadBalancer type is BackendUtilization, backendUtilization 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, LeastRequest, and BackendUtilization 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." +// +kubebuilder:validation:XValidation:rule="self.type == 'BackendUtilization' ? has(self.backendUtilization) : !has(self.backendUtilization)",message="If LoadBalancer type is BackendUtilization, backendUtilization 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, LeastRequest, and BackendUtilization 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 diff --git a/test/e2e/tests/load_balancing.go b/test/e2e/tests/load_balancing.go index 54cd3946a2..8907275592 100644 --- a/test/e2e/tests/load_balancing.go +++ b/test/e2e/tests/load_balancing.go @@ -53,7 +53,7 @@ func init() { var BackendUtilizationLoadBalancingTest = suite.ConformanceTest{ ShortName: "BackendUtilizationLoadBalancing", Description: "Test for backend utilization load balancing type", - Manifests: []string{ + Manifests: []string{ "testdata/load_balancing_backend_utilization.yaml", }, Test: func(t *testing.T, suite *suite.ConformanceTestSuite) { From 3b8a0d0f053b31dcb7d4b9b7d3f6fb03cae58fc5 Mon Sep 17 00:00:00 2001 From: altaiezior <6075379+altaiezior@users.noreply.github.com> Date: Sat, 21 Mar 2026 02:03:42 +0530 Subject: [PATCH 20/23] Update: Add validation to disallow ZoneAware routing for BackendUtilization load balancers. Adjust tests to reflect the new validation rule. Signed-off-by: altaiezior <6075379+altaiezior@users.noreply.github.com> --- api/v1alpha1/loadbalancer_types.go | 1 + ....envoyproxy.io_backendtrafficpolicies.yaml | 5 ++ ....envoyproxy.io_envoyextensionpolicies.yaml | 5 ++ .../gateway.envoyproxy.io_envoyproxies.yaml | 24 ++++++++ ...ateway.envoyproxy.io_securitypolicies.yaml | 21 +++++++ ....envoyproxy.io_backendtrafficpolicies.yaml | 5 ++ ....envoyproxy.io_envoyextensionpolicies.yaml | 5 ++ .../gateway.envoyproxy.io_envoyproxies.yaml | 24 ++++++++ ...ateway.envoyproxy.io_securitypolicies.yaml | 21 +++++++ .../backendtrafficpolicy_test.go | 2 +- test/helm/gateway-crds-helm/all.out.yaml | 55 +++++++++++++++++++ test/helm/gateway-crds-helm/e2e.out.yaml | 55 +++++++++++++++++++ .../envoy-gateway-crds.out.yaml | 55 +++++++++++++++++++ 13 files changed, 277 insertions(+), 1 deletion(-) diff --git a/api/v1alpha1/loadbalancer_types.go b/api/v1alpha1/loadbalancer_types.go index e7a4775101..bfacd339ea 100644 --- a/api/v1alpha1/loadbalancer_types.go +++ b/api/v1alpha1/loadbalancer_types.go @@ -14,6 +14,7 @@ import gwapiv1 "sigs.k8s.io/gateway-api/apis/v1" // +kubebuilder:validation:XValidation:rule="self.type == 'BackendUtilization' ? has(self.backendUtilization) : !has(self.backendUtilization)",message="If LoadBalancer type is BackendUtilization, backendUtilization 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, LeastRequest, and BackendUtilization 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="self.type == 'BackendUtilization' ? !has(self.zoneAware) : true",message="ZoneAware routing is not supported for BackendUtilization load balancers. BackendUtilization only handles picking endpoints within a single locality." // +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. diff --git a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml index 7d8dbf5980..afda86ce33 100644 --- a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml +++ b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml @@ -1128,6 +1128,11 @@ spec: load balancers. Use weightedZones instead. rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported for BackendUtilization + load balancers. BackendUtilization only handles picking endpoints + within a single locality. + rule: 'self.type == ''BackendUtilization'' ? !has(self.zoneAware) + : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) && diff --git a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml index cfad3260e3..c7e8ec264e 100644 --- a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml +++ b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml @@ -1220,6 +1220,11 @@ spec: instead. rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported for BackendUtilization + load balancers. BackendUtilization only handles picking + endpoints within a single locality. + rule: 'self.type == ''BackendUtilization'' ? !has(self.zoneAware) + : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) diff --git a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyproxies.yaml b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyproxies.yaml index 41ca7f6f8e..c05143267a 100644 --- a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyproxies.yaml +++ b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyproxies.yaml @@ -12513,6 +12513,12 @@ spec: rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported + for BackendUtilization load balancers. + BackendUtilization only handles picking + endpoints within a single locality. + rule: 'self.type == ''BackendUtilization'' + ? !has(self.zoneAware) : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) @@ -13989,6 +13995,12 @@ spec: rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported + for BackendUtilization load balancers. + BackendUtilization only handles picking + endpoints within a single locality. + rule: 'self.type == ''BackendUtilization'' + ? !has(self.zoneAware) : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) @@ -15612,6 +15624,12 @@ spec: rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported + for BackendUtilization load balancers. BackendUtilization + only handles picking endpoints within a + single locality. + rule: 'self.type == ''BackendUtilization'' + ? !has(self.zoneAware) : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) @@ -17152,6 +17170,12 @@ spec: instead. rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported for + BackendUtilization load balancers. BackendUtilization + only handles picking endpoints within a single + locality. + rule: 'self.type == ''BackendUtilization'' ? !has(self.zoneAware) + : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) diff --git a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_securitypolicies.yaml b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_securitypolicies.yaml index d088ced2c5..036df578ba 100644 --- a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_securitypolicies.yaml +++ b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_securitypolicies.yaml @@ -1849,6 +1849,11 @@ spec: instead. rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported for BackendUtilization + load balancers. BackendUtilization only handles picking + endpoints within a single locality. + rule: 'self.type == ''BackendUtilization'' ? !has(self.zoneAware) + : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) @@ -3200,6 +3205,11 @@ spec: instead. rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported for BackendUtilization + load balancers. BackendUtilization only handles picking + endpoints within a single locality. + rule: 'self.type == ''BackendUtilization'' ? !has(self.zoneAware) + : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) @@ -4814,6 +4824,12 @@ spec: Use weightedZones instead. rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported for + BackendUtilization load balancers. BackendUtilization + only handles picking endpoints within a single + locality. + rule: 'self.type == ''BackendUtilization'' ? !has(self.zoneAware) + : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) @@ -6437,6 +6453,11 @@ spec: instead. rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported for BackendUtilization + load balancers. BackendUtilization only handles picking + endpoints within a single locality. + rule: 'self.type == ''BackendUtilization'' ? !has(self.zoneAware) + : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) diff --git a/charts/gateway-helm/charts/crds/crds/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml b/charts/gateway-helm/charts/crds/crds/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml index a15a1117d4..cbfb90202e 100644 --- a/charts/gateway-helm/charts/crds/crds/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml +++ b/charts/gateway-helm/charts/crds/crds/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml @@ -1127,6 +1127,11 @@ spec: load balancers. Use weightedZones instead. rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported for BackendUtilization + load balancers. BackendUtilization only handles picking endpoints + within a single locality. + rule: 'self.type == ''BackendUtilization'' ? !has(self.zoneAware) + : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) && diff --git a/charts/gateway-helm/charts/crds/crds/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml b/charts/gateway-helm/charts/crds/crds/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml index 5cac203ff5..7813492774 100644 --- a/charts/gateway-helm/charts/crds/crds/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml +++ b/charts/gateway-helm/charts/crds/crds/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml @@ -1219,6 +1219,11 @@ spec: instead. rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported for BackendUtilization + load balancers. BackendUtilization only handles picking + endpoints within a single locality. + rule: 'self.type == ''BackendUtilization'' ? !has(self.zoneAware) + : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) diff --git a/charts/gateway-helm/charts/crds/crds/generated/gateway.envoyproxy.io_envoyproxies.yaml b/charts/gateway-helm/charts/crds/crds/generated/gateway.envoyproxy.io_envoyproxies.yaml index 333fa9d59e..f6d8045806 100644 --- a/charts/gateway-helm/charts/crds/crds/generated/gateway.envoyproxy.io_envoyproxies.yaml +++ b/charts/gateway-helm/charts/crds/crds/generated/gateway.envoyproxy.io_envoyproxies.yaml @@ -12512,6 +12512,12 @@ spec: rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported + for BackendUtilization load balancers. + BackendUtilization only handles picking + endpoints within a single locality. + rule: 'self.type == ''BackendUtilization'' + ? !has(self.zoneAware) : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) @@ -13988,6 +13994,12 @@ spec: rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported + for BackendUtilization load balancers. + BackendUtilization only handles picking + endpoints within a single locality. + rule: 'self.type == ''BackendUtilization'' + ? !has(self.zoneAware) : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) @@ -15611,6 +15623,12 @@ spec: rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported + for BackendUtilization load balancers. BackendUtilization + only handles picking endpoints within a + single locality. + rule: 'self.type == ''BackendUtilization'' + ? !has(self.zoneAware) : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) @@ -17151,6 +17169,12 @@ spec: instead. rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported for + BackendUtilization load balancers. BackendUtilization + only handles picking endpoints within a single + locality. + rule: 'self.type == ''BackendUtilization'' ? !has(self.zoneAware) + : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) diff --git a/charts/gateway-helm/charts/crds/crds/generated/gateway.envoyproxy.io_securitypolicies.yaml b/charts/gateway-helm/charts/crds/crds/generated/gateway.envoyproxy.io_securitypolicies.yaml index eb7c5d63f4..70989ce35b 100644 --- a/charts/gateway-helm/charts/crds/crds/generated/gateway.envoyproxy.io_securitypolicies.yaml +++ b/charts/gateway-helm/charts/crds/crds/generated/gateway.envoyproxy.io_securitypolicies.yaml @@ -1848,6 +1848,11 @@ spec: instead. rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported for BackendUtilization + load balancers. BackendUtilization only handles picking + endpoints within a single locality. + rule: 'self.type == ''BackendUtilization'' ? !has(self.zoneAware) + : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) @@ -3199,6 +3204,11 @@ spec: instead. rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported for BackendUtilization + load balancers. BackendUtilization only handles picking + endpoints within a single locality. + rule: 'self.type == ''BackendUtilization'' ? !has(self.zoneAware) + : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) @@ -4813,6 +4823,12 @@ spec: Use weightedZones instead. rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported for + BackendUtilization load balancers. BackendUtilization + only handles picking endpoints within a single + locality. + rule: 'self.type == ''BackendUtilization'' ? !has(self.zoneAware) + : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) @@ -6436,6 +6452,11 @@ spec: instead. rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported for BackendUtilization + load balancers. BackendUtilization only handles picking + endpoints within a single locality. + rule: 'self.type == ''BackendUtilization'' ? !has(self.zoneAware) + : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) diff --git a/test/cel-validation/backendtrafficpolicy_test.go b/test/cel-validation/backendtrafficpolicy_test.go index 5b38fbdd11..903d8e4103 100644 --- a/test/cel-validation/backendtrafficpolicy_test.go +++ b/test/cel-validation/backendtrafficpolicy_test.go @@ -751,7 +751,7 @@ func TestBackendTrafficPolicyTarget(t *testing.T) { }, wantErrors: []string{ "spec.loadBalancer: Invalid value:", - ": Currently ZoneAware is only supported for LeastRequest, Random, and RoundRobin load balancers.", + ": ZoneAware routing is not supported for BackendUtilization load balancers. BackendUtilization only handles picking endpoints within a single locality.", }, }, { diff --git a/test/helm/gateway-crds-helm/all.out.yaml b/test/helm/gateway-crds-helm/all.out.yaml index 28d55b9dd4..c8381f617a 100644 --- a/test/helm/gateway-crds-helm/all.out.yaml +++ b/test/helm/gateway-crds-helm/all.out.yaml @@ -23655,6 +23655,11 @@ spec: load balancers. Use weightedZones instead. rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported for BackendUtilization + load balancers. BackendUtilization only handles picking endpoints + within a single locality. + rule: 'self.type == ''BackendUtilization'' ? !has(self.zoneAware) + : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) && @@ -28959,6 +28964,11 @@ spec: instead. rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported for BackendUtilization + load balancers. BackendUtilization only handles picking + endpoints within a single locality. + rule: 'self.type == ''BackendUtilization'' ? !has(self.zoneAware) + : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) @@ -43189,6 +43199,12 @@ spec: rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported + for BackendUtilization load balancers. + BackendUtilization only handles picking + endpoints within a single locality. + rule: 'self.type == ''BackendUtilization'' + ? !has(self.zoneAware) : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) @@ -44665,6 +44681,12 @@ spec: rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported + for BackendUtilization load balancers. + BackendUtilization only handles picking + endpoints within a single locality. + rule: 'self.type == ''BackendUtilization'' + ? !has(self.zoneAware) : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) @@ -46288,6 +46310,12 @@ spec: rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported + for BackendUtilization load balancers. BackendUtilization + only handles picking endpoints within a + single locality. + rule: 'self.type == ''BackendUtilization'' + ? !has(self.zoneAware) : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) @@ -47828,6 +47856,12 @@ spec: instead. rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported for + BackendUtilization load balancers. BackendUtilization + only handles picking endpoints within a single + locality. + rule: 'self.type == ''BackendUtilization'' ? !has(self.zoneAware) + : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) @@ -50775,6 +50809,11 @@ spec: instead. rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported for BackendUtilization + load balancers. BackendUtilization only handles picking + endpoints within a single locality. + rule: 'self.type == ''BackendUtilization'' ? !has(self.zoneAware) + : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) @@ -52126,6 +52165,11 @@ spec: instead. rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported for BackendUtilization + load balancers. BackendUtilization only handles picking + endpoints within a single locality. + rule: 'self.type == ''BackendUtilization'' ? !has(self.zoneAware) + : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) @@ -53740,6 +53784,12 @@ spec: Use weightedZones instead. rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported for + BackendUtilization load balancers. BackendUtilization + only handles picking endpoints within a single + locality. + rule: 'self.type == ''BackendUtilization'' ? !has(self.zoneAware) + : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) @@ -55363,6 +55413,11 @@ spec: instead. rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported for BackendUtilization + load balancers. BackendUtilization only handles picking + endpoints within a single locality. + rule: 'self.type == ''BackendUtilization'' ? !has(self.zoneAware) + : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) diff --git a/test/helm/gateway-crds-helm/e2e.out.yaml b/test/helm/gateway-crds-helm/e2e.out.yaml index 410a05e966..3ffa037289 100644 --- a/test/helm/gateway-crds-helm/e2e.out.yaml +++ b/test/helm/gateway-crds-helm/e2e.out.yaml @@ -1628,6 +1628,11 @@ spec: load balancers. Use weightedZones instead. rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported for BackendUtilization + load balancers. BackendUtilization only handles picking endpoints + within a single locality. + rule: 'self.type == ''BackendUtilization'' ? !has(self.zoneAware) + : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) && @@ -6932,6 +6937,11 @@ spec: instead. rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported for BackendUtilization + load balancers. BackendUtilization only handles picking + endpoints within a single locality. + rule: 'self.type == ''BackendUtilization'' ? !has(self.zoneAware) + : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) @@ -21162,6 +21172,12 @@ spec: rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported + for BackendUtilization load balancers. + BackendUtilization only handles picking + endpoints within a single locality. + rule: 'self.type == ''BackendUtilization'' + ? !has(self.zoneAware) : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) @@ -22638,6 +22654,12 @@ spec: rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported + for BackendUtilization load balancers. + BackendUtilization only handles picking + endpoints within a single locality. + rule: 'self.type == ''BackendUtilization'' + ? !has(self.zoneAware) : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) @@ -24261,6 +24283,12 @@ spec: rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported + for BackendUtilization load balancers. BackendUtilization + only handles picking endpoints within a + single locality. + rule: 'self.type == ''BackendUtilization'' + ? !has(self.zoneAware) : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) @@ -25801,6 +25829,12 @@ spec: instead. rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported for + BackendUtilization load balancers. BackendUtilization + only handles picking endpoints within a single + locality. + rule: 'self.type == ''BackendUtilization'' ? !has(self.zoneAware) + : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) @@ -28748,6 +28782,11 @@ spec: instead. rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported for BackendUtilization + load balancers. BackendUtilization only handles picking + endpoints within a single locality. + rule: 'self.type == ''BackendUtilization'' ? !has(self.zoneAware) + : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) @@ -30099,6 +30138,11 @@ spec: instead. rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported for BackendUtilization + load balancers. BackendUtilization only handles picking + endpoints within a single locality. + rule: 'self.type == ''BackendUtilization'' ? !has(self.zoneAware) + : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) @@ -31713,6 +31757,12 @@ spec: Use weightedZones instead. rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported for + BackendUtilization load balancers. BackendUtilization + only handles picking endpoints within a single + locality. + rule: 'self.type == ''BackendUtilization'' ? !has(self.zoneAware) + : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) @@ -33336,6 +33386,11 @@ spec: instead. rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported for BackendUtilization + load balancers. BackendUtilization only handles picking + endpoints within a single locality. + rule: 'self.type == ''BackendUtilization'' ? !has(self.zoneAware) + : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) diff --git a/test/helm/gateway-crds-helm/envoy-gateway-crds.out.yaml b/test/helm/gateway-crds-helm/envoy-gateway-crds.out.yaml index 30a5b64897..bb669c3017 100644 --- a/test/helm/gateway-crds-helm/envoy-gateway-crds.out.yaml +++ b/test/helm/gateway-crds-helm/envoy-gateway-crds.out.yaml @@ -1628,6 +1628,11 @@ spec: load balancers. Use weightedZones instead. rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported for BackendUtilization + load balancers. BackendUtilization only handles picking endpoints + within a single locality. + rule: 'self.type == ''BackendUtilization'' ? !has(self.zoneAware) + : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) && @@ -6932,6 +6937,11 @@ spec: instead. rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported for BackendUtilization + load balancers. BackendUtilization only handles picking + endpoints within a single locality. + rule: 'self.type == ''BackendUtilization'' ? !has(self.zoneAware) + : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) @@ -21162,6 +21172,12 @@ spec: rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported + for BackendUtilization load balancers. + BackendUtilization only handles picking + endpoints within a single locality. + rule: 'self.type == ''BackendUtilization'' + ? !has(self.zoneAware) : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) @@ -22638,6 +22654,12 @@ spec: rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported + for BackendUtilization load balancers. + BackendUtilization only handles picking + endpoints within a single locality. + rule: 'self.type == ''BackendUtilization'' + ? !has(self.zoneAware) : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) @@ -24261,6 +24283,12 @@ spec: rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported + for BackendUtilization load balancers. BackendUtilization + only handles picking endpoints within a + single locality. + rule: 'self.type == ''BackendUtilization'' + ? !has(self.zoneAware) : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) @@ -25801,6 +25829,12 @@ spec: instead. rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported for + BackendUtilization load balancers. BackendUtilization + only handles picking endpoints within a single + locality. + rule: 'self.type == ''BackendUtilization'' ? !has(self.zoneAware) + : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) @@ -28748,6 +28782,11 @@ spec: instead. rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported for BackendUtilization + load balancers. BackendUtilization only handles picking + endpoints within a single locality. + rule: 'self.type == ''BackendUtilization'' ? !has(self.zoneAware) + : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) @@ -30099,6 +30138,11 @@ spec: instead. rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported for BackendUtilization + load balancers. BackendUtilization only handles picking + endpoints within a single locality. + rule: 'self.type == ''BackendUtilization'' ? !has(self.zoneAware) + : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) @@ -31713,6 +31757,12 @@ spec: Use weightedZones instead. rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported for + BackendUtilization load balancers. BackendUtilization + only handles picking endpoints within a single + locality. + rule: 'self.type == ''BackendUtilization'' ? !has(self.zoneAware) + : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) @@ -33336,6 +33386,11 @@ spec: instead. rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported for BackendUtilization + load balancers. BackendUtilization only handles picking + endpoints within a single locality. + rule: 'self.type == ''BackendUtilization'' ? !has(self.zoneAware) + : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) From e1bb5e63fb0d4bdf03201758c2eb1365203861f0 Mon Sep 17 00:00:00 2001 From: altaiezior <6075379+altaiezior@users.noreply.github.com> Date: Mon, 23 Mar 2026 01:16:26 +0530 Subject: [PATCH 21/23] Update: Add error handling for invalid duration values in `BackendUtilization` fields (`BlackoutPeriod`, `WeightExpirationPeriod`, `WeightUpdatePeriod`). Signed-off-by: altaiezior <6075379+altaiezior@users.noreply.github.com> --- internal/gatewayapi/clustersettings.go | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/internal/gatewayapi/clustersettings.go b/internal/gatewayapi/clustersettings.go index b57285acb8..9ce778a00a 100644 --- a/internal/gatewayapi/clustersettings.go +++ b/internal/gatewayapi/clustersettings.go @@ -364,19 +364,25 @@ func buildLoadBalancer(policy *egv1a1.ClusterSettings) (*ir.LoadBalancer, error) backendUtilization := policy.LoadBalancer.BackendUtilization if backendUtilization != nil { if backendUtilization.BlackoutPeriod != nil { - if d, err := time.ParseDuration(string(*backendUtilization.BlackoutPeriod)); err == nil { - lb.BackendUtilization.BlackoutPeriod = ir.MetaV1DurationPtr(d) + d, err := time.ParseDuration(string(*backendUtilization.BlackoutPeriod)) + if err != nil { + return nil, fmt.Errorf("invalid BlackoutPeriod value %s: %w", *backendUtilization.BlackoutPeriod, err) } + lb.BackendUtilization.BlackoutPeriod = ir.MetaV1DurationPtr(d) } if backendUtilization.WeightExpirationPeriod != nil { - if d, err := time.ParseDuration(string(*backendUtilization.WeightExpirationPeriod)); err == nil { - lb.BackendUtilization.WeightExpirationPeriod = ir.MetaV1DurationPtr(d) + d, err := time.ParseDuration(string(*backendUtilization.WeightExpirationPeriod)) + if err != nil { + return nil, fmt.Errorf("invalid WeightExpirationPeriod value %s: %w", *backendUtilization.WeightExpirationPeriod, err) } + lb.BackendUtilization.WeightExpirationPeriod = ir.MetaV1DurationPtr(d) } if backendUtilization.WeightUpdatePeriod != nil { - if d, err := time.ParseDuration(string(*backendUtilization.WeightUpdatePeriod)); err == nil { - lb.BackendUtilization.WeightUpdatePeriod = ir.MetaV1DurationPtr(d) + d, err := time.ParseDuration(string(*backendUtilization.WeightUpdatePeriod)) + if err != nil { + return nil, fmt.Errorf("invalid WeightUpdatePeriod value %s: %w", *backendUtilization.WeightUpdatePeriod, err) } + lb.BackendUtilization.WeightUpdatePeriod = ir.MetaV1DurationPtr(d) } if backendUtilization.ErrorUtilizationPenaltyPercent != nil { lb.BackendUtilization.ErrorUtilizationPenaltyPercent = ptr.To(*backendUtilization.ErrorUtilizationPenaltyPercent) From 15b56ffa07404dd86a10fa69d6743aaecf9dda44 Mon Sep 17 00:00:00 2001 From: altaiezior <6075379+altaiezior@users.noreply.github.com> Date: Mon, 23 Mar 2026 01:29:08 +0530 Subject: [PATCH 22/23] Refactor: Simplify nil check and assignment logic in `BackendUtilization` handling within cluster translator. Signed-off-by: altaiezior <6075379+altaiezior@users.noreply.github.com> --- internal/xds/translator/cluster.go | 39 +++++++++++++++--------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/internal/xds/translator/cluster.go b/internal/xds/translator/cluster.go index 6ab5d0fde1..735ab1b186 100644 --- a/internal/xds/translator/cluster.go +++ b/internal/xds/translator/cluster.go @@ -449,28 +449,27 @@ func buildXdsCluster(args *xdsClusterArgs) (*buildClusterResult, error) { } case args.loadBalancer.BackendUtilization != nil: cswrr := &cswrrv3.ClientSideWeightedRoundRobin{} - if v := args.loadBalancer.BackendUtilization; v != nil { - if v.BlackoutPeriod != nil && v.BlackoutPeriod.Duration > 0 { - cswrr.BlackoutPeriod = durationpb.New(v.BlackoutPeriod.Duration) - } - if v.WeightExpirationPeriod != nil && v.WeightExpirationPeriod.Duration > 0 { - cswrr.WeightExpirationPeriod = durationpb.New(v.WeightExpirationPeriod.Duration) - } - if v.WeightUpdatePeriod != nil && v.WeightUpdatePeriod.Duration > 0 { - cswrr.WeightUpdatePeriod = durationpb.New(v.WeightUpdatePeriod.Duration) - } - if v.SlowStart != nil && v.SlowStart.Window != nil && v.SlowStart.Window.Duration > 0 { - cswrr.SlowStartConfig = &commonv3.SlowStartConfig{ - SlowStartWindow: durationpb.New(v.SlowStart.Window.Duration), - } - } - if v.ErrorUtilizationPenaltyPercent != nil { - cswrr.ErrorUtilizationPenalty = wrapperspb.Float(float32(*v.ErrorUtilizationPenaltyPercent) / 100.0) - } - if len(v.MetricNamesForComputingUtilization) > 0 { - cswrr.MetricNamesForComputingUtilization = append([]string(nil), v.MetricNamesForComputingUtilization...) + v := args.loadBalancer.BackendUtilization + if v.BlackoutPeriod != nil && v.BlackoutPeriod.Duration > 0 { + cswrr.BlackoutPeriod = durationpb.New(v.BlackoutPeriod.Duration) + } + if v.WeightExpirationPeriod != nil && v.WeightExpirationPeriod.Duration > 0 { + cswrr.WeightExpirationPeriod = durationpb.New(v.WeightExpirationPeriod.Duration) + } + if v.WeightUpdatePeriod != nil && v.WeightUpdatePeriod.Duration > 0 { + cswrr.WeightUpdatePeriod = durationpb.New(v.WeightUpdatePeriod.Duration) + } + if v.SlowStart != nil && v.SlowStart.Window != nil && v.SlowStart.Window.Duration > 0 { + cswrr.SlowStartConfig = &commonv3.SlowStartConfig{ + SlowStartWindow: durationpb.New(v.SlowStart.Window.Duration), } } + if v.ErrorUtilizationPenaltyPercent != nil { + cswrr.ErrorUtilizationPenalty = wrapperspb.Float(float32(*v.ErrorUtilizationPenaltyPercent) / 100.0) + } + if len(v.MetricNamesForComputingUtilization) > 0 { + cswrr.MetricNamesForComputingUtilization = append([]string(nil), v.MetricNamesForComputingUtilization...) + } typedCSWRR, err := proto.ToAnyWithValidation(cswrr) if err != nil { return nil, err From 0a1d0fe91155d975d33f915e6eb9c5fe3ea748e8 Mon Sep 17 00:00:00 2001 From: altaiezior <6075379+altaiezior@users.noreply.github.com> Date: Mon, 23 Mar 2026 01:35:08 +0530 Subject: [PATCH 23/23] Update: Add support for BackendUtilization load balancing policy in BackendTrafficPolicy. Signed-off-by: altaiezior <6075379+altaiezior@users.noreply.github.com> --- release-notes/current.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/release-notes/current.yaml b/release-notes/current.yaml index a7cb61d95a..ffd6602ec0 100644 --- a/release-notes/current.yaml +++ b/release-notes/current.yaml @@ -35,6 +35,7 @@ new features: | Added `namespaceOverride` support to gateway-helm chart Added support for configuring statusOnError in ExtAuth settings Added support for retry budget in BackendTrafficPolicy. + Added support for BackendUtilization load balancing policy in BackendTrafficPolicy. bug fixes: | Rejected ClientTrafficPolicy if invalid TLS cipher suites are configured.