Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions apis/projectcontour/v1/httpproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -1299,6 +1299,49 @@ type LoadBalancerPolicy struct {
// list of hash policies is empty after validation, the load balancing
// strategy will fall back to the default `RoundRobin`.
RequestHashPolicies []RequestHashPolicy `json:"requestHashPolicies,omitempty"`

// ClientSideWeightedRoundRobinPolicy contains configuration for a client side WRR LB policy.
ClientSideWeightedRoundRobinPolicy *LoadBalancerPolicyClientSideWeightedRoundRobinPolicy `json:"clientSideWeightedRoundRobinPolicy,omitempty"`
}

// LoadBalancerPolicyClientSideWeightedRoundRobinPolicy holds configuration for a client side wrr lb policy.
// For default values, constraints and behavior patterns refer to the envoy doc.
type LoadBalancerPolicyClientSideWeightedRoundRobinPolicy struct {
// Whether to enable out-of-band utilization reporting collection from the endpoints.
EnableOOBLoadReport *bool `json:"enableOobLoadReport,omitempty"`

// Load reporting interval to request from the server. Note that the
// server may not provide reports as frequently as the client requests.
// Used only when enable_oob_load_report is true.
OOBReportingPeriod string `json:"oobReportingPeriod,omitempty"`

// A given endpoint must report load metrics continuously for at least
// this long before the endpoint weight will be used. This avoids
// churn when the set of endpoint addresses changes. Takes effect
// both immediately after we establish a connection to an endpoint and
// after weight_expiration_period has caused us to stop using the most
// recent load metrics.
BlackoutPeriod string `json:"blackoutPeriod,omitempty"`

// If a given endpoint has not reported load metrics in this long,
// then we stop using the reported weight. This ensures that we do
// not continue to use very stale weights. Once we stop using a stale
// value, if we later start seeing fresh reports again, the
// blackout_period applies.
WeightExpirationPeriod string `json:"weightExpirationPeriod,omitempty"`

// How often endpoint weights are recalculated.
WeightUpdatePeriod string `json:"weightUpdatePeriod,omitempty"`

// The multiplier used to adjust endpoint weights with the error rate
// calculated as eps/qps.
ErrorUtilizationPenalty string `json:"errorUtilizationPenalty,omitempty"`

// By default, endpoint weight is computed based on the :ref:`application_utilization <envoy_v3_api_field_.xds.data.orca.v3.OrcaLoadReport.application_utilization>` field reported by the endpoint.
Copy link
Member

@sunjayBhatia sunjayBhatia Sep 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets clean this up a bit to not include the envoy doc reference fields/links in our CRDs here

// If that field is not set, then utilization will instead be computed by taking the max of the values of the metrics specified here.
// For map fields in the ORCA proto, the string will be of the form “<map_field_name>.<map_key>“. For example, the string “named_metrics.foo“ will mean to look for the key “foo“ in the ORCA :ref:`named_metrics <envoy_v3_api_field_.xds.data.orca.v3.OrcaLoadReport.named_metrics>` field.
// If none of the specified metrics are present in the load report, then :ref:`cpu_utilization <envoy_v3_api_field_.xds.data.orca.v3.OrcaLoadReport.cpu_utilization>` is used instead.
MetricNamesForComputingUtilization []string `json:"metricNamesForComputingUtilization,omitempty"`
}

