diff --git a/api/v1alpha1/loadbalancer_types.go b/api/v1alpha1/loadbalancer_types.go index 728a4c8f07..bfacd339ea 100644 --- a/api/v1alpha1/loadbalancer_types.go +++ b/api/v1alpha1/loadbalancer_types.go @@ -11,8 +11,10 @@ import gwapiv1 "sigs.k8s.io/gateway-api/apis/v1" // +union // // +kubebuilder:validation:XValidation:rule="self.type == 'ConsistentHash' ? has(self.consistentHash) : !has(self.consistentHash)",message="If LoadBalancer type is consistentHash, consistentHash field needs to be set." -// +kubebuilder:validation:XValidation:rule="self.type 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 == 'BackendUtilization' ? has(self.backendUtilization) : !has(self.backendUtilization)",message="If LoadBalancer type is BackendUtilization, backendUtilization field needs to be set." +// +kubebuilder:validation:XValidation:rule="self.type in ['Random', 'ConsistentHash'] ? !has(self.slowStart) : true ",message="Currently SlowStart is only supported for RoundRobin, LeastRequest, and BackendUtilization load balancers." // +kubebuilder:validation:XValidation:rule="self.type == 'ConsistentHash' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true",message="PreferLocal zone-aware routing is not supported for ConsistentHash load balancers. Use weightedZones instead." +// +kubebuilder:validation:XValidation:rule="self.type == 'BackendUtilization' ? !has(self.zoneAware) : true",message="ZoneAware routing is not supported for BackendUtilization load balancers. BackendUtilization only handles picking endpoints within a single locality." // +kubebuilder:validation:XValidation:rule="has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) && has(self.zoneAware.weightedZones)) : true",message="ZoneAware PreferLocal and WeightedZones cannot be specified together." type LoadBalancer struct { // Type decides the type of Load Balancer policy. @@ -20,7 +22,8 @@ type LoadBalancer struct { // "ConsistentHash", // "LeastRequest", // "Random", - // "RoundRobin". + // "RoundRobin", + // "BackendUtilization". // // +unionDiscriminator Type LoadBalancerType `json:"type"` @@ -30,6 +33,12 @@ type LoadBalancer struct { // +optional ConsistentHash *ConsistentHash `json:"consistentHash,omitempty"` + // BackendUtilization defines the configuration when the load balancer type is + // set to BackendUtilization. + // + // +optional + BackendUtilization *BackendUtilization `json:"backendUtilization,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. @@ -40,7 +49,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 BackendUtilization load balancers. // // +optional SlowStart *SlowStart `json:"slowStart,omitempty"` @@ -52,7 +61,7 @@ type LoadBalancer struct { } // LoadBalancerType specifies the types of LoadBalancer. -// +kubebuilder:validation:Enum=ConsistentHash;LeastRequest;Random;RoundRobin +// +kubebuilder:validation:Enum=ConsistentHash;LeastRequest;Random;RoundRobin;BackendUtilization type LoadBalancerType string const ( @@ -64,6 +73,8 @@ const ( RandomLoadBalancerType LoadBalancerType = "Random" // RoundRobinLoadBalancerType load balancer policy. RoundRobinLoadBalancerType LoadBalancerType = "RoundRobin" + // BackendUtilizationLoadBalancerType load balancer policy. + BackendUtilizationLoadBalancerType LoadBalancerType = "BackendUtilization" ) // ConsistentHash defines the configuration related to the consistent hash @@ -149,6 +160,63 @@ type Cookie struct { Attributes map[string]string `json:"attributes,omitempty"` } +// BackendUtilization defines configuration for Envoy's Backend Utilization policy. +// It uses Open Resource Cost Application (ORCA) load metrics reported by endpoints to make load balancing decisions. +// These metrics are typically sent by the backend service in response headers or trailers. +// +// The backend should report these metrics in header/trailer as one of the following formats: +// - Binary: `endpoint-load-metrics-bin` with base64-encoded serialized `OrcaLoadReport` proto. +// - JSON: `endpoint-load-metrics` with JSON-encoded `OrcaLoadReport` proto, e.g., `JSON {"cpu_utilization": 0.3}`. +// - TEXT: `endpoint-load-metrics` with comma-separated key-value pairs, e.g., `TEXT cpu=0.3,mem=0.8`. +// +// By default, Envoy will forward these ORCA response headers/trailers from the upstream service to the downstream client. +// If the downstream client also uses this information for load balancing, it might lead to unexpected behavior. +// To avoid this, you can use the `HTTPRoute` or `BackendTrafficPolicy` to remove the load report headers before sending the response to the client. +// +// See Envoy proto: envoy.extensions.load_balancing_policies.client_side_weighted_round_robin.v3.ClientSideWeightedRoundRobin +// See ORCA Load Report proto: xds.data.orca.v3.orca_load_report.proto +type BackendUtilization struct { + // A given endpoint must report load metrics continuously for at least this long before the endpoint weight will be used. + // Default is 10s. + // +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"` + + // ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). + // This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + // + // For example: + // - 100 => 1.0x + // - 120 => 1.2x + // - 200 => 2.0x + // + // Note: In the internal IR/XDS configuration this value is converted back to a + // floating point multiplier (value / 100.0). + // + // Must be non-negative. + // +kubebuilder:validation:Minimum=0 + // +optional + ErrorUtilizationPenaltyPercent *uint32 `json:"errorUtilizationPenaltyPercent,omitempty"` + + // Metric names used to compute utilization if application_utilization is not set. + // For map fields in ORCA proto, use the form ".", e.g., "named_metrics.foo". + // +optional + MetricNamesForComputingUtilization []string `json:"metricNamesForComputingUtilization,omitempty"` + + // KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + // Defaults to false. + // +optional + // +kubebuilder:default=false + KeepResponseHeaders *bool `json:"keepResponseHeaders,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 fa78597ad4..265b1a21a5 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -814,6 +814,51 @@ func (in *BackendTrafficPolicySpec) DeepCopy() *BackendTrafficPolicySpec { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BackendUtilization) DeepCopyInto(out *BackendUtilization) { + *out = *in + if in.BlackoutPeriod != nil { + in, out := &in.BlackoutPeriod, &out.BlackoutPeriod + *out = new(v1.Duration) + **out = **in + } + if in.WeightExpirationPeriod != nil { + in, out := &in.WeightExpirationPeriod, &out.WeightExpirationPeriod + *out = new(v1.Duration) + **out = **in + } + if in.WeightUpdatePeriod != nil { + in, out := &in.WeightUpdatePeriod, &out.WeightUpdatePeriod + *out = new(v1.Duration) + **out = **in + } + if in.ErrorUtilizationPenaltyPercent != nil { + in, out := &in.ErrorUtilizationPenaltyPercent, &out.ErrorUtilizationPenaltyPercent + *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.KeepResponseHeaders != nil { + in, out := &in.KeepResponseHeaders, &out.KeepResponseHeaders + *out = new(bool) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackendUtilization. +func (in *BackendUtilization) DeepCopy() *BackendUtilization { + if in == nil { + return nil + } + out := new(BackendUtilization) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *BasicAuth) DeepCopyInto(out *BasicAuth) { *out = *in @@ -5384,6 +5429,11 @@ func (in *LoadBalancer) DeepCopyInto(out *LoadBalancer) { *out = new(ConsistentHash) (*in).DeepCopyInto(*out) } + if in.BackendUtilization != nil { + in, out := &in.BackendUtilization, &out.BackendUtilization + *out = new(BackendUtilization) + (*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 9b86349dd9..afda86ce33 100644 --- a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml +++ b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml @@ -814,6 +814,59 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + backendUtilization: + description: |- + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. + 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 + errorUtilizationPenaltyPercent: + description: |- + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 + minimum: 0 + type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + 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 @@ -960,7 +1013,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 BackendUtilization load balancers. properties: window: description: |- @@ -980,12 +1033,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the configuration related to the @@ -1061,14 +1116,23 @@ 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 BackendUtilization, backendUtilization + field needs to be set. + rule: 'self.type == ''BackendUtilization'' ? has(self.backendUtilization) + : !has(self.backendUtilization)' + - message: Currently SlowStart is only supported for RoundRobin, LeastRequest, + and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: PreferLocal zone-aware routing is not supported for ConsistentHash load balancers. Use weightedZones instead. rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported for BackendUtilization + load balancers. BackendUtilization only handles picking endpoints + within a single locality. + rule: 'self.type == ''BackendUtilization'' ? !has(self.zoneAware) + : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) && diff --git a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml index a04b77498f..c7e8ec264e 100644 --- a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml +++ b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml @@ -896,6 +896,60 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + backendUtilization: + description: |- + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. + 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 + errorUtilizationPenaltyPercent: + description: |- + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 + minimum: 0 + type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + 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 @@ -1048,7 +1102,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 BackendUtilization load balancers. properties: window: description: |- @@ -1068,12 +1122,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the configuration related @@ -1151,8 +1207,12 @@ 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 BackendUtilization, backendUtilization + field needs to be set. + rule: 'self.type == ''BackendUtilization'' ? has(self.backendUtilization) + : !has(self.backendUtilization)' + - message: Currently SlowStart is only supported for RoundRobin, + LeastRequest, and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: PreferLocal zone-aware routing is not supported @@ -1160,6 +1220,11 @@ spec: instead. rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported for BackendUtilization + load balancers. BackendUtilization only handles picking + endpoints within a single locality. + rule: 'self.type == ''BackendUtilization'' ? !has(self.zoneAware) + : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) diff --git a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyproxies.yaml b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyproxies.yaml index 787580c70e..13e375ecea 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 @@ -12160,6 +12160,63 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + backendUtilization: + description: |- + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. + 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 + errorUtilizationPenaltyPercent: + description: |- + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 + minimum: 0 + type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + 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 @@ -12327,7 +12384,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 BackendUtilization load balancers. properties: window: description: |- @@ -12347,12 +12404,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the @@ -12437,9 +12496,14 @@ spec: consistentHash field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' + - message: If LoadBalancer type is BackendUtilization, + backendUtilization field needs to + be set. + rule: 'self.type == ''BackendUtilization'' + ? has(self.backendUtilization) : !has(self.backendUtilization)' - message: Currently SlowStart is only - supported for RoundRobin and LeastRequest - load balancers. + supported for RoundRobin, LeastRequest, + and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: PreferLocal zone-aware routing @@ -12449,6 +12513,12 @@ spec: rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported + for BackendUtilization load balancers. + BackendUtilization only handles picking + endpoints within a single locality. + rule: 'self.type == ''BackendUtilization'' + ? !has(self.zoneAware) : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) @@ -13572,6 +13642,63 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + backendUtilization: + description: |- + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. + 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 + errorUtilizationPenaltyPercent: + description: |- + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 + minimum: 0 + type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + 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 @@ -13739,7 +13866,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 BackendUtilization load balancers. properties: window: description: |- @@ -13759,12 +13886,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the @@ -13849,9 +13978,14 @@ spec: consistentHash field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' + - message: If LoadBalancer type is BackendUtilization, + backendUtilization field needs to + be set. + rule: 'self.type == ''BackendUtilization'' + ? has(self.backendUtilization) : !has(self.backendUtilization)' - message: Currently SlowStart is only - supported for RoundRobin and LeastRequest - load balancers. + supported for RoundRobin, LeastRequest, + and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: PreferLocal zone-aware routing @@ -13861,6 +13995,12 @@ spec: rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported + for BackendUtilization load balancers. + BackendUtilization only handles picking + endpoints within a single locality. + rule: 'self.type == ''BackendUtilization'' + ? !has(self.zoneAware) : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) @@ -15143,6 +15283,62 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + backendUtilization: + description: |- + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. + 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 + errorUtilizationPenaltyPercent: + description: |- + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 + minimum: 0 + type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + 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 @@ -15303,7 +15499,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 BackendUtilization load balancers. properties: window: description: |- @@ -15323,12 +15519,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the configuration @@ -15412,8 +15610,13 @@ spec: consistentHash field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' + - message: If LoadBalancer type is BackendUtilization, + backendUtilization field needs to be set. + rule: 'self.type == ''BackendUtilization'' + ? has(self.backendUtilization) : !has(self.backendUtilization)' - message: Currently SlowStart is only supported - for RoundRobin and LeastRequest load balancers. + for RoundRobin, LeastRequest, and BackendUtilization + load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: PreferLocal zone-aware routing is @@ -15422,6 +15625,12 @@ spec: rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported + for BackendUtilization load balancers. BackendUtilization + only handles picking endpoints within a + single locality. + rule: 'self.type == ''BackendUtilization'' + ? !has(self.zoneAware) : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) @@ -16630,6 +16839,60 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + backendUtilization: + description: |- + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. + 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 + errorUtilizationPenaltyPercent: + description: |- + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 + minimum: 0 + type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + 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 @@ -16786,7 +17049,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 BackendUtilization load balancers. properties: window: description: |- @@ -16806,12 +17069,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the configuration @@ -16892,8 +17157,13 @@ spec: consistentHash field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' + - message: If LoadBalancer type is BackendUtilization, + backendUtilization field needs to be set. + rule: 'self.type == ''BackendUtilization'' ? has(self.backendUtilization) + : !has(self.backendUtilization)' - message: Currently SlowStart is only supported for - RoundRobin and LeastRequest load balancers. + RoundRobin, LeastRequest, and BackendUtilization + load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: PreferLocal zone-aware routing is not supported @@ -16901,6 +17171,12 @@ spec: instead. rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported for + BackendUtilization load balancers. BackendUtilization + only handles picking endpoints within a single + locality. + rule: 'self.type == ''BackendUtilization'' ? !has(self.zoneAware) + : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) diff --git a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_securitypolicies.yaml b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_securitypolicies.yaml index d7383d998c..036df578ba 100644 --- a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_securitypolicies.yaml +++ b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_securitypolicies.yaml @@ -1521,6 +1521,60 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + backendUtilization: + description: |- + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. + 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 + errorUtilizationPenaltyPercent: + description: |- + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 + minimum: 0 + type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + 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 @@ -1675,7 +1729,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 BackendUtilization load balancers. properties: window: description: |- @@ -1695,12 +1749,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the configuration related @@ -1780,8 +1836,12 @@ 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 BackendUtilization, + backendUtilization field needs to be set. + rule: 'self.type == ''BackendUtilization'' ? has(self.backendUtilization) + : !has(self.backendUtilization)' + - message: Currently SlowStart is only supported for RoundRobin, + LeastRequest, and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: PreferLocal zone-aware routing is not supported @@ -1789,6 +1849,11 @@ spec: instead. rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported for BackendUtilization + load balancers. BackendUtilization only handles picking + endpoints within a single locality. + rule: 'self.type == ''BackendUtilization'' ? !has(self.zoneAware) + : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) @@ -2812,6 +2877,60 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + backendUtilization: + description: |- + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. + 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 + errorUtilizationPenaltyPercent: + description: |- + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 + minimum: 0 + type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + 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 @@ -2966,7 +3085,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 BackendUtilization load balancers. properties: window: description: |- @@ -2986,12 +3105,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the configuration related @@ -3071,8 +3192,12 @@ 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 BackendUtilization, + backendUtilization field needs to be set. + rule: 'self.type == ''BackendUtilization'' ? has(self.backendUtilization) + : !has(self.backendUtilization)' + - message: Currently SlowStart is only supported for RoundRobin, + LeastRequest, and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: PreferLocal zone-aware routing is not supported @@ -3080,6 +3205,11 @@ spec: instead. rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported for BackendUtilization + load balancers. BackendUtilization only handles picking + endpoints within a single locality. + rule: 'self.type == ''BackendUtilization'' ? !has(self.zoneAware) + : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) @@ -4360,6 +4490,61 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + backendUtilization: + description: |- + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. + 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 + errorUtilizationPenaltyPercent: + description: |- + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 + minimum: 0 + type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + 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 @@ -4517,7 +4702,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 BackendUtilization load balancers. properties: window: description: |- @@ -4537,12 +4722,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the configuration @@ -4623,8 +4810,13 @@ spec: consistentHash field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' + - message: If LoadBalancer type is BackendUtilization, + backendUtilization field needs to be set. + rule: 'self.type == ''BackendUtilization'' ? has(self.backendUtilization) + : !has(self.backendUtilization)' - message: Currently SlowStart is only supported - for RoundRobin and LeastRequest load balancers. + for RoundRobin, LeastRequest, and BackendUtilization + load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: PreferLocal zone-aware routing is not @@ -4632,6 +4824,12 @@ spec: Use weightedZones instead. rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported for + BackendUtilization load balancers. BackendUtilization + only handles picking endpoints within a single + locality. + rule: 'self.type == ''BackendUtilization'' ? !has(self.zoneAware) + : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) @@ -5927,6 +6125,60 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + backendUtilization: + description: |- + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. + 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 + errorUtilizationPenaltyPercent: + description: |- + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 + minimum: 0 + type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + 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 @@ -6081,7 +6333,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 BackendUtilization load balancers. properties: window: description: |- @@ -6101,12 +6353,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the configuration related @@ -6186,8 +6440,12 @@ 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 BackendUtilization, + backendUtilization field needs to be set. + rule: 'self.type == ''BackendUtilization'' ? has(self.backendUtilization) + : !has(self.backendUtilization)' + - message: Currently SlowStart is only supported for RoundRobin, + LeastRequest, and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: PreferLocal zone-aware routing is not supported @@ -6195,6 +6453,11 @@ spec: instead. rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported for BackendUtilization + load balancers. BackendUtilization only handles picking + endpoints within a single locality. + rule: 'self.type == ''BackendUtilization'' ? !has(self.zoneAware) + : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) diff --git a/charts/gateway-helm/charts/crds/crds/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml b/charts/gateway-helm/charts/crds/crds/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml index 986694cb3a..cbfb90202e 100644 --- a/charts/gateway-helm/charts/crds/crds/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml +++ b/charts/gateway-helm/charts/crds/crds/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml @@ -813,6 +813,59 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + backendUtilization: + description: |- + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. + 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 + errorUtilizationPenaltyPercent: + description: |- + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 + minimum: 0 + type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + 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 @@ -959,7 +1012,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 BackendUtilization load balancers. properties: window: description: |- @@ -979,12 +1032,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the configuration related to the @@ -1060,14 +1115,23 @@ 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 BackendUtilization, backendUtilization + field needs to be set. + rule: 'self.type == ''BackendUtilization'' ? has(self.backendUtilization) + : !has(self.backendUtilization)' + - message: Currently SlowStart is only supported for RoundRobin, LeastRequest, + and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: PreferLocal zone-aware routing is not supported for ConsistentHash load balancers. Use weightedZones instead. rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported for BackendUtilization + load balancers. BackendUtilization only handles picking endpoints + within a single locality. + rule: 'self.type == ''BackendUtilization'' ? !has(self.zoneAware) + : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) && diff --git a/charts/gateway-helm/charts/crds/crds/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml b/charts/gateway-helm/charts/crds/crds/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml index 7cf9d621f3..7813492774 100644 --- a/charts/gateway-helm/charts/crds/crds/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml +++ b/charts/gateway-helm/charts/crds/crds/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml @@ -895,6 +895,60 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + backendUtilization: + description: |- + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. + 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 + errorUtilizationPenaltyPercent: + description: |- + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 + minimum: 0 + type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + 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 @@ -1047,7 +1101,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 BackendUtilization load balancers. properties: window: description: |- @@ -1067,12 +1121,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the configuration related @@ -1150,8 +1206,12 @@ 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 BackendUtilization, backendUtilization + field needs to be set. + rule: 'self.type == ''BackendUtilization'' ? has(self.backendUtilization) + : !has(self.backendUtilization)' + - message: Currently SlowStart is only supported for RoundRobin, + LeastRequest, and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: PreferLocal zone-aware routing is not supported @@ -1159,6 +1219,11 @@ spec: instead. rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported for BackendUtilization + load balancers. BackendUtilization only handles picking + endpoints within a single locality. + rule: 'self.type == ''BackendUtilization'' ? !has(self.zoneAware) + : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) diff --git a/charts/gateway-helm/charts/crds/crds/generated/gateway.envoyproxy.io_envoyproxies.yaml b/charts/gateway-helm/charts/crds/crds/generated/gateway.envoyproxy.io_envoyproxies.yaml index 1c25014f18..9a0e434883 100644 --- a/charts/gateway-helm/charts/crds/crds/generated/gateway.envoyproxy.io_envoyproxies.yaml +++ b/charts/gateway-helm/charts/crds/crds/generated/gateway.envoyproxy.io_envoyproxies.yaml @@ -12159,6 +12159,63 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + backendUtilization: + description: |- + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. + 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 + errorUtilizationPenaltyPercent: + description: |- + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 + minimum: 0 + type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + 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 @@ -12326,7 +12383,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 BackendUtilization load balancers. properties: window: description: |- @@ -12346,12 +12403,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the @@ -12436,9 +12495,14 @@ spec: consistentHash field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' + - message: If LoadBalancer type is BackendUtilization, + backendUtilization field needs to + be set. + rule: 'self.type == ''BackendUtilization'' + ? has(self.backendUtilization) : !has(self.backendUtilization)' - message: Currently SlowStart is only - supported for RoundRobin and LeastRequest - load balancers. + supported for RoundRobin, LeastRequest, + and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: PreferLocal zone-aware routing @@ -12448,6 +12512,12 @@ spec: rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported + for BackendUtilization load balancers. + BackendUtilization only handles picking + endpoints within a single locality. + rule: 'self.type == ''BackendUtilization'' + ? !has(self.zoneAware) : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) @@ -13571,6 +13641,63 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + backendUtilization: + description: |- + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. + 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 + errorUtilizationPenaltyPercent: + description: |- + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 + minimum: 0 + type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + 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 @@ -13738,7 +13865,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 BackendUtilization load balancers. properties: window: description: |- @@ -13758,12 +13885,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the @@ -13848,9 +13977,14 @@ spec: consistentHash field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' + - message: If LoadBalancer type is BackendUtilization, + backendUtilization field needs to + be set. + rule: 'self.type == ''BackendUtilization'' + ? has(self.backendUtilization) : !has(self.backendUtilization)' - message: Currently SlowStart is only - supported for RoundRobin and LeastRequest - load balancers. + supported for RoundRobin, LeastRequest, + and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: PreferLocal zone-aware routing @@ -13860,6 +13994,12 @@ spec: rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported + for BackendUtilization load balancers. + BackendUtilization only handles picking + endpoints within a single locality. + rule: 'self.type == ''BackendUtilization'' + ? !has(self.zoneAware) : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) @@ -15142,6 +15282,62 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + backendUtilization: + description: |- + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. + 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 + errorUtilizationPenaltyPercent: + description: |- + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 + minimum: 0 + type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + 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 @@ -15302,7 +15498,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 BackendUtilization load balancers. properties: window: description: |- @@ -15322,12 +15518,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the configuration @@ -15411,8 +15609,13 @@ spec: consistentHash field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' + - message: If LoadBalancer type is BackendUtilization, + backendUtilization field needs to be set. + rule: 'self.type == ''BackendUtilization'' + ? has(self.backendUtilization) : !has(self.backendUtilization)' - message: Currently SlowStart is only supported - for RoundRobin and LeastRequest load balancers. + for RoundRobin, LeastRequest, and BackendUtilization + load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: PreferLocal zone-aware routing is @@ -15421,6 +15624,12 @@ spec: rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported + for BackendUtilization load balancers. BackendUtilization + only handles picking endpoints within a + single locality. + rule: 'self.type == ''BackendUtilization'' + ? !has(self.zoneAware) : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) @@ -16629,6 +16838,60 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + backendUtilization: + description: |- + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. + 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 + errorUtilizationPenaltyPercent: + description: |- + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 + minimum: 0 + type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + 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 @@ -16785,7 +17048,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 BackendUtilization load balancers. properties: window: description: |- @@ -16805,12 +17068,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the configuration @@ -16891,8 +17156,13 @@ spec: consistentHash field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' + - message: If LoadBalancer type is BackendUtilization, + backendUtilization field needs to be set. + rule: 'self.type == ''BackendUtilization'' ? has(self.backendUtilization) + : !has(self.backendUtilization)' - message: Currently SlowStart is only supported for - RoundRobin and LeastRequest load balancers. + RoundRobin, LeastRequest, and BackendUtilization + load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: PreferLocal zone-aware routing is not supported @@ -16900,6 +17170,12 @@ spec: instead. rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported for + BackendUtilization load balancers. BackendUtilization + only handles picking endpoints within a single + locality. + rule: 'self.type == ''BackendUtilization'' ? !has(self.zoneAware) + : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) diff --git a/charts/gateway-helm/charts/crds/crds/generated/gateway.envoyproxy.io_securitypolicies.yaml b/charts/gateway-helm/charts/crds/crds/generated/gateway.envoyproxy.io_securitypolicies.yaml index eb2f7e7711..70989ce35b 100644 --- a/charts/gateway-helm/charts/crds/crds/generated/gateway.envoyproxy.io_securitypolicies.yaml +++ b/charts/gateway-helm/charts/crds/crds/generated/gateway.envoyproxy.io_securitypolicies.yaml @@ -1520,6 +1520,60 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + backendUtilization: + description: |- + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. + 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 + errorUtilizationPenaltyPercent: + description: |- + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 + minimum: 0 + type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + 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 @@ -1674,7 +1728,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 BackendUtilization load balancers. properties: window: description: |- @@ -1694,12 +1748,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the configuration related @@ -1779,8 +1835,12 @@ 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 BackendUtilization, + backendUtilization field needs to be set. + rule: 'self.type == ''BackendUtilization'' ? has(self.backendUtilization) + : !has(self.backendUtilization)' + - message: Currently SlowStart is only supported for RoundRobin, + LeastRequest, and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: PreferLocal zone-aware routing is not supported @@ -1788,6 +1848,11 @@ spec: instead. rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported for BackendUtilization + load balancers. BackendUtilization only handles picking + endpoints within a single locality. + rule: 'self.type == ''BackendUtilization'' ? !has(self.zoneAware) + : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) @@ -2811,6 +2876,60 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + backendUtilization: + description: |- + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. + 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 + errorUtilizationPenaltyPercent: + description: |- + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 + minimum: 0 + type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + 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 @@ -2965,7 +3084,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 BackendUtilization load balancers. properties: window: description: |- @@ -2985,12 +3104,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the configuration related @@ -3070,8 +3191,12 @@ 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 BackendUtilization, + backendUtilization field needs to be set. + rule: 'self.type == ''BackendUtilization'' ? has(self.backendUtilization) + : !has(self.backendUtilization)' + - message: Currently SlowStart is only supported for RoundRobin, + LeastRequest, and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: PreferLocal zone-aware routing is not supported @@ -3079,6 +3204,11 @@ spec: instead. rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported for BackendUtilization + load balancers. BackendUtilization only handles picking + endpoints within a single locality. + rule: 'self.type == ''BackendUtilization'' ? !has(self.zoneAware) + : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) @@ -4359,6 +4489,61 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + backendUtilization: + description: |- + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. + 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 + errorUtilizationPenaltyPercent: + description: |- + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 + minimum: 0 + type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + 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 @@ -4516,7 +4701,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 BackendUtilization load balancers. properties: window: description: |- @@ -4536,12 +4721,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the configuration @@ -4622,8 +4809,13 @@ spec: consistentHash field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' + - message: If LoadBalancer type is BackendUtilization, + backendUtilization field needs to be set. + rule: 'self.type == ''BackendUtilization'' ? has(self.backendUtilization) + : !has(self.backendUtilization)' - message: Currently SlowStart is only supported - for RoundRobin and LeastRequest load balancers. + for RoundRobin, LeastRequest, and BackendUtilization + load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: PreferLocal zone-aware routing is not @@ -4631,6 +4823,12 @@ spec: Use weightedZones instead. rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported for + BackendUtilization load balancers. BackendUtilization + only handles picking endpoints within a single + locality. + rule: 'self.type == ''BackendUtilization'' ? !has(self.zoneAware) + : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) @@ -5926,6 +6124,60 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + backendUtilization: + description: |- + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. + 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 + errorUtilizationPenaltyPercent: + description: |- + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 + minimum: 0 + type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + 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 @@ -6080,7 +6332,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 BackendUtilization load balancers. properties: window: description: |- @@ -6100,12 +6352,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the configuration related @@ -6185,8 +6439,12 @@ 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 BackendUtilization, + backendUtilization field needs to be set. + rule: 'self.type == ''BackendUtilization'' ? has(self.backendUtilization) + : !has(self.backendUtilization)' + - message: Currently SlowStart is only supported for RoundRobin, + LeastRequest, and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: PreferLocal zone-aware routing is not supported @@ -6194,6 +6452,11 @@ spec: instead. rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported for BackendUtilization + load balancers. BackendUtilization only handles picking + endpoints within a single locality. + rule: 'self.type == ''BackendUtilization'' ? !has(self.zoneAware) + : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) diff --git a/internal/gatewayapi/backendtrafficpolicy.go b/internal/gatewayapi/backendtrafficpolicy.go index 6e3649b7dd..0729fc456a 100644 --- a/internal/gatewayapi/backendtrafficpolicy.go +++ b/internal/gatewayapi/backendtrafficpolicy.go @@ -967,6 +967,24 @@ func (t *Translator) applyTrafficFeatureToRoute(route RouteContext, r.Traffic = tf.DeepCopy() + if r.Traffic != nil && r.Traffic.LoadBalancer != nil && + r.Traffic.LoadBalancer.BackendUtilization != nil && + !ptr.Deref(r.Traffic.LoadBalancer.BackendUtilization.KeepResponseHeaders, false) { + headersToRemove := []string{"endpoint-load-metrics", "endpoint-load-metrics-bin"} + for _, h := range headersToRemove { + found := false + for _, existing := range r.RemoveResponseHeaders { + if existing == h { + found = true + break + } + } + if !found { + r.RemoveResponseHeaders = append(r.RemoveResponseHeaders, h) + } + } + } + if localTo, err := buildClusterSettingsTimeout(&policy.Spec.ClusterSettings); err == nil { r.Traffic.Timeout = localTo } diff --git a/internal/gatewayapi/backendtrafficpolicy_test.go b/internal/gatewayapi/backendtrafficpolicy_test.go index 94279f3eb4..db216f193b 100644 --- a/internal/gatewayapi/backendtrafficpolicy_test.go +++ b/internal/gatewayapi/backendtrafficpolicy_test.go @@ -225,8 +225,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), }, @@ -243,8 +243,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), @@ -267,11 +267,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), AlwaysEjectOneEndpoint: ptr.To(true), diff --git a/internal/gatewayapi/clienttrafficpolicy.go b/internal/gatewayapi/clienttrafficpolicy.go index 27633a0d3e..1274017dcf 100644 --- a/internal/gatewayapi/clienttrafficpolicy.go +++ b/internal/gatewayapi/clienttrafficpolicy.go @@ -1068,7 +1068,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 { @@ -1080,7 +1080,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 d5aa06c98b..9ce778a00a 100644 --- a/internal/gatewayapi/clustersettings.go +++ b/internal/gatewayapi/clustersettings.go @@ -149,7 +149,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) } } @@ -357,6 +357,50 @@ func buildLoadBalancer(policy *egv1a1.ClusterSettings) (*ir.LoadBalancer, error) Window: ir.MetaV1DurationPtr(d), } } + case egv1a1.BackendUtilizationLoadBalancerType: + lb = &ir.LoadBalancer{ + BackendUtilization: &ir.BackendUtilization{}, + } + backendUtilization := policy.LoadBalancer.BackendUtilization + if backendUtilization != nil { + if backendUtilization.BlackoutPeriod != nil { + d, err := time.ParseDuration(string(*backendUtilization.BlackoutPeriod)) + if err != nil { + return nil, fmt.Errorf("invalid BlackoutPeriod value %s: %w", *backendUtilization.BlackoutPeriod, err) + } + lb.BackendUtilization.BlackoutPeriod = ir.MetaV1DurationPtr(d) + } + if backendUtilization.WeightExpirationPeriod != nil { + d, err := time.ParseDuration(string(*backendUtilization.WeightExpirationPeriod)) + if err != nil { + return nil, fmt.Errorf("invalid WeightExpirationPeriod value %s: %w", *backendUtilization.WeightExpirationPeriod, err) + } + lb.BackendUtilization.WeightExpirationPeriod = ir.MetaV1DurationPtr(d) + } + if backendUtilization.WeightUpdatePeriod != nil { + d, err := time.ParseDuration(string(*backendUtilization.WeightUpdatePeriod)) + if err != nil { + return nil, fmt.Errorf("invalid WeightUpdatePeriod value %s: %w", *backendUtilization.WeightUpdatePeriod, err) + } + lb.BackendUtilization.WeightUpdatePeriod = ir.MetaV1DurationPtr(d) + } + if backendUtilization.ErrorUtilizationPenaltyPercent != nil { + lb.BackendUtilization.ErrorUtilizationPenaltyPercent = ptr.To(*backendUtilization.ErrorUtilizationPenaltyPercent) + } + if len(backendUtilization.MetricNamesForComputingUtilization) > 0 { + lb.BackendUtilization.MetricNamesForComputingUtilization = append([]string(nil), backendUtilization.MetricNamesForComputingUtilization...) + } + lb.BackendUtilization.KeepResponseHeaders = ptr.To(ptr.Deref(backendUtilization.KeepResponseHeaders, false)) + } + if policy.LoadBalancer.SlowStart != nil && policy.LoadBalancer.SlowStart.Window != nil { + d, err := time.ParseDuration(string(*policy.LoadBalancer.SlowStart.Window)) + if err != nil { + return nil, err + } + lb.BackendUtilization.SlowStart = &ir.SlowStart{ + Window: ir.MetaV1DurationPtr(d), + } + } } // Add ZoneAware loadbalancer settings diff --git a/internal/gatewayapi/clustersettings_backendutilization_test.go b/internal/gatewayapi/clustersettings_backendutilization_test.go new file mode 100644 index 0000000000..bd4b40b82f --- /dev/null +++ b/internal/gatewayapi/clustersettings_backendutilization_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_BackendUtilization(t *testing.T) { + backendUtilization := &egv1a1.BackendUtilization{ + BlackoutPeriod: ptr.To(gwapiv1.Duration("10s")), + WeightExpirationPeriod: ptr.To(gwapiv1.Duration("3m")), + WeightUpdatePeriod: ptr.To(gwapiv1.Duration("1s")), + ErrorUtilizationPenaltyPercent: ptr.To[uint32](150), + MetricNamesForComputingUtilization: []string{"named_metrics.foo", "cpu_utilization"}, + } + + policy := &egv1a1.ClusterSettings{ + LoadBalancer: &egv1a1.LoadBalancer{ + Type: egv1a1.BackendUtilizationLoadBalancerType, + BackendUtilization: backendUtilization, + }, + } + + lb, err := buildLoadBalancer(policy) + require.NoError(t, err) + require.NotNil(t, lb) + require.NotNil(t, lb.BackendUtilization) + + got := lb.BackendUtilization + require.Equal(t, ir.MetaV1DurationPtr(10*time.Second), got.BlackoutPeriod) + require.Equal(t, ir.MetaV1DurationPtr(3*time.Minute), got.WeightExpirationPeriod) + require.Equal(t, ir.MetaV1DurationPtr(1*time.Second), got.WeightUpdatePeriod) + require.NotNil(t, got.ErrorUtilizationPenaltyPercent) + require.EqualValues(t, 150, *got.ErrorUtilizationPenaltyPercent) + require.Equal(t, []string{"named_metrics.foo", "cpu_utilization"}, got.MetricNamesForComputingUtilization) +} diff --git a/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer-remove-headers.in.yaml b/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer-remove-headers.in.yaml new file mode 100644 index 0000000000..1d0c017c11 --- /dev/null +++ b/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer-remove-headers.in.yaml @@ -0,0 +1,50 @@ +gateways: + - apiVersion: gateway.networking.k8s.io/v1 + kind: Gateway + metadata: + namespace: envoy-gateway + name: gateway-1 + spec: + gatewayClassName: envoy-gateway-class + listeners: + - name: http + protocol: HTTP + port: 80 + allowedRoutes: + namespaces: + from: All +httpRoutes: + - apiVersion: gateway.networking.k8s.io/v1 + kind: HTTPRoute + metadata: + namespace: default + name: httproute-1 + spec: + hostnames: + - gateway.envoyproxy.io + parentRefs: + - namespace: envoy-gateway + name: gateway-1 + sectionName: http + rules: + - matches: + - path: + value: "/" + backendRefs: + - name: service-1 + port: 8080 +backendTrafficPolicies: + - apiVersion: gateway.envoyproxy.io/v1alpha1 + kind: BackendTrafficPolicy + metadata: + namespace: default + name: policy-for-route + spec: + targetRefs: + - group: gateway.networking.k8s.io + kind: HTTPRoute + name: httproute-1 + loadBalancer: + type: BackendUtilization + backendUtilization: + keepResponseHeaders: false diff --git a/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer-remove-headers.out.yaml b/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer-remove-headers.out.yaml new file mode 100644 index 0000000000..33e871f526 --- /dev/null +++ b/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer-remove-headers.out.yaml @@ -0,0 +1,215 @@ +backendTrafficPolicies: +- apiVersion: gateway.envoyproxy.io/v1alpha1 + kind: BackendTrafficPolicy + metadata: + name: policy-for-route + namespace: default + spec: + loadBalancer: + backendUtilization: + keepResponseHeaders: false + type: BackendUtilization + targetRefs: + - group: gateway.networking.k8s.io + kind: HTTPRoute + name: httproute-1 + status: + ancestors: + - ancestorRef: + group: gateway.networking.k8s.io + kind: Gateway + name: gateway-1 + namespace: envoy-gateway + sectionName: http + conditions: + - lastTransitionTime: null + message: Policy has been accepted. + reason: Accepted + status: "True" + type: Accepted + controllerName: gateway.envoyproxy.io/gatewayclass-controller +gateways: +- apiVersion: gateway.networking.k8s.io/v1 + kind: Gateway + metadata: + name: gateway-1 + namespace: envoy-gateway + spec: + gatewayClassName: envoy-gateway-class + listeners: + - allowedRoutes: + namespaces: + from: All + name: http + port: 80 + protocol: HTTP + status: + listeners: + - attachedRoutes: 1 + conditions: + - lastTransitionTime: null + message: Sending translated listener configuration to the data plane + reason: Programmed + status: "True" + type: Programmed + - lastTransitionTime: null + message: Listener has been successfully translated + reason: Accepted + status: "True" + type: Accepted + - lastTransitionTime: null + message: Listener references have been resolved + reason: ResolvedRefs + status: "True" + type: ResolvedRefs + name: http + supportedKinds: + - group: gateway.networking.k8s.io + kind: HTTPRoute + - group: gateway.networking.k8s.io + kind: GRPCRoute +httpRoutes: +- apiVersion: gateway.networking.k8s.io/v1 + kind: HTTPRoute + metadata: + name: httproute-1 + namespace: default + spec: + hostnames: + - gateway.envoyproxy.io + parentRefs: + - name: gateway-1 + namespace: envoy-gateway + sectionName: http + rules: + - backendRefs: + - name: service-1 + port: 8080 + matches: + - path: + value: / + status: + parents: + - conditions: + - lastTransitionTime: null + message: Route is accepted + reason: Accepted + status: "True" + type: Accepted + - lastTransitionTime: null + message: Resolved all the Object references for the Route + reason: ResolvedRefs + status: "True" + type: ResolvedRefs + controllerName: gateway.envoyproxy.io/gatewayclass-controller + parentRef: + name: gateway-1 + namespace: envoy-gateway + sectionName: http +infraIR: + envoy-gateway/gateway-1: + proxy: + listeners: + - name: envoy-gateway/gateway-1/http + ports: + - containerPort: 10080 + name: http-80 + protocol: HTTP + servicePort: 80 + metadata: + labels: + gateway.envoyproxy.io/owning-gateway-name: gateway-1 + gateway.envoyproxy.io/owning-gateway-namespace: envoy-gateway + ownerReference: + kind: GatewayClass + name: envoy-gateway-class + name: envoy-gateway/gateway-1 + namespace: envoy-gateway-system +xdsIR: + envoy-gateway/gateway-1: + accessLog: + json: + - path: /dev/stdout + globalResources: + proxyServiceCluster: + metadata: + kind: Service + name: envoy-envoy-gateway-gateway-1-196ae069 + namespace: envoy-gateway-system + sectionName: "8080" + name: envoy-gateway/gateway-1 + settings: + - addressType: IP + endpoints: + - host: 7.6.5.4 + port: 8080 + zone: zone1 + metadata: + kind: Service + name: envoy-envoy-gateway-gateway-1-196ae069 + namespace: envoy-gateway-system + sectionName: "8080" + name: envoy-gateway/gateway-1 + protocol: TCP + http: + - address: 0.0.0.0 + externalPort: 80 + hostnames: + - '*' + metadata: + kind: Gateway + name: gateway-1 + namespace: envoy-gateway + sectionName: http + name: envoy-gateway/gateway-1/http + path: + escapedSlashesAction: UnescapeAndRedirect + mergeSlashes: true + port: 10080 + routes: + - destination: + metadata: + kind: HTTPRoute + name: httproute-1 + namespace: default + name: httproute/default/httproute-1/rule/0 + settings: + - addressType: IP + endpoints: + - host: 7.7.7.7 + port: 8080 + metadata: + kind: Service + name: service-1 + namespace: default + sectionName: "8080" + name: httproute/default/httproute-1/rule/0/backend/0 + protocol: HTTP + weight: 1 + hostname: gateway.envoyproxy.io + isHTTP2: false + metadata: + kind: HTTPRoute + name: httproute-1 + namespace: default + policies: + - kind: BackendTrafficPolicy + name: policy-for-route + namespace: default + name: httproute/default/httproute-1/rule/0/match/0/gateway_envoyproxy_io + pathMatch: + distinct: false + name: "" + prefix: / + removeResponseHeaders: + - endpoint-load-metrics + - endpoint-load-metrics-bin + traffic: + loadBalancer: + backendUtilization: + keepResponseHeaders: false + readyListener: + address: 0.0.0.0 + ipFamily: IPv4 + path: /ready + port: 19003 diff --git a/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer.in.yaml b/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer.in.yaml index 4cffd67140..56b54f786d 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: BackendUtilization + slowStart: + window: 300s + backendUtilization: + blackoutPeriod: 10s + weightExpirationPeriod: 60s + weightUpdatePeriod: 10s + errorUtilizationPenaltyPercent: 100 + metricNamesForComputingUtilization: + - "cpu_utilization" diff --git a/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer.out.yaml b/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer.out.yaml index 9284aadd13..d83171cdf6 100644 --- a/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer.out.yaml +++ b/internal/gatewayapi/testdata/backendtrafficpolicy-with-loadbalancer.out.yaml @@ -140,6 +140,47 @@ backendTrafficPolicies: status: "True" type: Warning controllerName: gateway.envoyproxy.io/gatewayclass-controller +- apiVersion: gateway.envoyproxy.io/v1alpha1 + kind: BackendTrafficPolicy + metadata: + name: policy-for-route5 + namespace: default + spec: + loadBalancer: + backendUtilization: + blackoutPeriod: 10s + errorUtilizationPenaltyPercent: 100 + metricNamesForComputingUtilization: + - cpu_utilization + weightExpirationPeriod: 60s + weightUpdatePeriod: 10s + slowStart: + window: 300s + type: BackendUtilization + 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 + - lastTransitionTime: null + message: spec.targetRef is deprecated, use spec.targetRefs instead + reason: DeprecatedField + status: "True" + type: Warning + controllerName: gateway.envoyproxy.io/gatewayclass-controller - apiVersion: gateway.envoyproxy.io/v1alpha1 kind: BackendTrafficPolicy metadata: @@ -212,7 +253,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 @@ -273,7 +314,7 @@ gateways: protocol: HTTP status: listeners: - - attachedRoutes: 4 + - attachedRoutes: 5 conditions: - lastTransitionTime: null message: Sending translated listener configuration to the data plane @@ -478,6 +519,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: @@ -756,6 +834,55 @@ 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 + policies: + - kind: BackendTrafficPolicy + name: policy-for-route5 + namespace: default + name: httproute/default/httproute-5/rule/0/match/0/gateway_envoyproxy_io + pathMatch: + distinct: false + name: "" + prefix: /test5 + removeResponseHeaders: + - endpoint-load-metrics + - endpoint-load-metrics-bin + traffic: + loadBalancer: + backendUtilization: + blackoutPeriod: 10s + errorUtilizationPenaltyPercent: 100 + keepResponseHeaders: false + 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 3608006232..1935c3d007 100644 --- a/internal/ir/xds.go +++ b/internal/ir/xds.go @@ -2762,6 +2762,8 @@ type LoadBalancer struct { Random *Random `json:"random,omitempty" yaml:"random,omitempty"` // ConsistentHash load balancer policy ConsistentHash *ConsistentHash `json:"consistentHash,omitempty" yaml:"consistentHash,omitempty"` + // BackendUtilization load balancer policy + BackendUtilization *BackendUtilization `json:"backendUtilization,omitempty" yaml:"backendUtilization,omitempty"` // PreferLocal defines the configuration related to the distribution of requests between locality zones. PreferLocal *PreferLocalZone `json:"preferLocal,omitempty" yaml:"preferLocal,omitempty"` // WeightedZones defines explicit weight-based traffic distribution across locality zones. @@ -2789,6 +2791,9 @@ func (l *LoadBalancer) Validate() error { if l.ConsistentHash != nil { matchCount++ } + if l.BackendUtilization != nil { + matchCount++ + } if matchCount != 1 { errs = errors.Join(errs, ErrLoadBalancerInvalid) } @@ -2816,6 +2821,18 @@ type LeastRequest struct { // +k8s:deepcopy-gen=true type Random struct{} +// BackendUtilization load balancer settings +// +k8s:deepcopy-gen=true +type BackendUtilization struct { + BlackoutPeriod *metav1.Duration `json:"blackoutPeriod,omitempty" yaml:"blackoutPeriod,omitempty"` + WeightExpirationPeriod *metav1.Duration `json:"weightExpirationPeriod,omitempty" yaml:"weightExpirationPeriod,omitempty"` + WeightUpdatePeriod *metav1.Duration `json:"weightUpdatePeriod,omitempty" yaml:"weightUpdatePeriod,omitempty"` + ErrorUtilizationPenaltyPercent *uint32 `json:"errorUtilizationPenaltyPercent,omitempty" yaml:"errorUtilizationPenaltyPercent,omitempty"` + MetricNamesForComputingUtilization []string `json:"metricNamesForComputingUtilization,omitempty" yaml:"metricNamesForComputingUtilization,omitempty"` + SlowStart *SlowStart `json:"slowStart,omitempty" yaml:"slowStart,omitempty"` + KeepResponseHeaders *bool `json:"keepResponseHeaders,omitempty" yaml:"keepResponseHeaders,omitempty"` +} + // ConsistentHash load balancer settings // +k8s:deepcopy-gen=true type ConsistentHash struct { @@ -3616,4 +3633,6 @@ const ( RandomLoadBalancer LoadBalancerType = "Random" // ConsistentHashLoadBalancer is the consistent hash load balancer type. ConsistentHashLoadBalancer LoadBalancerType = "ConsistentHash" + // BackendUtilizationLoadBalancer is the backend utilization load balancer type. + BackendUtilizationLoadBalancer LoadBalancerType = "BackendUtilization" ) diff --git a/internal/ir/xds_test.go b/internal/ir/xds_test.go index 56d272b062..ed6c93383c 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: "backend utilization set", + input: LoadBalancer{ + BackendUtilization: &BackendUtilization{ + 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 2aa94a000c..7b12f52785 100644 --- a/internal/ir/zz_generated.deepcopy.go +++ b/internal/ir/zz_generated.deepcopy.go @@ -478,6 +478,56 @@ func (in *BackendTracing) DeepCopy() *BackendTracing { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BackendUtilization) DeepCopyInto(out *BackendUtilization) { + *out = *in + if in.BlackoutPeriod != nil { + in, out := &in.BlackoutPeriod, &out.BlackoutPeriod + *out = new(metav1.Duration) + **out = **in + } + if in.WeightExpirationPeriod != nil { + in, out := &in.WeightExpirationPeriod, &out.WeightExpirationPeriod + *out = new(metav1.Duration) + **out = **in + } + if in.WeightUpdatePeriod != nil { + in, out := &in.WeightUpdatePeriod, &out.WeightUpdatePeriod + *out = new(metav1.Duration) + **out = **in + } + if in.ErrorUtilizationPenaltyPercent != nil { + in, out := &in.ErrorUtilizationPenaltyPercent, &out.ErrorUtilizationPenaltyPercent + *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) + } + if in.KeepResponseHeaders != nil { + in, out := &in.KeepResponseHeaders, &out.KeepResponseHeaders + *out = new(bool) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackendUtilization. +func (in *BackendUtilization) DeepCopy() *BackendUtilization { + if in == nil { + return nil + } + out := new(BackendUtilization) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *BasicAuth) DeepCopyInto(out *BasicAuth) { *out = *in @@ -2743,6 +2793,11 @@ func (in *LoadBalancer) DeepCopyInto(out *LoadBalancer) { *out = new(ConsistentHash) (*in).DeepCopyInto(*out) } + if in.BackendUtilization != nil { + in, out := &in.BackendUtilization, &out.BackendUtilization + *out = new(BackendUtilization) + (*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 8ba65698d5..674520c4c1 100644 --- a/internal/xds/translator/cluster.go +++ b/internal/xds/translator/cluster.go @@ -20,6 +20,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" @@ -446,6 +447,41 @@ func buildXdsCluster(args *xdsClusterArgs) (*buildClusterResult, error) { }, }}, } + case args.loadBalancer.BackendUtilization != nil: + cswrr := &cswrrv3.ClientSideWeightedRoundRobin{} + v := args.loadBalancer.BackendUtilization + if v.BlackoutPeriod != nil && v.BlackoutPeriod.Duration > 0 { + cswrr.BlackoutPeriod = durationpb.New(v.BlackoutPeriod.Duration) + } + if v.WeightExpirationPeriod != nil && v.WeightExpirationPeriod.Duration > 0 { + cswrr.WeightExpirationPeriod = durationpb.New(v.WeightExpirationPeriod.Duration) + } + if v.WeightUpdatePeriod != nil && v.WeightUpdatePeriod.Duration > 0 { + cswrr.WeightUpdatePeriod = durationpb.New(v.WeightUpdatePeriod.Duration) + } + if v.SlowStart != nil && v.SlowStart.Window != nil && v.SlowStart.Window.Duration > 0 { + cswrr.SlowStartConfig = &commonv3.SlowStartConfig{ + SlowStartWindow: durationpb.New(v.SlowStart.Window.Duration), + } + } + if v.ErrorUtilizationPenaltyPercent != nil { + cswrr.ErrorUtilizationPenalty = wrapperspb.Float(float32(*v.ErrorUtilizationPenaltyPercent) / 100.0) + } + if len(v.MetricNamesForComputingUtilization) > 0 { + cswrr.MetricNamesForComputingUtilization = append([]string(nil), v.MetricNamesForComputingUtilization...) + } + typedCSWRR, err := proto.ToAnyWithValidation(cswrr) + if err != nil { + return nil, err + } + 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 { @@ -1510,6 +1546,8 @@ func buildEndpointOverrideLoadBalancingPolicy(loadBalancer *ir.LoadBalancer) (*c fallbackType = ir.RandomLoadBalancer case loadBalancer.ConsistentHash != nil: fallbackType = ir.ConsistentHashLoadBalancer + case loadBalancer.BackendUtilization != nil: + fallbackType = ir.BackendUtilizationLoadBalancer default: // Default to LeastRequest if no specific type is set fallbackType = ir.LeastRequestLoadBalancer @@ -1605,6 +1643,21 @@ func buildFallbackLoadBalancingPolicy(fallbackType ir.LoadBalancerType) (*cluste }, }, }, nil + case ir.BackendUtilizationLoadBalancer: + fallbackPolicyAny, err := anypb.New(&cswrrv3.ClientSideWeightedRoundRobin{}) + if err != nil { + return nil, fmt.Errorf("failed to marshal BackendUtilization 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 5a24536d77..2b65f77131 100644 --- a/internal/xds/translator/cluster_test.go +++ b/internal/xds/translator/cluster_test.go @@ -12,13 +12,13 @@ import ( bootstrapv3 "github.com/envoyproxy/go-control-plane/envoy/config/bootstrap/v3" clusterv3 "github.com/envoyproxy/go-control-plane/envoy/config/cluster/v3" endpointv3 "github.com/envoyproxy/go-control-plane/envoy/config/endpoint/v3" + cswrrv3 "github.com/envoyproxy/go-control-plane/envoy/extensions/load_balancing_policies/client_side_weighted_round_robin/v3" "github.com/google/go-cmp/cmp" "github.com/stretchr/testify/require" "google.golang.org/protobuf/encoding/protojson" "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" @@ -152,8 +152,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), }, @@ -167,8 +167,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), @@ -186,11 +186,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), AlwaysEjectOneEndpoint: ptr.To(true), @@ -223,6 +223,68 @@ func requireCmpNoDiff(t *testing.T, expected, actual interface{}) { require.Empty(t, cmp.Diff(expected, actual, protocmp.Transform())) } +func TestBuildClusterWithBackendUtilization(t *testing.T) { + args := &xdsClusterArgs{ + name: "test-cluster-bu", + endpointType: EndpointTypeStatic, + settings: []*ir.DestinationSetting{{ + Endpoints: []*ir.DestinationEndpoint{{Host: "127.0.0.1", Port: 8080}}, + }}, + loadBalancer: &ir.LoadBalancer{BackendUtilization: &ir.BackendUtilization{}}, + } + + 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 TestBuildClusterWithBackendUtilizationSlowStart(t *testing.T) { + window := 5 * time.Second + args := &xdsClusterArgs{ + name: "test-cluster-bu-ss", + endpointType: EndpointTypeStatic, + settings: []*ir.DestinationSetting{{ + Endpoints: []*ir.DestinationEndpoint{{Host: "127.0.0.1", Port: 8080}}, + }}, + loadBalancer: &ir.LoadBalancer{BackendUtilization: &ir.BackendUtilization{ + 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()) +} + func TestGetHealthCheckOverridesHostname(t *testing.T) { tests := []struct { name string 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 371b38438b..c59f30a804 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: + backendUtilization: + blackoutPeriod: 30s + weightExpirationPeriod: 60s + weightUpdatePeriod: 10s + slowStart: + window: 45s + errorUtilizationPenaltyPercent: 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: + backendUtilization: + 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 1e5a85b751..613dd80c37 100644 --- a/internal/xds/translator/testdata/out/xds-ir/load-balancer.clusters.yaml +++ b/internal/xds/translator/testdata/out/xds-ir/load-balancer.clusters.yaml @@ -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 80cc5ca36e..96451679b9 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 8aeadf533a..9c2ef1a230 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/release-notes/current.yaml b/release-notes/current.yaml index 871764e8e4..2b942f84cc 100644 --- a/release-notes/current.yaml +++ b/release-notes/current.yaml @@ -35,6 +35,7 @@ new features: | Added `namespaceOverride` support to gateway-helm chart Added support for configuring statusOnError in ExtAuth settings Added support for retry budget in BackendTrafficPolicy. + Added support for BackendUtilization load balancing policy in BackendTrafficPolicy. Added support for upstrean access log. bug fixes: | diff --git a/site/content/en/latest/api/extension_types.md b/site/content/en/latest/api/extension_types.md index c1b7d3fa13..0e4d29064c 100644 --- a/site/content/en/latest/api/extension_types.md +++ b/site/content/en/latest/api/extension_types.md @@ -568,6 +568,39 @@ _Appears in:_ | `DynamicResolver` | BackendTypeDynamicResolver defines the type of the backend as DynamicResolver.
When a backend is of type DynamicResolver, the Envoy will resolve the upstream
ip address and port from the host header of the incoming request. If the ip address
is directly set in the host header, the Envoy will use the ip address and port as the
upstream address. If the hostname is set in the host header, the Envoy will resolve the
ip address and port from the hostname using the DNS resolver.
| +#### BackendUtilization + + + +BackendUtilization defines configuration for Envoy's Backend Utilization policy. +It uses Open Resource Cost Application (ORCA) load metrics reported by endpoints to make load balancing decisions. +These metrics are typically sent by the backend service in response headers or trailers. + +The backend should report these metrics in header/trailer as one of the following formats: +- Binary: `endpoint-load-metrics-bin` with base64-encoded serialized `OrcaLoadReport` proto. +- JSON: `endpoint-load-metrics` with JSON-encoded `OrcaLoadReport` proto, e.g., `JSON {"cpu_utilization": 0.3}`. +- TEXT: `endpoint-load-metrics` with comma-separated key-value pairs, e.g., `TEXT cpu=0.3,mem=0.8`. + +By default, Envoy will forward these ORCA response headers/trailers from the upstream service to the downstream client. +If the downstream client also uses this information for load balancing, it might lead to unexpected behavior. +To avoid this, you can use the `HTTPRoute` or `BackendTrafficPolicy` to remove the load report headers before sending the response to the client. + +See Envoy proto: envoy.extensions.load_balancing_policies.client_side_weighted_round_robin.v3.ClientSideWeightedRoundRobin +See ORCA Load Report proto: xds.data.orca.v3.orca_load_report.proto + +_Appears in:_ +- [LoadBalancer](#loadbalancer) + +| 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. | +| `errorUtilizationPenaltyPercent` | _integer_ | false | | ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps).
This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc.
For example:
- 100 => 1.0x
- 120 => 1.2x
- 200 => 2.0x
Note: In the internal IR/XDS configuration this value is converted back to a
floating point multiplier (value / 100.0).
Must be non-negative. | +| `metricNamesForComputingUtilization` | _string array_ | false | | Metric names used to compute utilization if application_utilization is not set.
For map fields in ORCA proto, use the form ".", e.g., "named_metrics.foo". | +| `keepResponseHeaders` | _boolean_ | false | false | KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client.
Defaults to false. | + + #### BasicAuth @@ -3662,10 +3695,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",
"BackendUtilization". | | `consistentHash` | _[ConsistentHash](#consistenthash)_ | false | | ConsistentHash defines the configuration when the load balancer type is
set to ConsistentHash | +| `backendUtilization` | _[BackendUtilization](#backendutilization)_ | false | | BackendUtilization defines the configuration when the load balancer type is
set to BackendUtilization. | | `endpointOverride` | _[EndpointOverride](#endpointoverride)_ | false | | EndpointOverride defines the configuration for endpoint override.
When specified, the load balancer will attempt to route requests to endpoints
based on the override information extracted from request headers or metadata.
If the override endpoints are not available, the configured load balancer policy will be used as fallback. | -| `slowStart` | _[SlowStart](#slowstart)_ | false | | SlowStart defines the configuration related to the slow start load balancer policy.
If set, during slow start window, traffic sent to the newly added hosts will gradually increase.
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 BackendUtilization load balancers. | | `zoneAware` | _[ZoneAware](#zoneaware)_ | false | | ZoneAware defines the configuration related to the distribution of requests between locality zones. | @@ -3684,6 +3718,7 @@ _Appears in:_ | `LeastRequest` | LeastRequestLoadBalancerType load balancer policy.
| | `Random` | RandomLoadBalancerType load balancer policy.
| | `RoundRobin` | RoundRobinLoadBalancerType load balancer policy.
| +| `BackendUtilization` | BackendUtilizationLoadBalancerType load balancer policy.
| #### LocalDynamicModuleSource diff --git a/site/content/en/latest/concepts/load-balancing.md b/site/content/en/latest/concepts/load-balancing.md index a644ecefdb..c02b1290cb 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) +- **Backend Utilization** – Uses client-observed load reports (e.g., Open Resource Cost Aggregation (ORCA) metrics) to dynamically weight endpoints; if no metrics are available, it behaves similar to even-weight round-robin. If no load balancing strategy is specified, Envoy Gateway uses **Least Request** by default. @@ -65,6 +66,53 @@ spec: ``` In this setup, traffic matching /round is distributed evenly across all available backend service instances. For example, if there are four replicas of the backend service, each one should receive roughly 25% of the requests. +## Backend Utilization (ORCA) + +Backend Utilization load balancing uses Open Resource Cost Application (ORCA) metrics to make load balancing decisions. These metrics are reported by the backend service in response headers or trailers. + +### ORCA Load Metrics + +The backend service (or its sidecar) reports load metrics in response headers or trailers (for streaming requests). ORCA supports multiple formats for these metrics: + +- **JSON**: Use the `endpoint-load-metrics` header with a JSON object. + ```http + endpoint-load-metrics: JSON {"cpu_utilization": 0.3, "mem_utilization": 0.8} + ``` +- **TEXT**: Use the `endpoint-load-metrics` header with comma-separated key-value pairs. + ```http + endpoint-load-metrics: TEXT cpu=0.3,mem=0.8,foo_bytes=123 + ``` +- **Binary Proto**: Use the `endpoint-load-metrics-bin` header with a base64-encoded serialized `OrcaLoadReport` proto. + ```http + endpoint-load-metrics-bin: Cg4KCHNvbWUta2V5Eg0AAAAAAADwPw== + ``` + +For more details, see: +- [ORCA Load Report Proto](https://www.envoyproxy.io/docs/envoy/latest/xds/data/orca/v3/orca_load_report.proto) +- [ORCA Design Document](https://docs.google.com/document/d/1NSnK3346BkBo1JUU3I9I5NYYnaJZQPt8_Z_XCBCI3uA) + +### Automatic Header Removal + +By default, Envoy forwards the ORCA response headers/trailers from the upstream cluster to the downstream client. This means that if the downstream client is also configured to use client-side weighted round-robin, it will load balance against Envoy based on upstream weights. + +To prevent this, Envoy Gateway automatically removes these headers by default when `BackendUtilization` is enabled. You can change this behavior using the `keepResponseHeaders` field in `backendUtilization`. + +```yaml +apiVersion: gateway.envoyproxy.io/v1alpha1 +kind: BackendTrafficPolicy +metadata: + name: backend-utilization-policy +spec: + targetRefs: + - group: gateway.networking.k8s.io + kind: HTTPRoute + name: backend-utilization-route + loadBalancer: + type: BackendUtilization + backendUtilization: + keepResponseHeaders: true # Keep headers and forward them to the client +``` + ## Related Resources - [BackendTrafficPolicy](gateway_api_extensions/backend-traffic-policy.md) - [Task: Load Balancing](../tasks/traffic/load-balancing.md) diff --git a/test/cel-validation/backendtrafficpolicy_test.go b/test/cel-validation/backendtrafficpolicy_test.go index e724af0418..903d8e4103 100644 --- a/test/cel-validation/backendtrafficpolicy_test.go +++ b/test/cel-validation/backendtrafficpolicy_test.go @@ -544,7 +544,7 @@ func TestBackendTrafficPolicyTarget(t *testing.T) { }, }, { - desc: "leastRequest with SlowStar is set", + desc: "leastRequest with SlowStart is set", mutate: func(btp *egv1a1.BackendTrafficPolicy) { btp.Spec = egv1a1.BackendTrafficPolicySpec{ PolicyTargetReferences: egv1a1.PolicyTargetReferences{ @@ -618,7 +618,7 @@ func TestBackendTrafficPolicyTarget(t *testing.T) { }, wantErrors: []string{ "spec.loadBalancer: Invalid value:", - ": Currently SlowStart is only supported for RoundRobin and LeastRequest load balancers.", + ": Currently SlowStart is only supported for RoundRobin, LeastRequest, and BackendUtilization load balancers.", }, }, { @@ -646,9 +646,137 @@ func TestBackendTrafficPolicyTarget(t *testing.T) { }, wantErrors: []string{ "spec.loadBalancer: Invalid value:", - ": Currently SlowStart is only supported for RoundRobin and LeastRequest load balancers.", + ": Currently SlowStart is only supported for RoundRobin, LeastRequest, and BackendUtilization load balancers.", }, }, + { + desc: "backendUtilization 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.BackendUtilizationLoadBalancerType, + BackendUtilization: &egv1a1.BackendUtilization{ + BlackoutPeriod: ptr.To(gwapiv1.Duration("10s")), + WeightUpdatePeriod: ptr.To(gwapiv1.Duration("10s")), + WeightExpirationPeriod: ptr.To(gwapiv1.Duration("10s")), + ErrorUtilizationPenaltyPercent: ptr.To[uint32](50), + MetricNamesForComputingUtilization: []string{"metric1", "metric2"}, + }, + }, + }, + } + }, + wantErrors: []string{}, + }, + { + desc: "backendUtilization field nil when type is BackendUtilization", + 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.BackendUtilizationLoadBalancerType, + }, + }, + } + }, + wantErrors: []string{ + "spec.loadBalancer: Invalid value:", + ": If LoadBalancer type is BackendUtilization, backendUtilization field needs to be set.", + }, + }, + { + desc: "backendUtilization 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.BackendUtilizationLoadBalancerType, + BackendUtilization: &egv1a1.BackendUtilization{}, + SlowStart: &egv1a1.SlowStart{Window: ptr.To(gwapiv1.Duration("10ms"))}, + }, + }, + } + }, + wantErrors: []string{}, + }, + { + desc: "backendUtilization 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.BackendUtilizationLoadBalancerType, + BackendUtilization: &egv1a1.BackendUtilization{}, + ZoneAware: &egv1a1.ZoneAware{PreferLocal: &egv1a1.PreferLocalZone{}}, + }, + }, + } + }, + wantErrors: []string{ + "spec.loadBalancer: Invalid value:", + ": ZoneAware routing is not supported for BackendUtilization load balancers. BackendUtilization only handles picking endpoints within a single locality.", + }, + }, + { + desc: "backendUtilization 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.BackendUtilizationLoadBalancerType, + BackendUtilization: &egv1a1.BackendUtilization{ErrorUtilizationPenaltyPercent: 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_backend_utilization.yaml b/test/e2e/testdata/load_balancing_backend_utilization.yaml new file mode 100644 index 0000000000..3cb06165ca --- /dev/null +++ b/test/e2e/testdata/load_balancing_backend_utilization.yaml @@ -0,0 +1,84 @@ +apiVersion: v1 +kind: Service +metadata: + name: lb-backend-utilization + namespace: gateway-conformance-infra +spec: + selector: + app: lb-backend-utilization + ports: + - protocol: TCP + port: 8080 + targetPort: 3000 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: lb-backend-utilization + namespace: gateway-conformance-infra + labels: + app: lb-backend-utilization +spec: + replicas: 3 + selector: + matchLabels: + app: lb-backend-utilization + template: + metadata: + labels: + app: lb-backend-utilization + 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-utilization + resources: + requests: + cpu: 10m +--- +apiVersion: gateway.envoyproxy.io/v1alpha1 +kind: BackendTrafficPolicy +metadata: + name: backend-utilization-lb-policy + namespace: gateway-conformance-infra +spec: + targetRefs: + - group: gateway.networking.k8s.io + kind: HTTPRoute + name: backend-utilization-lb-route + loadBalancer: + type: BackendUtilization + backendUtilization: + blackoutPeriod: 30s + weightExpirationPeriod: 60s + weightUpdatePeriod: 10s + metricNamesForComputingUtilization: + - "named_metric.foo" +--- +apiVersion: gateway.networking.k8s.io/v1 +kind: HTTPRoute +metadata: + name: backend-utilization-lb-route + namespace: gateway-conformance-infra +spec: + parentRefs: + - name: same-namespace + rules: + - matches: + - path: + type: PathPrefix + value: /backend-utilization + backendRefs: + - name: lb-backend-utilization + port: 8080 diff --git a/test/e2e/tests/load_balancing.go b/test/e2e/tests/load_balancing.go index b68324b07e..8907275592 100644 --- a/test/e2e/tests/load_balancing.go +++ b/test/e2e/tests/load_balancing.go @@ -46,9 +46,69 @@ func init() { EndpointOverrideLoadBalancing, MultiHeaderConsistentHashHeaderLoadBalancing, QueryParamsBasedConsistentHashLoadBalancing, + BackendUtilizationLoadBalancingTest, ) } +var BackendUtilizationLoadBalancingTest = suite.ConformanceTest{ + ShortName: "BackendUtilizationLoadBalancing", + Description: "Test for backend utilization load balancing type", + Manifests: []string{ + "testdata/load_balancing_backend_utilization.yaml", + }, + Test: func(t *testing.T, suite *suite.ConformanceTestSuite) { + const ( + sendRequests = 90 + replicas = 3 + offset = 6 + ) + + ns := "gateway-conformance-infra" + routeNN := types.NamespacedName{Name: "backend-utilization-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: "backend-utilization-lb-policy", Namespace: ns}, suite.ControllerName, ancestorRef) + WaitForPods(t, suite.Client, ns, map[string]string{"app": "lb-backend-utilization"}, corev1.PodRunning, &PodReady) + + gwAddr := kubernetes.GatewayAndRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN), &gwapiv1.HTTPRoute{}, false, routeNN) + + t.Run("traffic should be split roughly evenly (defaults to equal weights without ORCA)", func(t *testing.T) { + expectedResponse := http.ExpectedResponse{ + Request: http.Request{ + Path: "/backend-utilization", + }, + Response: http.Response{ + StatusCodes: []int{200}, + }, + Namespace: ns, + } + req := http.MakeRequest(t, &expectedResponse, gwAddr, "HTTP", "http") + + compareFunc := func(trafficMap map[string]int) bool { + even := sendRequests / replicas + for _, count := range trafficMap { + if !AlmostEquals(count, even, offset) { + return false + } + } + return true + } + + if err := wait.PollUntilContextTimeout(context.TODO(), time.Second, 30*time.Second, true, func(_ context.Context) (bool, error) { + return runTrafficTest(t, suite, &req, &expectedResponse, sendRequests, compareFunc), nil + }); err != nil { + tlog.Errorf(t, "failed to run backend utilization load balancing test: %v", err) + } + }) + }, +} + var RoundRobinLoadBalancing = suite.ConformanceTest{ ShortName: "RoundRobinLoadBalancing", Description: "Test for round robin load balancing type", diff --git a/test/fuzz/testdata/FuzzGatewayAPIToXDS/traffic_policy b/test/fuzz/testdata/FuzzGatewayAPIToXDS/traffic_policy index 6cb209e5f1..81d2efa57e 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: backend-utilization-lb-policy + namespace: gateway-conformance-infra +spec: + targetRefs: + - group: gateway.networking.k8s.io + kind: HTTPRoute + name: backend-utilization-lb-route + loadBalancer: + type: BackendUtilization + backendUtilization: + errorUtilizationPenaltyPercent: 120 diff --git a/test/helm/gateway-crds-helm/all.out.yaml b/test/helm/gateway-crds-helm/all.out.yaml index f7c80425a8..ac17a4843e 100644 --- a/test/helm/gateway-crds-helm/all.out.yaml +++ b/test/helm/gateway-crds-helm/all.out.yaml @@ -23341,6 +23341,59 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + backendUtilization: + description: |- + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. + 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 + errorUtilizationPenaltyPercent: + description: |- + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 + minimum: 0 + type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + 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 @@ -23487,7 +23540,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 BackendUtilization load balancers. properties: window: description: |- @@ -23507,12 +23560,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the configuration related to the @@ -23588,14 +23643,23 @@ 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 BackendUtilization, backendUtilization + field needs to be set. + rule: 'self.type == ''BackendUtilization'' ? has(self.backendUtilization) + : !has(self.backendUtilization)' + - message: Currently SlowStart is only supported for RoundRobin, LeastRequest, + and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: PreferLocal zone-aware routing is not supported for ConsistentHash load balancers. Use weightedZones instead. rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported for BackendUtilization + load balancers. BackendUtilization only handles picking endpoints + within a single locality. + rule: 'self.type == ''BackendUtilization'' ? !has(self.zoneAware) + : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) && @@ -28588,6 +28652,60 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + backendUtilization: + description: |- + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. + 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 + errorUtilizationPenaltyPercent: + description: |- + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 + minimum: 0 + type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + 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 @@ -28740,7 +28858,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 BackendUtilization load balancers. properties: window: description: |- @@ -28760,12 +28878,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the configuration related @@ -28843,8 +28963,12 @@ 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 BackendUtilization, backendUtilization + field needs to be set. + rule: 'self.type == ''BackendUtilization'' ? has(self.backendUtilization) + : !has(self.backendUtilization)' + - message: Currently SlowStart is only supported for RoundRobin, + LeastRequest, and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: PreferLocal zone-aware routing is not supported @@ -28852,6 +28976,11 @@ spec: instead. rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported for BackendUtilization + load balancers. BackendUtilization only handles picking + endpoints within a single locality. + rule: 'self.type == ''BackendUtilization'' ? !has(self.zoneAware) + : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) @@ -42729,6 +42858,63 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + backendUtilization: + description: |- + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. + 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 + errorUtilizationPenaltyPercent: + description: |- + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 + minimum: 0 + type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + 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 @@ -42896,7 +43082,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 BackendUtilization load balancers. properties: window: description: |- @@ -42916,12 +43102,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the @@ -43006,9 +43194,14 @@ spec: consistentHash field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' + - message: If LoadBalancer type is BackendUtilization, + backendUtilization field needs to + be set. + rule: 'self.type == ''BackendUtilization'' + ? has(self.backendUtilization) : !has(self.backendUtilization)' - message: Currently SlowStart is only - supported for RoundRobin and LeastRequest - load balancers. + supported for RoundRobin, LeastRequest, + and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: PreferLocal zone-aware routing @@ -43018,6 +43211,12 @@ spec: rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported + for BackendUtilization load balancers. + BackendUtilization only handles picking + endpoints within a single locality. + rule: 'self.type == ''BackendUtilization'' + ? !has(self.zoneAware) : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) @@ -44141,6 +44340,63 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + backendUtilization: + description: |- + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. + 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 + errorUtilizationPenaltyPercent: + description: |- + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 + minimum: 0 + type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + 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 @@ -44308,7 +44564,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 BackendUtilization load balancers. properties: window: description: |- @@ -44328,12 +44584,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the @@ -44418,9 +44676,14 @@ spec: consistentHash field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' + - message: If LoadBalancer type is BackendUtilization, + backendUtilization field needs to + be set. + rule: 'self.type == ''BackendUtilization'' + ? has(self.backendUtilization) : !has(self.backendUtilization)' - message: Currently SlowStart is only - supported for RoundRobin and LeastRequest - load balancers. + supported for RoundRobin, LeastRequest, + and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: PreferLocal zone-aware routing @@ -44430,6 +44693,12 @@ spec: rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported + for BackendUtilization load balancers. + BackendUtilization only handles picking + endpoints within a single locality. + rule: 'self.type == ''BackendUtilization'' + ? !has(self.zoneAware) : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) @@ -45712,6 +45981,62 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + backendUtilization: + description: |- + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. + 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 + errorUtilizationPenaltyPercent: + description: |- + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 + minimum: 0 + type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + 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 @@ -45872,7 +46197,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 BackendUtilization load balancers. properties: window: description: |- @@ -45892,12 +46217,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the configuration @@ -45981,8 +46308,13 @@ spec: consistentHash field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' + - message: If LoadBalancer type is BackendUtilization, + backendUtilization field needs to be set. + rule: 'self.type == ''BackendUtilization'' + ? has(self.backendUtilization) : !has(self.backendUtilization)' - message: Currently SlowStart is only supported - for RoundRobin and LeastRequest load balancers. + for RoundRobin, LeastRequest, and BackendUtilization + load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: PreferLocal zone-aware routing is @@ -45991,6 +46323,12 @@ spec: rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported + for BackendUtilization load balancers. BackendUtilization + only handles picking endpoints within a + single locality. + rule: 'self.type == ''BackendUtilization'' + ? !has(self.zoneAware) : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) @@ -47199,6 +47537,60 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + backendUtilization: + description: |- + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. + 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 + errorUtilizationPenaltyPercent: + description: |- + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 + minimum: 0 + type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + 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 @@ -47355,7 +47747,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 BackendUtilization load balancers. properties: window: description: |- @@ -47375,12 +47767,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the configuration @@ -47461,8 +47855,13 @@ spec: consistentHash field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' + - message: If LoadBalancer type is BackendUtilization, + backendUtilization field needs to be set. + rule: 'self.type == ''BackendUtilization'' ? has(self.backendUtilization) + : !has(self.backendUtilization)' - message: Currently SlowStart is only supported for - RoundRobin and LeastRequest load balancers. + RoundRobin, LeastRequest, and BackendUtilization + load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: PreferLocal zone-aware routing is not supported @@ -47470,6 +47869,12 @@ spec: instead. rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported for + BackendUtilization load balancers. BackendUtilization + only handles picking endpoints within a single + locality. + rule: 'self.type == ''BackendUtilization'' ? !has(self.zoneAware) + : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) @@ -50089,6 +50494,60 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + backendUtilization: + description: |- + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. + 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 + errorUtilizationPenaltyPercent: + description: |- + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 + minimum: 0 + type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + 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 @@ -50243,7 +50702,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 BackendUtilization load balancers. properties: window: description: |- @@ -50263,12 +50722,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the configuration related @@ -50348,8 +50809,12 @@ 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 BackendUtilization, + backendUtilization field needs to be set. + rule: 'self.type == ''BackendUtilization'' ? has(self.backendUtilization) + : !has(self.backendUtilization)' + - message: Currently SlowStart is only supported for RoundRobin, + LeastRequest, and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: PreferLocal zone-aware routing is not supported @@ -50357,6 +50822,11 @@ spec: instead. rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported for BackendUtilization + load balancers. BackendUtilization only handles picking + endpoints within a single locality. + rule: 'self.type == ''BackendUtilization'' ? !has(self.zoneAware) + : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) @@ -51380,6 +51850,60 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + backendUtilization: + description: |- + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. + 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 + errorUtilizationPenaltyPercent: + description: |- + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 + minimum: 0 + type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + 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 @@ -51534,7 +52058,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 BackendUtilization load balancers. properties: window: description: |- @@ -51554,12 +52078,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the configuration related @@ -51639,8 +52165,12 @@ 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 BackendUtilization, + backendUtilization field needs to be set. + rule: 'self.type == ''BackendUtilization'' ? has(self.backendUtilization) + : !has(self.backendUtilization)' + - message: Currently SlowStart is only supported for RoundRobin, + LeastRequest, and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: PreferLocal zone-aware routing is not supported @@ -51648,6 +52178,11 @@ spec: instead. rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported for BackendUtilization + load balancers. BackendUtilization only handles picking + endpoints within a single locality. + rule: 'self.type == ''BackendUtilization'' ? !has(self.zoneAware) + : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) @@ -52928,6 +53463,61 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + backendUtilization: + description: |- + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. + 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 + errorUtilizationPenaltyPercent: + description: |- + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 + minimum: 0 + type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + 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 @@ -53085,7 +53675,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 BackendUtilization load balancers. properties: window: description: |- @@ -53105,12 +53695,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the configuration @@ -53191,8 +53783,13 @@ spec: consistentHash field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' + - message: If LoadBalancer type is BackendUtilization, + backendUtilization field needs to be set. + rule: 'self.type == ''BackendUtilization'' ? has(self.backendUtilization) + : !has(self.backendUtilization)' - message: Currently SlowStart is only supported - for RoundRobin and LeastRequest load balancers. + for RoundRobin, LeastRequest, and BackendUtilization + load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: PreferLocal zone-aware routing is not @@ -53200,6 +53797,12 @@ spec: Use weightedZones instead. rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported for + BackendUtilization load balancers. BackendUtilization + only handles picking endpoints within a single + locality. + rule: 'self.type == ''BackendUtilization'' ? !has(self.zoneAware) + : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) @@ -54495,6 +55098,60 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + backendUtilization: + description: |- + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. + 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 + errorUtilizationPenaltyPercent: + description: |- + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 + minimum: 0 + type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + 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 @@ -54649,7 +55306,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 BackendUtilization load balancers. properties: window: description: |- @@ -54669,12 +55326,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the configuration related @@ -54754,8 +55413,12 @@ 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 BackendUtilization, + backendUtilization field needs to be set. + rule: 'self.type == ''BackendUtilization'' ? has(self.backendUtilization) + : !has(self.backendUtilization)' + - message: Currently SlowStart is only supported for RoundRobin, + LeastRequest, and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: PreferLocal zone-aware routing is not supported @@ -54763,6 +55426,11 @@ spec: instead. rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported for BackendUtilization + load balancers. BackendUtilization only handles picking + endpoints within a single locality. + rule: 'self.type == ''BackendUtilization'' ? !has(self.zoneAware) + : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) diff --git a/test/helm/gateway-crds-helm/e2e.out.yaml b/test/helm/gateway-crds-helm/e2e.out.yaml index 6089595b44..a449049d28 100644 --- a/test/helm/gateway-crds-helm/e2e.out.yaml +++ b/test/helm/gateway-crds-helm/e2e.out.yaml @@ -1314,6 +1314,59 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + backendUtilization: + description: |- + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. + 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 + errorUtilizationPenaltyPercent: + description: |- + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 + minimum: 0 + type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + 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 @@ -1460,7 +1513,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 BackendUtilization load balancers. properties: window: description: |- @@ -1480,12 +1533,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the configuration related to the @@ -1561,14 +1616,23 @@ 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 BackendUtilization, backendUtilization + field needs to be set. + rule: 'self.type == ''BackendUtilization'' ? has(self.backendUtilization) + : !has(self.backendUtilization)' + - message: Currently SlowStart is only supported for RoundRobin, LeastRequest, + and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: PreferLocal zone-aware routing is not supported for ConsistentHash load balancers. Use weightedZones instead. rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported for BackendUtilization + load balancers. BackendUtilization only handles picking endpoints + within a single locality. + rule: 'self.type == ''BackendUtilization'' ? !has(self.zoneAware) + : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) && @@ -6561,6 +6625,60 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + backendUtilization: + description: |- + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. + 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 + errorUtilizationPenaltyPercent: + description: |- + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 + minimum: 0 + type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + 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 @@ -6713,7 +6831,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 BackendUtilization load balancers. properties: window: description: |- @@ -6733,12 +6851,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the configuration related @@ -6816,8 +6936,12 @@ 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 BackendUtilization, backendUtilization + field needs to be set. + rule: 'self.type == ''BackendUtilization'' ? has(self.backendUtilization) + : !has(self.backendUtilization)' + - message: Currently SlowStart is only supported for RoundRobin, + LeastRequest, and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: PreferLocal zone-aware routing is not supported @@ -6825,6 +6949,11 @@ spec: instead. rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported for BackendUtilization + load balancers. BackendUtilization only handles picking + endpoints within a single locality. + rule: 'self.type == ''BackendUtilization'' ? !has(self.zoneAware) + : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) @@ -20702,6 +20831,63 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + backendUtilization: + description: |- + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. + 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 + errorUtilizationPenaltyPercent: + description: |- + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 + minimum: 0 + type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + 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 @@ -20869,7 +21055,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 BackendUtilization load balancers. properties: window: description: |- @@ -20889,12 +21075,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the @@ -20979,9 +21167,14 @@ spec: consistentHash field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' + - message: If LoadBalancer type is BackendUtilization, + backendUtilization field needs to + be set. + rule: 'self.type == ''BackendUtilization'' + ? has(self.backendUtilization) : !has(self.backendUtilization)' - message: Currently SlowStart is only - supported for RoundRobin and LeastRequest - load balancers. + supported for RoundRobin, LeastRequest, + and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: PreferLocal zone-aware routing @@ -20991,6 +21184,12 @@ spec: rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported + for BackendUtilization load balancers. + BackendUtilization only handles picking + endpoints within a single locality. + rule: 'self.type == ''BackendUtilization'' + ? !has(self.zoneAware) : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) @@ -22114,6 +22313,63 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + backendUtilization: + description: |- + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. + 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 + errorUtilizationPenaltyPercent: + description: |- + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 + minimum: 0 + type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + 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 @@ -22281,7 +22537,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 BackendUtilization load balancers. properties: window: description: |- @@ -22301,12 +22557,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the @@ -22391,9 +22649,14 @@ spec: consistentHash field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' + - message: If LoadBalancer type is BackendUtilization, + backendUtilization field needs to + be set. + rule: 'self.type == ''BackendUtilization'' + ? has(self.backendUtilization) : !has(self.backendUtilization)' - message: Currently SlowStart is only - supported for RoundRobin and LeastRequest - load balancers. + supported for RoundRobin, LeastRequest, + and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: PreferLocal zone-aware routing @@ -22403,6 +22666,12 @@ spec: rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported + for BackendUtilization load balancers. + BackendUtilization only handles picking + endpoints within a single locality. + rule: 'self.type == ''BackendUtilization'' + ? !has(self.zoneAware) : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) @@ -23685,6 +23954,62 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + backendUtilization: + description: |- + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. + 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 + errorUtilizationPenaltyPercent: + description: |- + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 + minimum: 0 + type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + 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 @@ -23845,7 +24170,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 BackendUtilization load balancers. properties: window: description: |- @@ -23865,12 +24190,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the configuration @@ -23954,8 +24281,13 @@ spec: consistentHash field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' + - message: If LoadBalancer type is BackendUtilization, + backendUtilization field needs to be set. + rule: 'self.type == ''BackendUtilization'' + ? has(self.backendUtilization) : !has(self.backendUtilization)' - message: Currently SlowStart is only supported - for RoundRobin and LeastRequest load balancers. + for RoundRobin, LeastRequest, and BackendUtilization + load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: PreferLocal zone-aware routing is @@ -23964,6 +24296,12 @@ spec: rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported + for BackendUtilization load balancers. BackendUtilization + only handles picking endpoints within a + single locality. + rule: 'self.type == ''BackendUtilization'' + ? !has(self.zoneAware) : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) @@ -25172,6 +25510,60 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + backendUtilization: + description: |- + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. + 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 + errorUtilizationPenaltyPercent: + description: |- + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 + minimum: 0 + type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + 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 @@ -25328,7 +25720,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 BackendUtilization load balancers. properties: window: description: |- @@ -25348,12 +25740,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the configuration @@ -25434,8 +25828,13 @@ spec: consistentHash field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' + - message: If LoadBalancer type is BackendUtilization, + backendUtilization field needs to be set. + rule: 'self.type == ''BackendUtilization'' ? has(self.backendUtilization) + : !has(self.backendUtilization)' - message: Currently SlowStart is only supported for - RoundRobin and LeastRequest load balancers. + RoundRobin, LeastRequest, and BackendUtilization + load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: PreferLocal zone-aware routing is not supported @@ -25443,6 +25842,12 @@ spec: instead. rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported for + BackendUtilization load balancers. BackendUtilization + only handles picking endpoints within a single + locality. + rule: 'self.type == ''BackendUtilization'' ? !has(self.zoneAware) + : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) @@ -28062,6 +28467,60 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + backendUtilization: + description: |- + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. + 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 + errorUtilizationPenaltyPercent: + description: |- + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 + minimum: 0 + type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + 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 @@ -28216,7 +28675,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 BackendUtilization load balancers. properties: window: description: |- @@ -28236,12 +28695,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the configuration related @@ -28321,8 +28782,12 @@ 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 BackendUtilization, + backendUtilization field needs to be set. + rule: 'self.type == ''BackendUtilization'' ? has(self.backendUtilization) + : !has(self.backendUtilization)' + - message: Currently SlowStart is only supported for RoundRobin, + LeastRequest, and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: PreferLocal zone-aware routing is not supported @@ -28330,6 +28795,11 @@ spec: instead. rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported for BackendUtilization + load balancers. BackendUtilization only handles picking + endpoints within a single locality. + rule: 'self.type == ''BackendUtilization'' ? !has(self.zoneAware) + : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) @@ -29353,6 +29823,60 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + backendUtilization: + description: |- + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. + 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 + errorUtilizationPenaltyPercent: + description: |- + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 + minimum: 0 + type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + 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 @@ -29507,7 +30031,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 BackendUtilization load balancers. properties: window: description: |- @@ -29527,12 +30051,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the configuration related @@ -29612,8 +30138,12 @@ 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 BackendUtilization, + backendUtilization field needs to be set. + rule: 'self.type == ''BackendUtilization'' ? has(self.backendUtilization) + : !has(self.backendUtilization)' + - message: Currently SlowStart is only supported for RoundRobin, + LeastRequest, and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: PreferLocal zone-aware routing is not supported @@ -29621,6 +30151,11 @@ spec: instead. rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported for BackendUtilization + load balancers. BackendUtilization only handles picking + endpoints within a single locality. + rule: 'self.type == ''BackendUtilization'' ? !has(self.zoneAware) + : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) @@ -30901,6 +31436,61 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + backendUtilization: + description: |- + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. + 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 + errorUtilizationPenaltyPercent: + description: |- + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 + minimum: 0 + type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + 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 @@ -31058,7 +31648,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 BackendUtilization load balancers. properties: window: description: |- @@ -31078,12 +31668,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the configuration @@ -31164,8 +31756,13 @@ spec: consistentHash field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' + - message: If LoadBalancer type is BackendUtilization, + backendUtilization field needs to be set. + rule: 'self.type == ''BackendUtilization'' ? has(self.backendUtilization) + : !has(self.backendUtilization)' - message: Currently SlowStart is only supported - for RoundRobin and LeastRequest load balancers. + for RoundRobin, LeastRequest, and BackendUtilization + load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: PreferLocal zone-aware routing is not @@ -31173,6 +31770,12 @@ spec: Use weightedZones instead. rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported for + BackendUtilization load balancers. BackendUtilization + only handles picking endpoints within a single + locality. + rule: 'self.type == ''BackendUtilization'' ? !has(self.zoneAware) + : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) @@ -32468,6 +33071,60 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + backendUtilization: + description: |- + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. + 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 + errorUtilizationPenaltyPercent: + description: |- + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 + minimum: 0 + type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + 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 @@ -32622,7 +33279,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 BackendUtilization load balancers. properties: window: description: |- @@ -32642,12 +33299,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the configuration related @@ -32727,8 +33386,12 @@ 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 BackendUtilization, + backendUtilization field needs to be set. + rule: 'self.type == ''BackendUtilization'' ? has(self.backendUtilization) + : !has(self.backendUtilization)' + - message: Currently SlowStart is only supported for RoundRobin, + LeastRequest, and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: PreferLocal zone-aware routing is not supported @@ -32736,6 +33399,11 @@ spec: instead. rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported for BackendUtilization + load balancers. BackendUtilization only handles picking + endpoints within a single locality. + rule: 'self.type == ''BackendUtilization'' ? !has(self.zoneAware) + : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) diff --git a/test/helm/gateway-crds-helm/envoy-gateway-crds.out.yaml b/test/helm/gateway-crds-helm/envoy-gateway-crds.out.yaml index 9554bf13d9..f237814060 100644 --- a/test/helm/gateway-crds-helm/envoy-gateway-crds.out.yaml +++ b/test/helm/gateway-crds-helm/envoy-gateway-crds.out.yaml @@ -1314,6 +1314,59 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + backendUtilization: + description: |- + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. + 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 + errorUtilizationPenaltyPercent: + description: |- + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 + minimum: 0 + type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + 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 @@ -1460,7 +1513,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 BackendUtilization load balancers. properties: window: description: |- @@ -1480,12 +1533,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the configuration related to the @@ -1561,14 +1616,23 @@ 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 BackendUtilization, backendUtilization + field needs to be set. + rule: 'self.type == ''BackendUtilization'' ? has(self.backendUtilization) + : !has(self.backendUtilization)' + - message: Currently SlowStart is only supported for RoundRobin, LeastRequest, + and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: PreferLocal zone-aware routing is not supported for ConsistentHash load balancers. Use weightedZones instead. rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported for BackendUtilization + load balancers. BackendUtilization only handles picking endpoints + within a single locality. + rule: 'self.type == ''BackendUtilization'' ? !has(self.zoneAware) + : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) && @@ -6561,6 +6625,60 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + backendUtilization: + description: |- + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. + 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 + errorUtilizationPenaltyPercent: + description: |- + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 + minimum: 0 + type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + 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 @@ -6713,7 +6831,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 BackendUtilization load balancers. properties: window: description: |- @@ -6733,12 +6851,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the configuration related @@ -6816,8 +6936,12 @@ 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 BackendUtilization, backendUtilization + field needs to be set. + rule: 'self.type == ''BackendUtilization'' ? has(self.backendUtilization) + : !has(self.backendUtilization)' + - message: Currently SlowStart is only supported for RoundRobin, + LeastRequest, and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: PreferLocal zone-aware routing is not supported @@ -6825,6 +6949,11 @@ spec: instead. rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported for BackendUtilization + load balancers. BackendUtilization only handles picking + endpoints within a single locality. + rule: 'self.type == ''BackendUtilization'' ? !has(self.zoneAware) + : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) @@ -20702,6 +20831,63 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + backendUtilization: + description: |- + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. + 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 + errorUtilizationPenaltyPercent: + description: |- + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 + minimum: 0 + type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + 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 @@ -20869,7 +21055,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 BackendUtilization load balancers. properties: window: description: |- @@ -20889,12 +21075,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the @@ -20979,9 +21167,14 @@ spec: consistentHash field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' + - message: If LoadBalancer type is BackendUtilization, + backendUtilization field needs to + be set. + rule: 'self.type == ''BackendUtilization'' + ? has(self.backendUtilization) : !has(self.backendUtilization)' - message: Currently SlowStart is only - supported for RoundRobin and LeastRequest - load balancers. + supported for RoundRobin, LeastRequest, + and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: PreferLocal zone-aware routing @@ -20991,6 +21184,12 @@ spec: rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported + for BackendUtilization load balancers. + BackendUtilization only handles picking + endpoints within a single locality. + rule: 'self.type == ''BackendUtilization'' + ? !has(self.zoneAware) : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) @@ -22114,6 +22313,63 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + backendUtilization: + description: |- + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. + 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 + errorUtilizationPenaltyPercent: + description: |- + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 + minimum: 0 + type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + 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 @@ -22281,7 +22537,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 BackendUtilization load balancers. properties: window: description: |- @@ -22301,12 +22557,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the @@ -22391,9 +22649,14 @@ spec: consistentHash field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' + - message: If LoadBalancer type is BackendUtilization, + backendUtilization field needs to + be set. + rule: 'self.type == ''BackendUtilization'' + ? has(self.backendUtilization) : !has(self.backendUtilization)' - message: Currently SlowStart is only - supported for RoundRobin and LeastRequest - load balancers. + supported for RoundRobin, LeastRequest, + and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: PreferLocal zone-aware routing @@ -22403,6 +22666,12 @@ spec: rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported + for BackendUtilization load balancers. + BackendUtilization only handles picking + endpoints within a single locality. + rule: 'self.type == ''BackendUtilization'' + ? !has(self.zoneAware) : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) @@ -23685,6 +23954,62 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + backendUtilization: + description: |- + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. + 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 + errorUtilizationPenaltyPercent: + description: |- + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 + minimum: 0 + type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + 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 @@ -23845,7 +24170,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 BackendUtilization load balancers. properties: window: description: |- @@ -23865,12 +24190,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the configuration @@ -23954,8 +24281,13 @@ spec: consistentHash field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' + - message: If LoadBalancer type is BackendUtilization, + backendUtilization field needs to be set. + rule: 'self.type == ''BackendUtilization'' + ? has(self.backendUtilization) : !has(self.backendUtilization)' - message: Currently SlowStart is only supported - for RoundRobin and LeastRequest load balancers. + for RoundRobin, LeastRequest, and BackendUtilization + load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: PreferLocal zone-aware routing is @@ -23964,6 +24296,12 @@ spec: rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported + for BackendUtilization load balancers. BackendUtilization + only handles picking endpoints within a + single locality. + rule: 'self.type == ''BackendUtilization'' + ? !has(self.zoneAware) : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) @@ -25172,6 +25510,60 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + backendUtilization: + description: |- + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. + 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 + errorUtilizationPenaltyPercent: + description: |- + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 + minimum: 0 + type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + 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 @@ -25328,7 +25720,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 BackendUtilization load balancers. properties: window: description: |- @@ -25348,12 +25740,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the configuration @@ -25434,8 +25828,13 @@ spec: consistentHash field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' + - message: If LoadBalancer type is BackendUtilization, + backendUtilization field needs to be set. + rule: 'self.type == ''BackendUtilization'' ? has(self.backendUtilization) + : !has(self.backendUtilization)' - message: Currently SlowStart is only supported for - RoundRobin and LeastRequest load balancers. + RoundRobin, LeastRequest, and BackendUtilization + load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: PreferLocal zone-aware routing is not supported @@ -25443,6 +25842,12 @@ spec: instead. rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported for + BackendUtilization load balancers. BackendUtilization + only handles picking endpoints within a single + locality. + rule: 'self.type == ''BackendUtilization'' ? !has(self.zoneAware) + : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) @@ -28062,6 +28467,60 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + backendUtilization: + description: |- + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. + 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 + errorUtilizationPenaltyPercent: + description: |- + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 + minimum: 0 + type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + 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 @@ -28216,7 +28675,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 BackendUtilization load balancers. properties: window: description: |- @@ -28236,12 +28695,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the configuration related @@ -28321,8 +28782,12 @@ 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 BackendUtilization, + backendUtilization field needs to be set. + rule: 'self.type == ''BackendUtilization'' ? has(self.backendUtilization) + : !has(self.backendUtilization)' + - message: Currently SlowStart is only supported for RoundRobin, + LeastRequest, and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: PreferLocal zone-aware routing is not supported @@ -28330,6 +28795,11 @@ spec: instead. rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported for BackendUtilization + load balancers. BackendUtilization only handles picking + endpoints within a single locality. + rule: 'self.type == ''BackendUtilization'' ? !has(self.zoneAware) + : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) @@ -29353,6 +29823,60 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + backendUtilization: + description: |- + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. + 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 + errorUtilizationPenaltyPercent: + description: |- + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 + minimum: 0 + type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + 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 @@ -29507,7 +30031,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 BackendUtilization load balancers. properties: window: description: |- @@ -29527,12 +30051,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the configuration related @@ -29612,8 +30138,12 @@ 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 BackendUtilization, + backendUtilization field needs to be set. + rule: 'self.type == ''BackendUtilization'' ? has(self.backendUtilization) + : !has(self.backendUtilization)' + - message: Currently SlowStart is only supported for RoundRobin, + LeastRequest, and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: PreferLocal zone-aware routing is not supported @@ -29621,6 +30151,11 @@ spec: instead. rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported for BackendUtilization + load balancers. BackendUtilization only handles picking + endpoints within a single locality. + rule: 'self.type == ''BackendUtilization'' ? !has(self.zoneAware) + : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) @@ -30901,6 +31436,61 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + backendUtilization: + description: |- + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. + 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 + errorUtilizationPenaltyPercent: + description: |- + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 + minimum: 0 + type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + 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 @@ -31058,7 +31648,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 BackendUtilization load balancers. properties: window: description: |- @@ -31078,12 +31668,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the configuration @@ -31164,8 +31756,13 @@ spec: consistentHash field needs to be set. rule: 'self.type == ''ConsistentHash'' ? has(self.consistentHash) : !has(self.consistentHash)' + - message: If LoadBalancer type is BackendUtilization, + backendUtilization field needs to be set. + rule: 'self.type == ''BackendUtilization'' ? has(self.backendUtilization) + : !has(self.backendUtilization)' - message: Currently SlowStart is only supported - for RoundRobin and LeastRequest load balancers. + for RoundRobin, LeastRequest, and BackendUtilization + load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: PreferLocal zone-aware routing is not @@ -31173,6 +31770,12 @@ spec: Use weightedZones instead. rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported for + BackendUtilization load balancers. BackendUtilization + only handles picking endpoints within a single + locality. + rule: 'self.type == ''BackendUtilization'' ? !has(self.zoneAware) + : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal) @@ -32468,6 +33071,60 @@ spec: LoadBalancer policy to apply when routing traffic from the gateway to the backend endpoints. Defaults to `LeastRequest`. properties: + backendUtilization: + description: |- + BackendUtilization defines the configuration when the load balancer type is + set to BackendUtilization. + 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 + errorUtilizationPenaltyPercent: + description: |- + ErrorUtilizationPenaltyPercent adjusts endpoint weights based on the error rate (eps/qps). + This is expressed as a percentage-based integer where 100 represents 1.0, 150 represents 1.5, etc. + + For example: + - 100 => 1.0x + - 120 => 1.2x + - 200 => 2.0x + + Note: In the internal IR/XDS configuration this value is converted back to a + floating point multiplier (value / 100.0). + + Must be non-negative. + format: int32 + minimum: 0 + type: integer + keepResponseHeaders: + default: false + description: |- + KeepResponseHeaders keeps the ORCA load report headers/trailers before sending the response to the client. + Defaults to false. + type: boolean + metricNamesForComputingUtilization: + description: |- + Metric names used to compute utilization if application_utilization is not set. + 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 @@ -32622,7 +33279,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 BackendUtilization load balancers. properties: window: description: |- @@ -32642,12 +33299,14 @@ spec: "ConsistentHash", "LeastRequest", "Random", - "RoundRobin". + "RoundRobin", + "BackendUtilization". enum: - ConsistentHash - LeastRequest - Random - RoundRobin + - BackendUtilization type: string zoneAware: description: ZoneAware defines the configuration related @@ -32727,8 +33386,12 @@ 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 BackendUtilization, + backendUtilization field needs to be set. + rule: 'self.type == ''BackendUtilization'' ? has(self.backendUtilization) + : !has(self.backendUtilization)' + - message: Currently SlowStart is only supported for RoundRobin, + LeastRequest, and BackendUtilization load balancers. rule: 'self.type in [''Random'', ''ConsistentHash''] ? !has(self.slowStart) : true ' - message: PreferLocal zone-aware routing is not supported @@ -32736,6 +33399,11 @@ spec: instead. rule: 'self.type == ''ConsistentHash'' && has(self.zoneAware) ? !has(self.zoneAware.preferLocal) : true' + - message: ZoneAware routing is not supported for BackendUtilization + load balancers. BackendUtilization only handles picking + endpoints within a single locality. + rule: 'self.type == ''BackendUtilization'' ? !has(self.zoneAware) + : true' - message: ZoneAware PreferLocal and WeightedZones cannot be specified together. rule: 'has(self.zoneAware) ? !(has(self.zoneAware.preferLocal)