diff --git a/api/v1alpha1/loadbalancer_types.go b/api/v1alpha1/loadbalancer_types.go index 397a3904795..821edc8e9e8 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'] ? !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. // 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. @@ -39,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"` @@ -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 @@ -148,6 +158,44 @@ 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 +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. + // +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"` + + // 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 *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". + // +optional + MetricNamesForComputingUtilization []string `json:"metricNamesForComputingUtilization,omitempty"` +} + // ConsistentHashType defines the type of input to hash on. // +kubebuilder:validation:Enum=SourceIP;Header;Headers;Cookie;QueryParams type ConsistentHashType string diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index 7aa2585053a..04b24d74907 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -1020,6 +1020,46 @@ func (in *ClientIPDetectionSettings) DeepCopy() *ClientIPDetectionSettings { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClientSideWeightedRoundRobin) DeepCopyInto(out *ClientSideWeightedRoundRobin) { + *out = *in + if in.BlackoutPeriod != nil { + in, out := &in.BlackoutPeriod, &out.BlackoutPeriod + *out = new(v1.Duration) + **out = **in + } + if in.WeightExpirationPeriod != nil { + in, out := &in.WeightExpirationPeriod, &out.WeightExpirationPeriod + *out = new(v1.Duration) + **out = **in + } + if in.WeightUpdatePeriod != nil { + in, out := &in.WeightUpdatePeriod, &out.WeightUpdatePeriod + *out = new(v1.Duration) + **out = **in + } + if in.ErrorUtilizationPenalty != nil { + in, out := &in.ErrorUtilizationPenalty, &out.ErrorUtilizationPenalty + *out = new(uint32) + **out = **in + } + if in.MetricNamesForComputingUtilization != nil { + in, out := &in.MetricNamesForComputingUtilization, &out.MetricNamesForComputingUtilization + *out = make([]string, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClientSideWeightedRoundRobin. +func (in *ClientSideWeightedRoundRobin) DeepCopy() *ClientSideWeightedRoundRobin { + if in == nil { + return nil + } + out := new(ClientSideWeightedRoundRobin) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ClientTLSSettings) DeepCopyInto(out *ClientTLSSettings) { *out = *in @@ -4817,6 +4857,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 8ad379ea307..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 @@ -678,6 +678,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 + errorUtilizationPenalty: + description: |- + 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: integer + 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 + 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 @@ -824,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: |- @@ -844,12 +891,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 @@ -895,14 +944,18 @@ spec: field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' - - message: Currently SlowStart is only supported for RoundRobin and - LeastRequest load balancers. + - 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, 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 == ''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 c7847dd52d7..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 @@ -736,6 +736,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 + errorUtilizationPenalty: + description: |- + 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: integer + 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 + 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 @@ -888,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: |- @@ -908,12 +956,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the configuration related @@ -961,14 +1011,19 @@ spec: field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' - - message: Currently SlowStart is only supported for RoundRobin - and LeastRequest load balancers. + - 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, + 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 == ''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 0eec1f27094..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 @@ -11729,6 +11729,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 + errorUtilizationPenalty: + description: |- + 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: integer + 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 + 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 @@ -11896,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: |- @@ -11916,12 +11967,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the @@ -11975,15 +12028,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. + 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 == ''ConsistentHash'' + rule: 'self.type in [''ConsistentHash'', + ''ClientSideWeightedRoundRobin''] ? !has(self.zoneAware) : true ' proxyProtocol: description: ProxyProtocol enables the @@ -12981,6 +13042,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 + errorUtilizationPenalty: + description: |- + 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: integer + 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 + 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 @@ -13148,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: |- @@ -13168,12 +13280,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the @@ -13227,15 +13341,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. + 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 == ''ConsistentHash'' + rule: 'self.type in [''ConsistentHash'', + ''ClientSideWeightedRoundRobin''] ? !has(self.zoneAware) : true ' proxyProtocol: description: ProxyProtocol enables the @@ -14327,6 +14449,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 + errorUtilizationPenalty: + description: |- + 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: integer + 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 + 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 @@ -14487,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: |- @@ -14507,12 +14679,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the configuration @@ -14565,15 +14739,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. + 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 == ''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. @@ -15579,6 +15760,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 + errorUtilizationPenalty: + description: |- + 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: integer + 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 + 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 @@ -15735,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: |- @@ -15755,12 +15984,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the configuration @@ -15811,14 +16042,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. + 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 == ''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 f83e5e3e841..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 @@ -1254,6 +1254,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 + errorUtilizationPenalty: + description: |- + 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: integer + 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 + 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 @@ -1408,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: |- @@ -1428,12 +1476,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the configuration related @@ -1483,14 +1533,19 @@ spec: field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' - - message: Currently SlowStart is only supported for RoundRobin - and LeastRequest load balancers. + - 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, + 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 == ''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. @@ -2394,6 +2449,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 + errorUtilizationPenalty: + description: |- + 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: integer + 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 + 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 @@ -2548,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: |- @@ -2568,12 +2671,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the configuration related @@ -2623,14 +2728,19 @@ spec: field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' - - message: Currently SlowStart is only supported for RoundRobin - and LeastRequest load balancers. + - 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, + 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 == ''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. @@ -3745,6 +3855,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 + errorUtilizationPenalty: + description: |- + 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: integer + 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 + 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 @@ -3902,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: |- @@ -3922,12 +4081,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the configuration @@ -3978,15 +4139,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. + 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 == ''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. @@ -5154,6 +5321,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 + errorUtilizationPenalty: + description: |- + 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: integer + 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 + 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 @@ -5308,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: |- @@ -5328,12 +5543,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the configuration related @@ -5383,14 +5600,19 @@ spec: field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' - - message: Currently SlowStart is only supported for RoundRobin - and LeastRequest load balancers. + - 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, + 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 == ''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 5944352f6f8..a9baebcbe75 100644 --- a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml +++ b/charts/gateway-helm/crds/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 + errorUtilizationPenalty: + description: |- + 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: integer + 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 + 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 @@ -823,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: |- @@ -843,12 +890,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 @@ -894,14 +943,18 @@ spec: field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' - - message: Currently SlowStart is only supported for RoundRobin and - LeastRequest load balancers. + - 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, 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 == ''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 f87b1cacfa2..e699decba69 100644 --- a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml +++ b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml @@ -735,6 +735,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 + errorUtilizationPenalty: + description: |- + 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: integer + 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 + 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 @@ -887,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: |- @@ -907,12 +955,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the configuration related @@ -960,14 +1010,19 @@ spec: field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' - - message: Currently SlowStart is only supported for RoundRobin - and LeastRequest load balancers. + - 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, + 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 == ''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 37c9034f7f8..a4401232b37 100644 --- a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyproxies.yaml +++ b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyproxies.yaml @@ -11728,6 +11728,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 + errorUtilizationPenalty: + description: |- + 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: integer + 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 + 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 @@ -11895,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: |- @@ -11915,12 +11966,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the @@ -11974,15 +12027,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. + 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 == ''ConsistentHash'' + rule: 'self.type in [''ConsistentHash'', + ''ClientSideWeightedRoundRobin''] ? !has(self.zoneAware) : true ' proxyProtocol: description: ProxyProtocol enables the @@ -12980,6 +13041,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 + errorUtilizationPenalty: + description: |- + 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: integer + 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 + 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 @@ -13147,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: |- @@ -13167,12 +13279,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the @@ -13226,15 +13340,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. + 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 == ''ConsistentHash'' + rule: 'self.type in [''ConsistentHash'', + ''ClientSideWeightedRoundRobin''] ? !has(self.zoneAware) : true ' proxyProtocol: description: ProxyProtocol enables the @@ -14326,6 +14448,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 + errorUtilizationPenalty: + description: |- + 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: integer + 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 + 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 @@ -14486,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: |- @@ -14506,12 +14678,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the configuration @@ -14564,15 +14738,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. + 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 == ''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. @@ -15578,6 +15759,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 + errorUtilizationPenalty: + description: |- + 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: integer + 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 + 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 @@ -15734,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: |- @@ -15754,12 +15983,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the configuration @@ -15810,14 +16041,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. + 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 == ''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 be83336fb82..944129039d3 100644 --- a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_securitypolicies.yaml +++ b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_securitypolicies.yaml @@ -1253,6 +1253,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 + errorUtilizationPenalty: + description: |- + 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: integer + 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 + 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 @@ -1407,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: |- @@ -1427,12 +1475,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the configuration related @@ -1482,14 +1532,19 @@ spec: field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' - - message: Currently SlowStart is only supported for RoundRobin - and LeastRequest load balancers. + - 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, + 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 == ''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. @@ -2393,6 +2448,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 + errorUtilizationPenalty: + description: |- + 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: integer + 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 + 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 @@ -2547,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: |- @@ -2567,12 +2670,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the configuration related @@ -2622,14 +2727,19 @@ spec: field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' - - message: Currently SlowStart is only supported for RoundRobin - and LeastRequest load balancers. + - 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, + 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 == ''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. @@ -3744,6 +3854,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 + errorUtilizationPenalty: + description: |- + 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: integer + 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 + 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 @@ -3901,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: |- @@ -3921,12 +4080,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the configuration @@ -3977,15 +4138,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. + 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 == ''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. @@ -5153,6 +5320,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 + errorUtilizationPenalty: + description: |- + 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: integer + 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 + 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 @@ -5307,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: |- @@ -5327,12 +5542,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the configuration related @@ -5382,14 +5599,19 @@ spec: field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' - - message: Currently SlowStart is only supported for RoundRobin - and LeastRequest load balancers. + - 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, + 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 == ''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/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 4a21d855f44..2757a55b06e 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) } } @@ -340,6 +340,43 @@ 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.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 = ptr.To(*cswrr.ErrorUtilizationPenalty) + } + if len(cswrr.MetricNamesForComputingUtilization) > 0 { + 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/clustersettings_cswrr_test.go b/internal/gatewayapi/clustersettings_cswrr_test.go new file mode 100644 index 00000000000..478c53c8a98 --- /dev/null +++ b/internal/gatewayapi/clustersettings_cswrr_test.go @@ -0,0 +1,48 @@ +// 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" + "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{ + BlackoutPeriod: ptr.To(gwapiv1.Duration("10s")), + WeightExpirationPeriod: ptr.To(gwapiv1.Duration("3m")), + WeightUpdatePeriod: ptr.To(gwapiv1.Duration("1s")), + ErrorUtilizationPenalty: ptr.To[uint32](150), + 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, 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/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer.in.yaml b/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer.in.yaml index 4cffd67140e..5e934b804e3 100644 --- a/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer.in.yaml +++ b/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer.in.yaml @@ -1,215 +1,255 @@ gateways: -- apiVersion: gateway.networking.k8s.io/v1 - kind: Gateway - metadata: - namespace: envoy-gateway - name: gateway-1 - spec: - gatewayClassName: envoy-gateway-class - listeners: - - name: http - protocol: HTTP - port: 80 - allowedRoutes: - namespaces: - from: All -- apiVersion: gateway.networking.k8s.io/v1 - kind: Gateway - metadata: - namespace: envoy-gateway - name: gateway-2 - spec: - gatewayClassName: envoy-gateway-class - listeners: - - name: http - protocol: HTTP - port: 80 - allowedRoutes: - namespaces: - from: All -grpcRoutes: -- apiVersion: gateway.networking.k8s.io/v1alpha2 - kind: GRPCRoute - metadata: - namespace: default - name: grpcroute-1 - spec: - parentRefs: - - namespace: envoy-gateway + - apiVersion: gateway.networking.k8s.io/v1 + kind: Gateway + metadata: + namespace: envoy-gateway name: gateway-1 - sectionName: http - rules: - - backendRefs: - - name: service-1 - port: 8080 -httpRoutes: -- apiVersion: gateway.networking.k8s.io/v1 - kind: HTTPRoute - metadata: - namespace: default - name: httproute-1 - spec: - hostnames: - - gateway.envoyproxy.io - parentRefs: - - namespace: envoy-gateway - name: gateway-2 - sectionName: http - rules: - - matches: - - path: - value: "/" - backendRefs: - - name: service-1 - port: 8080 -- apiVersion: gateway.networking.k8s.io/v1 - kind: HTTPRoute - metadata: - namespace: default - name: httproute-2 - spec: - hostnames: - - gateway.envoyproxy.io - parentRefs: - - namespace: envoy-gateway + spec: + gatewayClassName: envoy-gateway-class + listeners: + - name: http + protocol: HTTP + port: 80 + allowedRoutes: + namespaces: + from: All + - apiVersion: gateway.networking.k8s.io/v1 + kind: Gateway + metadata: + namespace: envoy-gateway name: gateway-2 - sectionName: http - rules: - - matches: - - path: - value: "/test2" - backendRefs: - - name: service-2 - port: 8080 -- apiVersion: gateway.networking.k8s.io/v1 - kind: HTTPRoute - metadata: - namespace: default - name: httproute-3 - spec: - hostnames: - - gateway.envoyproxy.io - parentRefs: - - namespace: envoy-gateway - name: gateway-2 - sectionName: http - rules: - - matches: - - path: - value: "/test3" - 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 - metadata: - namespace: envoy-gateway - name: policy-for-gateway - spec: - targetRef: - group: gateway.networking.k8s.io - kind: Gateway - name: gateway-1 - loadBalancer: - type: Random -- apiVersion: gateway.envoyproxy.io/v1alpha1 - kind: BackendTrafficPolicy - metadata: - namespace: default - name: policy-for-route - spec: - targetRef: - group: gateway.networking.k8s.io - kind: HTTPRoute + spec: + gatewayClassName: envoy-gateway-class + listeners: + - name: http + protocol: HTTP + port: 80 + allowedRoutes: + namespaces: + from: All +grpcRoutes: + - apiVersion: gateway.networking.k8s.io/v1alpha2 + kind: GRPCRoute + metadata: + namespace: default + name: grpcroute-1 + spec: + parentRefs: + - namespace: envoy-gateway + name: gateway-1 + sectionName: http + rules: + - backendRefs: + - name: service-1 + port: 8080 +httpRoutes: + - apiVersion: gateway.networking.k8s.io/v1 + kind: HTTPRoute + metadata: + namespace: default name: httproute-1 - loadBalancer: - type: ConsistentHash - consistentHash: - type: SourceIP - tableSize: 524287 -- apiVersion: gateway.envoyproxy.io/v1alpha1 - kind: BackendTrafficPolicy - metadata: - namespace: envoy-gateway - name: policy-for-gateway2 - spec: - targetRef: - group: gateway.networking.k8s.io - kind: Gateway - name: gateway-2 - loadBalancer: - type: RoundRobin - slowStart: - window: 300s - zoneAware: - preferLocal: - force: - minEndpointsInZoneThreshold: 1 - minEndpointsThreshold: 1 - percentageEnabled: 50 -- apiVersion: gateway.envoyproxy.io/v1alpha1 - kind: BackendTrafficPolicy - metadata: - namespace: default - name: policy-for-route2 - spec: - targetRef: - group: gateway.networking.k8s.io - kind: HTTPRoute + spec: + hostnames: + - gateway.envoyproxy.io + parentRefs: + - namespace: envoy-gateway + name: gateway-2 + sectionName: http + rules: + - matches: + - path: + value: "/" + backendRefs: + - name: service-1 + port: 8080 + - apiVersion: gateway.networking.k8s.io/v1 + kind: HTTPRoute + metadata: + namespace: default name: httproute-2 - loadBalancer: - type: LeastRequest - slowStart: - window: 300s -- apiVersion: gateway.envoyproxy.io/v1alpha1 - kind: BackendTrafficPolicy - metadata: - namespace: default - name: policy-for-route3 - spec: - targetRef: - group: gateway.networking.k8s.io - kind: HTTPRoute + spec: + hostnames: + - gateway.envoyproxy.io + parentRefs: + - namespace: envoy-gateway + name: gateway-2 + sectionName: http + rules: + - matches: + - path: + value: "/test2" + backendRefs: + - name: service-2 + port: 8080 + - apiVersion: gateway.networking.k8s.io/v1 + kind: HTTPRoute + metadata: + namespace: default name: httproute-3 - loadBalancer: - type: ConsistentHash - consistentHash: - 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 + spec: + hostnames: + - gateway.envoyproxy.io + parentRefs: + - namespace: envoy-gateway + name: gateway-2 + sectionName: http + rules: + - matches: + - path: + value: "/test3" + backendRefs: + - name: service-2 + port: 8080 + - apiVersion: gateway.networking.k8s.io/v1 + kind: HTTPRoute + metadata: + namespace: default name: httproute-4 - loadBalancer: - type: ConsistentHash - consistentHash: - type: QueryParams - queryParams: - - name: "test" + 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 + - apiVersion: gateway.networking.k8s.io/v1 + kind: HTTPRoute + metadata: + namespace: default + name: httproute-5 + spec: + hostnames: + - gateway.envoyproxy.io + parentRefs: + - namespace: envoy-gateway + name: gateway-2 + sectionName: http + rules: + - matches: + - path: + value: "/test5" + backendRefs: + - name: service-2 + port: 8080 +backendTrafficPolicies: + - apiVersion: gateway.envoyproxy.io/v1alpha1 + kind: BackendTrafficPolicy + metadata: + namespace: envoy-gateway + name: policy-for-gateway + spec: + targetRef: + group: gateway.networking.k8s.io + kind: Gateway + name: gateway-1 + loadBalancer: + type: Random + - apiVersion: gateway.envoyproxy.io/v1alpha1 + kind: BackendTrafficPolicy + metadata: + namespace: default + name: policy-for-route + spec: + targetRef: + group: gateway.networking.k8s.io + kind: HTTPRoute + name: httproute-1 + loadBalancer: + type: ConsistentHash + consistentHash: + type: SourceIP + tableSize: 524287 + - apiVersion: gateway.envoyproxy.io/v1alpha1 + kind: BackendTrafficPolicy + metadata: + namespace: envoy-gateway + name: policy-for-gateway2 + spec: + targetRef: + group: gateway.networking.k8s.io + kind: Gateway + name: gateway-2 + loadBalancer: + type: RoundRobin + slowStart: + window: 300s + zoneAware: + preferLocal: + force: + minEndpointsInZoneThreshold: 1 + minEndpointsThreshold: 1 + percentageEnabled: 50 + - apiVersion: gateway.envoyproxy.io/v1alpha1 + kind: BackendTrafficPolicy + metadata: + namespace: default + name: policy-for-route2 + spec: + targetRef: + group: gateway.networking.k8s.io + kind: HTTPRoute + name: httproute-2 + loadBalancer: + type: LeastRequest + slowStart: + window: 300s + - apiVersion: gateway.envoyproxy.io/v1alpha1 + kind: BackendTrafficPolicy + metadata: + namespace: default + name: policy-for-route3 + spec: + targetRef: + group: gateway.networking.k8s.io + kind: HTTPRoute + name: httproute-3 + loadBalancer: + type: ConsistentHash + consistentHash: + 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: ConsistentHash + consistentHash: + type: QueryParams + queryParams: + - name: "test" + - apiVersion: gateway.envoyproxy.io/v1alpha1 + kind: BackendTrafficPolicy + metadata: + namespace: default + name: policy-for-route5 + spec: + targetRef: + group: gateway.networking.k8s.io + kind: HTTPRoute + name: httproute-5 + loadBalancer: + type: ClientSideWeightedRoundRobin + slowStart: + window: 300s + clientSideWeightedRoundRobin: + blackoutPeriod: 10s + weightExpirationPeriod: 60s + weightUpdatePeriod: 10s + 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 d0268979bbd..42c8bd585d5 100644 --- a/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer.out.yaml +++ b/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer.out.yaml @@ -120,6 +120,42 @@ backendTrafficPolicies: status: "True" type: Accepted controllerName: gateway.envoyproxy.io/gatewayclass-controller +- apiVersion: gateway.envoyproxy.io/v1alpha1 + kind: BackendTrafficPolicy + metadata: + name: policy-for-route5 + namespace: default + spec: + loadBalancer: + clientSideWeightedRoundRobin: + blackoutPeriod: 10s + errorUtilizationPenalty: 100 + metricNamesForComputingUtilization: + - cpu_utilization + weightExpirationPeriod: 60s + weightUpdatePeriod: 10s + slowStart: + window: 300s + type: ClientSideWeightedRoundRobin + targetRef: + group: gateway.networking.k8s.io + kind: HTTPRoute + name: httproute-5 + 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: @@ -182,7 +218,7 @@ backendTrafficPolicies: - 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]' + default/httproute-4 default/httproute-5]' reason: Overridden status: "True" type: Overridden @@ -243,7 +279,7 @@ gateways: protocol: HTTP status: listeners: - - attachedRoutes: 4 + - attachedRoutes: 5 conditions: - lastTransitionTime: null message: Sending translated listener configuration to the data plane @@ -448,6 +484,43 @@ httpRoutes: name: gateway-2 namespace: envoy-gateway sectionName: http +- apiVersion: gateway.networking.k8s.io/v1 + kind: HTTPRoute + metadata: + name: httproute-5 + 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: /test5 + 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: @@ -711,6 +784,47 @@ xdsIR: consistentHash: queryParams: - name: test + - destination: + metadata: + kind: HTTPRoute + name: httproute-5 + namespace: default + name: httproute/default/httproute-5/rule/0 + settings: + - addressType: IP + endpoints: + - host: 7.7.7.7 + port: 8080 + metadata: + kind: Service + name: service-2 + namespace: default + sectionName: "8080" + name: httproute/default/httproute-5/rule/0/backend/0 + protocol: HTTP + weight: 1 + hostname: gateway.envoyproxy.io + isHTTP2: false + metadata: + kind: HTTPRoute + name: httproute-5 + namespace: default + name: httproute/default/httproute-5/rule/0/match/0/gateway_envoyproxy_io + pathMatch: + distinct: false + name: "" + prefix: /test5 + traffic: + loadBalancer: + clientSideWeightedRoundRobin: + blackoutPeriod: 10s + errorUtilizationPenalty: 100 + metricNamesForComputingUtilization: + - cpu_utilization + slowStart: + window: 5m0s + weightExpirationPeriod: 1m0s + weightUpdatePeriod: 10s - destination: metadata: kind: HTTPRoute diff --git a/internal/ir/xds.go b/internal/ir/xds.go index 103762be583..9b5585e7c82 100644 --- a/internal/ir/xds.go +++ b/internal/ir/xds.go @@ -2583,6 +2583,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. @@ -2608,6 +2610,9 @@ func (l *LoadBalancer) Validate() error { if l.ConsistentHash != nil { matchCount++ } + if l.ClientSideWeightedRoundRobin != nil { + matchCount++ + } if matchCount != 1 { errs = errors.Join(errs, ErrLoadBalancerInvalid) } @@ -2635,6 +2640,17 @@ type LeastRequest struct { // +k8s:deepcopy-gen=true type Random struct{} +// ClientSideWeightedRoundRobin load balancer settings +// +k8s:deepcopy-gen=true +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 *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 // +k8s:deepcopy-gen=true type ConsistentHash struct { @@ -3338,4 +3354,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/xds_test.go b/internal/ir/xds_test.go index 31157ee7bd8..d171a6446b5 100644 --- a/internal/ir/xds_test.go +++ b/internal/ir/xds_test.go @@ -1337,6 +1337,17 @@ func TestValidateLoadBalancer(t *testing.T) { }, want: ErrLoadBalancerInvalid, }, + { + name: "client side wrr set", + input: LoadBalancer{ + ClientSideWeightedRoundRobin: &ClientSideWeightedRoundRobin{ + BlackoutPeriod: MetaV1DurationPtr(30 * time.Second), + WeightExpirationPeriod: MetaV1DurationPtr(10 * time.Second), + WeightUpdatePeriod: MetaV1DurationPtr(1 * time.Second), + MetricNamesForComputingUtilization: []string{"named_metrics.foo"}, + }, + }, + }, } for i := range tests { test := tests[i] diff --git a/internal/ir/zz_generated.deepcopy.go b/internal/ir/zz_generated.deepcopy.go index d8b53748865..b466fdff9c3 100644 --- a/internal/ir/zz_generated.deepcopy.go +++ b/internal/ir/zz_generated.deepcopy.go @@ -579,6 +579,51 @@ func (in *ClientIPDetectionSettings) DeepCopy() *ClientIPDetectionSettings { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClientSideWeightedRoundRobin) DeepCopyInto(out *ClientSideWeightedRoundRobin) { + *out = *in + if in.BlackoutPeriod != nil { + in, out := &in.BlackoutPeriod, &out.BlackoutPeriod + *out = new(v1.Duration) + **out = **in + } + if in.WeightExpirationPeriod != nil { + in, out := &in.WeightExpirationPeriod, &out.WeightExpirationPeriod + *out = new(v1.Duration) + **out = **in + } + if in.WeightUpdatePeriod != nil { + in, out := &in.WeightUpdatePeriod, &out.WeightUpdatePeriod + *out = new(v1.Duration) + **out = **in + } + if in.ErrorUtilizationPenalty != nil { + in, out := &in.ErrorUtilizationPenalty, &out.ErrorUtilizationPenalty + *out = new(uint32) + **out = **in + } + if in.MetricNamesForComputingUtilization != nil { + in, out := &in.MetricNamesForComputingUtilization, &out.MetricNamesForComputingUtilization + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.SlowStart != nil { + in, out := &in.SlowStart, &out.SlowStart + *out = new(SlowStart) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClientSideWeightedRoundRobin. +func (in *ClientSideWeightedRoundRobin) DeepCopy() *ClientSideWeightedRoundRobin { + if in == nil { + return nil + } + out := new(ClientSideWeightedRoundRobin) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ClientTimeout) DeepCopyInto(out *ClientTimeout) { *out = *in @@ -2470,6 +2515,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..4afbb57f87d 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,43 @@ func buildXdsCluster(args *xdsClusterArgs) (*buildClusterResult, error) { }, }}, } + case args.loadBalancer.ClientSideWeightedRoundRobin != nil: + cswrr := &cswrrv3.ClientSideWeightedRoundRobin{} + if v := args.loadBalancer.ClientSideWeightedRoundRobin; v != nil { + if v.BlackoutPeriod != nil && v.BlackoutPeriod.Duration > 0 { + cswrr.BlackoutPeriod = durationpb.New(v.BlackoutPeriod.Duration) + } + if v.WeightExpirationPeriod != nil && v.WeightExpirationPeriod.Duration > 0 { + cswrr.WeightExpirationPeriod = durationpb.New(v.WeightExpirationPeriod.Duration) + } + if v.WeightUpdatePeriod != nil && v.WeightUpdatePeriod.Duration > 0 { + cswrr.WeightUpdatePeriod = durationpb.New(v.WeightUpdatePeriod.Duration) + } + // 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) + } + 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 +1373,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 +1470,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..5b05419484e 100644 --- a/internal/xds/translator/cluster_test.go +++ b/internal/xds/translator/cluster_test.go @@ -11,13 +11,13 @@ 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" "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 +91,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 +106,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 +125,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), }, @@ -159,3 +159,65 @@ 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) + + 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) +} + +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 371b38438b2..aa79333fb04 100644 --- a/internal/xds/translator/testdata/in/xds-ir/load-balancer.yaml +++ b/internal/xds/translator/testdata/in/xds-ir/load-balancer.yaml @@ -217,3 +217,40 @@ http: - host: "1.2.3.4" port: 50000 name: "fifteenth-route-dest/backend/0" + - name: "sixteenth-route" + hostname: "*" + traffic: + loadBalancer: + clientSideWeightedRoundRobin: + blackoutPeriod: 30s + weightExpirationPeriod: 60s + weightUpdatePeriod: 10s + slowStart: + window: 45s + errorUtilizationPenalty: 100 + metricNamesForComputingUtilization: + - "cpu_utilization" + destination: + name: "sixteenth-route-dest" + settings: + - endpoints: + - host: "1.2.3.4" + port: 50000 + name: "sixteenth-route-dest/backend/0" + - name: "seventeenth-route" + hostname: "*" + traffic: + loadBalancer: + clientSideWeightedRoundRobin: + blackoutPeriod: 30s + weightExpirationPeriod: 60s + weightUpdatePeriod: 10s + metricNamesForComputingUtilization: + - "named_metric.foo" + destination: + name: "seventeenth-route-dest" + settings: + - endpoints: + - host: "1.2.3.4" + port: 50000 + name: "seventeenth-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 1e5a85b751d..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 @@ -365,3 +365,58 @@ 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 + errorUtilizationPenalty: 1 + metricNamesForComputingUtilization: + - cpu_utilization + slowStartConfig: + slowStartWindow: 45s + weightExpirationPeriod: 60s + weightUpdatePeriod: 10s + name: sixteenth-route-dest + perConnectionBufferLimitBytes: 32768 + type: EDS +- circuitBreakers: + thresholds: + - maxRetries: 1024 + commonLbConfig: {} + connectTimeout: 10s + dnsLookupFamily: V4_PREFERRED + edsClusterConfig: + edsConfig: + ads: {} + resourceApiVersion: V3 + serviceName: seventeenth-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 + metricNamesForComputingUtilization: + - named_metric.foo + weightExpirationPeriod: 60s + weightUpdatePeriod: 10s + name: seventeenth-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 80cc5ca36e6..96451679b9d 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 @@ -178,3 +178,27 @@ 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 +- clusterName: seventeenth-route-dest + endpoints: + - lbEndpoints: + - endpoint: + address: + socketAddress: + address: 1.2.3.4 + portValue: 50000 + loadBalancingWeight: 1 + loadBalancingWeight: 1 + locality: + region: seventeenth-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 8aeadf533a1..9c2ef1a2306 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 @@ -135,3 +135,17 @@ name: bar upgradeConfigs: - upgradeType: websocket + - match: + prefix: / + name: sixteenth-route + route: + cluster: sixteenth-route-dest + upgradeConfigs: + - upgradeType: websocket + - match: + prefix: / + name: seventeenth-route + route: + cluster: seventeenth-route-dest + upgradeConfigs: + - upgradeType: websocket diff --git a/site/content/en/latest/api/extension_types.md b/site/content/en/latest/api/extension_types.md index d2008d8035c..ecc5fa12850 100644 --- a/site/content/en/latest/api/extension_types.md +++ b/site/content/en/latest/api/extension_types.md @@ -721,6 +721,25 @@ _Appears in:_ | `customHeader` | _[CustomHeaderExtensionSettings](#customheaderextensionsettings)_ | false | | CustomHeader provides configuration for determining the client IP address for a request based on
a trusted custom HTTP header. This uses the custom_header original IP detection extension.
Refer to https://www.envoyproxy.io/docs/envoy/latest/api-v3/extensions/http/original_ip_detection/custom_header/v3/custom_header.proto
for more details. | +#### ClientSideWeightedRoundRobin + + + +ClientSideWeightedRoundRobin defines configuration for Envoy's Client-Side Weighted Round Robin policy. +See Envoy proto: envoy.extensions.load_balancing_policies.client_side_weighted_round_robin.v3.ClientSideWeightedRoundRobin + +_Appears in:_ +- [LoadBalancer](#loadbalancer) + +| Field | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| `blackoutPeriod` | _[Duration](https://gateway-api.sigs.k8s.io/reference/1.4/spec/#duration)_ | false | | A given endpoint must report load metrics continuously for at least this long before the endpoint weight will be used.
Default is 10s. | +| `weightExpirationPeriod` | _[Duration](https://gateway-api.sigs.k8s.io/reference/1.4/spec/#duration)_ | false | | If a given endpoint has not reported load metrics in this long, stop using the reported weight. Defaults to 3m. | +| `weightUpdatePeriod` | _[Duration](https://gateway-api.sigs.k8s.io/reference/1.4/spec/#duration)_ | false | | How often endpoint weights are recalculated. Values less than 100ms are capped at 100ms. Default 1s. | +| `errorUtilizationPenalty` | _integer_ | false | | ErrorUtilizationPenalty adjusts endpoint weights based on the error rate (eps/qps).
This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc.
For example:
- 100 => 1.0x
- 120 => 1.2x
- 200 => 2.0x
Note: In the internal IR/XDS configuration this value is converted back to a
floating point multiplier (value / 100.0).
Must be non-negative. | +| `metricNamesForComputingUtilization` | _string array_ | false | | Metric names used to compute utilization if application_utilization is not set.
For map fields in ORCA proto, use the form ".", e.g., "named_metrics.foo". | + + #### ClientTLSSettings @@ -3253,10 +3272,11 @@ _Appears in:_ | Field | Type | Required | Default | Description | | --- | --- | --- | --- | --- | -| `type` | _[LoadBalancerType](#loadbalancertype)_ | true | | Type decides the type of Load Balancer policy.
Valid LoadBalancerType values are
"ConsistentHash",
"LeastRequest",
"Random",
"RoundRobin". | +| `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 | +| `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. | @@ -3275,6 +3295,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/cel-validation/backendtrafficpolicy_test.go b/test/cel-validation/backendtrafficpolicy_test.go index ca95df0bf28..09493ac67b1 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{ @@ -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,9 +514,135 @@ 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.", }, }, + { + 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{ + BlackoutPeriod: ptr.To(gwapiv1.Duration("10s")), + WeightUpdatePeriod: ptr.To(gwapiv1.Duration("10s")), + WeightExpirationPeriod: ptr.To(gwapiv1.Duration("10s")), + ErrorUtilizationPenalty: ptr.To[uint32](50), + 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{}, + }, + { + 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 zero penalty is valid", + 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[uint32](0)}, + }, + }, + } + }, + wantErrors: []string{}, + }, { 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 new file mode 100644 index 00000000000..a5774ad49f8 --- /dev/null +++ b/test/e2e/testdata/load_balancing_client_side_weighted_round_robin.yaml @@ -0,0 +1,84 @@ +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: + blackoutPeriod: 30s + weightExpirationPeriod: 60s + weightUpdatePeriod: 10s + metricNamesForComputingUtilization: + - "named_metric.foo" +--- +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 8f0f6bfda55..97063d7d813 100644 --- a/test/e2e/tests/load_balancing.go +++ b/test/e2e/tests/load_balancing.go @@ -45,9 +45,67 @@ func init() { EndpointOverrideLoadBalancingTest, MultiHeaderConsistentHashHeaderLoadBalancingTest, ConsistentHashQueryParamsLoadBalancingTest, + 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", @@ -652,3 +710,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..d3bdedd2848 100644 --- a/test/fuzz/testdata/FuzzGatewayAPIToXDS/traffic_policy +++ b/test/fuzz/testdata/FuzzGatewayAPIToXDS/traffic_policy @@ -45,3 +45,18 @@ 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: + errorUtilizationPenalty: 120 diff --git a/test/helm/gateway-crds-helm/all.out.yaml b/test/helm/gateway-crds-helm/all.out.yaml index caa05613ee2..990f4959716 100644 --- a/test/helm/gateway-crds-helm/all.out.yaml +++ b/test/helm/gateway-crds-helm/all.out.yaml @@ -21975,6 +21975,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 + errorUtilizationPenalty: + description: |- + 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: integer + 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 + 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 @@ -22121,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: |- @@ -22141,12 +22188,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 @@ -22192,14 +22241,18 @@ spec: field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' - - message: Currently SlowStart is only supported for RoundRobin and - LeastRequest load balancers. + - 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, 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 == ''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 @@ -26629,6 +26682,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 + errorUtilizationPenalty: + description: |- + 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: integer + 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 + 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 @@ -26781,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: |- @@ -26801,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 @@ -26854,14 +26957,19 @@ spec: field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' - - message: Currently SlowStart is only supported for RoundRobin - and LeastRequest load balancers. + - 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, + 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 == ''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. @@ -40298,6 +40406,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 + errorUtilizationPenalty: + description: |- + 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: integer + 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 + 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 @@ -40465,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: |- @@ -40485,12 +40644,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the @@ -40544,15 +40705,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. + 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 == ''ConsistentHash'' + rule: 'self.type in [''ConsistentHash'', + ''ClientSideWeightedRoundRobin''] ? !has(self.zoneAware) : true ' proxyProtocol: description: ProxyProtocol enables the @@ -41550,6 +41719,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 + errorUtilizationPenalty: + description: |- + 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: integer + 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 + 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 @@ -41717,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: |- @@ -41737,12 +41957,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the @@ -41796,15 +42018,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. + 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 == ''ConsistentHash'' + rule: 'self.type in [''ConsistentHash'', + ''ClientSideWeightedRoundRobin''] ? !has(self.zoneAware) : true ' proxyProtocol: description: ProxyProtocol enables the @@ -42896,6 +43126,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 + errorUtilizationPenalty: + description: |- + 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: integer + 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 + 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 @@ -43056,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: |- @@ -43076,12 +43356,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the configuration @@ -43134,15 +43416,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. + 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 == ''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. @@ -44148,6 +44437,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 + errorUtilizationPenalty: + description: |- + 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: integer + 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 + 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 @@ -44304,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: |- @@ -44324,12 +44661,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the configuration @@ -44380,14 +44719,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. + 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 == ''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. @@ -46372,6 +46717,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 + errorUtilizationPenalty: + description: |- + 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: integer + 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 + 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 @@ -46526,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: |- @@ -46546,12 +46939,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the configuration related @@ -46601,14 +46996,19 @@ spec: field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' - - message: Currently SlowStart is only supported for RoundRobin - and LeastRequest load balancers. + - 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, + 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 == ''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. @@ -47512,6 +47912,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 + errorUtilizationPenalty: + description: |- + 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: integer + 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 + 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 @@ -47666,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: |- @@ -47686,12 +48134,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the configuration related @@ -47741,14 +48191,19 @@ spec: field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' - - message: Currently SlowStart is only supported for RoundRobin - and LeastRequest load balancers. + - 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, + 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 == ''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. @@ -48863,6 +49318,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 + errorUtilizationPenalty: + description: |- + 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: integer + 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 + 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 @@ -49020,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: |- @@ -49040,12 +49544,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the configuration @@ -49096,15 +49602,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. + 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 == ''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. @@ -50272,6 +50784,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 + errorUtilizationPenalty: + description: |- + 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: integer + 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 + 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 @@ -50426,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: |- @@ -50446,12 +51006,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the configuration related @@ -50501,14 +51063,19 @@ spec: field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' - - message: Currently SlowStart is only supported for RoundRobin - and LeastRequest load balancers. + - 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, + 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 == ''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 8126bcfcb45..ae0da971324 100644 --- a/test/helm/gateway-crds-helm/envoy-gateway-crds.out.yaml +++ b/test/helm/gateway-crds-helm/envoy-gateway-crds.out.yaml @@ -1155,6 +1155,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 + errorUtilizationPenalty: + description: |- + 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: integer + 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 + 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 @@ -1301,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: |- @@ -1321,12 +1368,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 @@ -1372,14 +1421,18 @@ spec: field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' - - message: Currently SlowStart is only supported for RoundRobin and - LeastRequest load balancers. + - 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, 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 == ''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 @@ -5809,6 +5862,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 + errorUtilizationPenalty: + description: |- + 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: integer + 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 + 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 @@ -5961,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: |- @@ -5981,12 +6082,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the configuration related @@ -6034,14 +6137,19 @@ spec: field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' - - message: Currently SlowStart is only supported for RoundRobin - and LeastRequest load balancers. + - 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, + 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 == ''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. @@ -19478,6 +19586,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 + errorUtilizationPenalty: + description: |- + 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: integer + 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 + 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 @@ -19645,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: |- @@ -19665,12 +19824,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the @@ -19724,15 +19885,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. + 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 == ''ConsistentHash'' + rule: 'self.type in [''ConsistentHash'', + ''ClientSideWeightedRoundRobin''] ? !has(self.zoneAware) : true ' proxyProtocol: description: ProxyProtocol enables the @@ -20730,6 +20899,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 + errorUtilizationPenalty: + description: |- + 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: integer + 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 + 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 @@ -20897,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: |- @@ -20917,12 +21137,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the @@ -20976,15 +21198,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. + 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 == ''ConsistentHash'' + rule: 'self.type in [''ConsistentHash'', + ''ClientSideWeightedRoundRobin''] ? !has(self.zoneAware) : true ' proxyProtocol: description: ProxyProtocol enables the @@ -22076,6 +22306,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 + errorUtilizationPenalty: + description: |- + 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: integer + 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 + 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 @@ -22236,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: |- @@ -22256,12 +22536,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the configuration @@ -22314,15 +22596,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. + 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 == ''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. @@ -23328,6 +23617,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 + errorUtilizationPenalty: + description: |- + 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: integer + 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 + 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 @@ -23484,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: |- @@ -23504,12 +23841,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the configuration @@ -23560,14 +23899,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. + 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 == ''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. @@ -25552,6 +25897,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 + errorUtilizationPenalty: + description: |- + 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: integer + 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 + 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 @@ -25706,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: |- @@ -25726,12 +26119,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the configuration related @@ -25781,14 +26176,19 @@ spec: field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' - - message: Currently SlowStart is only supported for RoundRobin - and LeastRequest load balancers. + - 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, + 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 == ''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. @@ -26692,6 +27092,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 + errorUtilizationPenalty: + description: |- + 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: integer + 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 + 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 @@ -26846,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: |- @@ -26866,12 +27314,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the configuration related @@ -26921,14 +27371,19 @@ spec: field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' - - message: Currently SlowStart is only supported for RoundRobin - and LeastRequest load balancers. + - 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, + 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 == ''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. @@ -28043,6 +28498,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 + errorUtilizationPenalty: + description: |- + 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: integer + 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 + 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 @@ -28200,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: |- @@ -28220,12 +28724,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the configuration @@ -28276,15 +28782,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. + 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 == ''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. @@ -29452,6 +29964,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 + errorUtilizationPenalty: + description: |- + 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: integer + 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 + 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 @@ -29606,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: |- @@ -29626,12 +30186,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "ClientSideWeightedRoundRobin". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - ClientSideWeightedRoundRobin type: string zoneAware: description: ZoneAware defines the configuration related @@ -29681,14 +30243,19 @@ spec: field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' - - message: Currently SlowStart is only supported for RoundRobin - and LeastRequest load balancers. + - 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, + 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 == ''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.