From 971c3f1bc8dec9194f55d24e67f5dd1deab514d3 Mon Sep 17 00:00:00 2001 From: "anurag.ag" Date: Sun, 2 Nov 2025 08:53:40 +0530 Subject: [PATCH 1/9] 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 7cc7ea146d9..7bc2f18b110 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 2dd26de2064..5ee347d0ad1 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 be726b94603..f31a99f7551 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 b5880e0e095..b9c489c95af 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 c75d4d6f62a..1bdb7b175fa 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 edeec410168..3a20570c01d 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 f0fa3b569ce..97c885b3472 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 1447f8ca6bb..148a3aab384 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 2d329615a20..83f21b6754f 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 6f0a7e170a7..65f2a631999 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 3acf56882d3..9a948eee9ad 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 2e801c4dec0..b1afc14c2fe 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 f1e4d5addca..d41caef7c27 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 f35c85be7ef..a8b0e1cfd0c 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 6127fded2ef..663d70621d0 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 1d1086fb7dc..dab1c8364e6 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 a644ecefdb8..c7f0be20450 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 00000000000..5ca148b2f75 --- /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 2e9bc7a8406..b61b1edad1e 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 63dc101fdd8..5ef8dd6e291 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 ae2d5c6e125..add04c7d38e 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 2/9] 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 00000000000..0537eda3a76 --- /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 d7225989906..ac32af8b246 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 5335f36ed80..546f29bbe79 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 378580568d5..049a2146283 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 a8b0e1cfd0c..4edea5f6745 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 663d70621d0..89e7a67b6e8 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 58f30c05b6d..2852cb34a5a 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 c1b5f6ae9ae..9ac223213bd 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 5a4034e5e06..1819eceda97 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 2a39a635241..31f8e3a7fa9 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 ca95df0bf28..54692dd1268 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 5ca148b2f75..4442cdff000 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 b61b1edad1e..cdca88f455d 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 6cb209e5f17..35727352c8d 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 3/9] 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 546f29bbe79..6c9b86ba016 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 54692dd1268..96d0064517d 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 4/9] 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 7bc2f18b110..39eb25428a8 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 f31a99f7551..4b3276f9d5b 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 b9c489c95af..47e7eacad47 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 1bdb7b175fa..e24d360ed72 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 3a20570c01d..cf081eeb67e 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 97c885b3472..429fdf86999 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 148a3aab384..ea2d259477d 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 83f21b6754f..44b1ebc1760 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 65f2a631999..dc7eab9ffcb 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 2852cb34a5a..c559eeb5a58 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 9ac223213bd..4698944d916 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 dab1c8364e6..18069a3b76f 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 4442cdff000..a5774ad49f8 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 35727352c8d..c48b013e57d 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 5ef8dd6e291..0c42834c2d1 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 add04c7d38e..e0c29aee684 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 5/9] 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 39eb25428a8..ed272a0f91c 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 5ee347d0ad1..137ba70db12 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 9a948eee9ad..6c5d8f3b044 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 0537eda3a76..711d12d4d60 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 b1afc14c2fe..cfd22bedb93 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 049a2146283..6285f9ae223 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 d41caef7c27..4d48e935c13 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 4edea5f6745..f6880fbae73 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 96d0064517d..70a0c11dde8 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 6/9] 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 ed272a0f91c..a85f16a9a90 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 137ba70db12..1f6695e1b96 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 4b3276f9d5b..966e5378671 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 47e7eacad47..7612188010a 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 e24d360ed72..3033e233694 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 cf081eeb67e..b4abb9485ed 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 429fdf86999..5251a1f86df 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 ea2d259477d..7c1ee3b9071 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 44b1ebc1760..7bf59d25778 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 dc7eab9ffcb..0e2df047bbf 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 6c5d8f3b044..a5b9f7e5acd 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 711d12d4d60..07b3879ef15 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 ac32af8b246..53351de4a72 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 6c9b86ba016..fd0b2dbaea8 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 18069a3b76f..563c87f05d9 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 70a0c11dde8..43395b1a8ad 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 c48b013e57d..d3bdedd2848 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 7/9] 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 a5b9f7e5acd..fedf91ebfe3 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 07b3879ef15..a75ccb2171d 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 fd0b2dbaea8..66aea6d982e 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 69d23294ff8..5fe3f726d1c 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 3a9534fe7ad..f592f59bf25 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 f6880fbae73..0809d72d26e 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 c559eeb5a58..76e26f0dd09 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 43395b1a8ad..e1111782b50 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 e86d3778b9d..32aa49d65cf 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 c87c26486bb..485a1b5eaf2 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 8/9] 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 8d4a2794a1a..2bc7e3d4655 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 ddd70998182..e3ea947f9ed 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 de09b55e5e1..94f572ebb6f 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 a75ccb2171d..478c53c8a98 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 8474ed1605a..d171a6446b5 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 89e7a67b6e8..aae658bcda8 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 9/9] 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 8dc3ad8494f..821edc8e9e8 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 dd68f3d0f99..2f136be38d8 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 4c9f64d0ef7..85597434159 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 60338bc1485..272e493cb7e 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 cdfa9d06923..fee1943d498 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 8e9a4d62fa2..a9baebcbe75 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 fdec36c4971..e699decba69 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 72b2a74fedd..a4401232b37 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 480c5b092e1..944129039d3 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 94f572ebb6f..2757a55b06e 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 09dcc03acdd..5e934b804e3 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 6843afaa715..42c8bd585d5 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 d300217846e..9b5585e7c82 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 b4b6b64f21d..b466fdff9c3 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 0809d72d26e..4afbb57f87d 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 aae658bcda8..5b05419484e 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 d37ccd2d969..aa79333fb04 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 bc05f9550fa..613dd80c37d 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 f54c895395d..ecc5fa12850 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 e1111782b50..09493ac67b1 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 4cf47ba1f22..990f4959716 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 7b4f8235185..ae0da971324 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'']