// HeadersPolicy defines how headers are managed during forwarding.
Expand Down
30 changes: 30 additions & 0 deletions apis/projectcontour/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions changelogs/unreleased/6999-anton-kuklin-minor.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Adds support for `ClientSideWeightedRoundRobin` LB policy in HTTPProxy and Extension service.
147 changes: 147 additions & 0 deletions examples/contour/01-crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5188,6 +5188,55 @@ spec:
`Cookie` and `RequestHash` load balancing strategies cannot be used
here.
properties:
clientSideWeightedRoundRobinPolicy:
description: ClientSideWeightedRoundRobinPolicy contains configuration
for a client side WRR LB policy.
properties:
blackoutPeriod:
description: |-
A given endpoint must report load metrics continuously for at least
this long before the endpoint weight will be used. This avoids
churn when the set of endpoint addresses changes. Takes effect
both immediately after we establish a connection to an endpoint and
after weight_expiration_period has caused us to stop using the most
recent load metrics.
type: string
enableOobLoadReport:
description: Whether to enable out-of-band utilization reporting
collection from the endpoints.
type: boolean
errorUtilizationPenalty:
description: |-
The multiplier used to adjust endpoint weights with the error rate
calculated as eps/qps.
type: string
metricNamesForComputingUtilization:
description: |-
By default, endpoint weight is computed based on the :ref:`application_utilization <envoy_v3_api_field_.xds.data.orca.v3.OrcaLoadReport.application_utilization>` field reported by the endpoint.
If that field is not set, then utilization will instead be computed by taking the max of the values of the metrics specified here.
For map fields in the ORCA proto, the string will be of the form “<map_field_name>.<map_key>“. For example, the string “named_metrics.foo“ will mean to look for the key “foo“ in the ORCA :ref:`named_metrics <envoy_v3_api_field_.xds.data.orca.v3.OrcaLoadReport.named_metrics>` field.
If none of the specified metrics are present in the load report, then :ref:`cpu_utilization <envoy_v3_api_field_.xds.data.orca.v3.OrcaLoadReport.cpu_utilization>` is used instead.
items:
type: string
type: array
oobReportingPeriod:
description: |-
Load reporting interval to request from the server. Note that the
server may not provide reports as frequently as the client requests.
Used only when enable_oob_load_report is true.
type: string
weightExpirationPeriod:
description: |-
If a given endpoint has not reported load metrics in this long,
then we stop using the reported weight. This ensures that we do
not continue to use very stale weights. Once we stop using a stale
value, if we later start seeing fresh reports again, the
blackout_period applies.
type: string
weightUpdatePeriod:
description: How often endpoint weights are recalculated.
type: string
type: object
requestHashPolicies:
description: |-
RequestHashPolicies contains a list of hash policies to apply when the
Expand Down Expand Up @@ -6245,6 +6294,55 @@ spec:
loadBalancerPolicy:
description: The load balancing policy for this route.
properties:
clientSideWeightedRoundRobinPolicy:
description: ClientSideWeightedRoundRobinPolicy contains
configuration for a client side WRR LB policy.
properties:
blackoutPeriod:
description: |-
A given endpoint must report load metrics continuously for at least
this long before the endpoint weight will be used. This avoids
churn when the set of endpoint addresses changes. Takes effect
both immediately after we establish a connection to an endpoint and
after weight_expiration_period has caused us to stop using the most
recent load metrics.
type: string
enableOobLoadReport:
description: Whether to enable out-of-band utilization
reporting collection from the endpoints.
type: boolean
errorUtilizationPenalty:
description: |-
The multiplier used to adjust endpoint weights with the error rate
calculated as eps/qps.
type: string
metricNamesForComputingUtilization:
description: |-
By default, endpoint weight is computed based on the :ref:`application_utilization <envoy_v3_api_field_.xds.data.orca.v3.OrcaLoadReport.application_utilization>` field reported by the endpoint.
If that field is not set, then utilization will instead be computed by taking the max of the values of the metrics specified here.
For map fields in the ORCA proto, the string will be of the form “<map_field_name>.<map_key>“. For example, the string “named_metrics.foo“ will mean to look for the key “foo“ in the ORCA :ref:`named_metrics <envoy_v3_api_field_.xds.data.orca.v3.OrcaLoadReport.named_metrics>` field.
If none of the specified metrics are present in the load report, then :ref:`cpu_utilization <envoy_v3_api_field_.xds.data.orca.v3.OrcaLoadReport.cpu_utilization>` is used instead.
items:
type: string
type: array
oobReportingPeriod:
description: |-
Load reporting interval to request from the server. Note that the
server may not provide reports as frequently as the client requests.
Used only when enable_oob_load_report is true.
type: string
weightExpirationPeriod:
description: |-
If a given endpoint has not reported load metrics in this long,
then we stop using the reported weight. This ensures that we do
not continue to use very stale weights. Once we stop using a stale
value, if we later start seeing fresh reports again, the
blackout_period applies.
type: string
weightUpdatePeriod:
description: How often endpoint weights are recalculated.
type: string
type: object
requestHashPolicies:
description: |-
RequestHashPolicies contains a list of hash policies to apply when the
Expand Down Expand Up @@ -7146,6 +7244,55 @@ spec:
`Cookie` and `RequestHash` load balancing strategies cannot be used
here.
properties:
clientSideWeightedRoundRobinPolicy:
description: ClientSideWeightedRoundRobinPolicy contains configuration
for a client side WRR LB policy.
properties:
blackoutPeriod:
description: |-
A given endpoint must report load metrics continuously for at least
this long before the endpoint weight will be used. This avoids
churn when the set of endpoint addresses changes. Takes effect
both immediately after we establish a connection to an endpoint and
after weight_expiration_period has caused us to stop using the most
recent load metrics.
type: string
enableOobLoadReport:
description: Whether to enable out-of-band utilization
reporting collection from the endpoints.
type: boolean
errorUtilizationPenalty:
description: |-
The multiplier used to adjust endpoint weights with the error rate
calculated as eps/qps.
type: string
metricNamesForComputingUtilization:
description: |-
By default, endpoint weight is computed based on the :ref:`application_utilization <envoy_v3_api_field_.xds.data.orca.v3.OrcaLoadReport.application_utilization>` field reported by the endpoint.
If that field is not set, then utilization will instead be computed by taking the max of the values of the metrics specified here.
For map fields in the ORCA proto, the string will be of the form “<map_field_name>.<map_key>“. For example, the string “named_metrics.foo“ will mean to look for the key “foo“ in the ORCA :ref:`named_metrics <envoy_v3_api_field_.xds.data.orca.v3.OrcaLoadReport.named_metrics>` field.
If none of the specified metrics are present in the load report, then :ref:`cpu_utilization <envoy_v3_api_field_.xds.data.orca.v3.OrcaLoadReport.cpu_utilization>` is used instead.
items:
type: string
type: array
oobReportingPeriod:
description: |-
Load reporting interval to request from the server. Note that the
server may not provide reports as frequently as the client requests.
Used only when enable_oob_load_report is true.
type: string
weightExpirationPeriod:
description: |-
If a given endpoint has not reported load metrics in this long,
then we stop using the reported weight. This ensures that we do
not continue to use very stale weights. Once we stop using a stale
value, if we later start seeing fresh reports again, the
blackout_period applies.
type: string
weightUpdatePeriod:
description: How often endpoint weights are recalculated.
type: string
type: object
requestHashPolicies:
description: |-
RequestHashPolicies contains a list of hash policies to apply when the
Expand Down
Loading