Skip to content

Commit 049fa51

Browse files
committed
Add support for ClientSideWeightedRoundRobin LB policy
Signed-off-by: Anton Kuklin <anton.a.kuklin@gmail.com>
1 parent cdf2738 commit 049fa51

File tree

19 files changed

+1606
-4
lines changed

19 files changed

+1606
-4
lines changed

apis/projectcontour/v1/httpproxy.go

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1299,6 +1299,49 @@ type LoadBalancerPolicy struct {
12991299
// list of hash policies is empty after validation, the load balancing
13001300
// strategy will fall back to the default `RoundRobin`.
13011301
RequestHashPolicies []RequestHashPolicy `json:"requestHashPolicies,omitempty"`
1302+
1303+
// ClientSideWeightedRoundRobinPolicy contains configuration for a client side WRR LB policy.
1304+
ClientSideWeightedRoundRobinPolicy *LoadBalancerPolicyClientSideWeightedRoundRobinPolicy `json:"clientSideWeightedRoundRobinPolicy,omitempty"`
1305+
}
1306+
1307+
// LoadBalancerPolicyClientSideWeightedRoundRobinPolicy holds configuration for a client side wrr lb policy.
1308+
// For default values, constraints and behavior patterns refer to the envoy doc.
1309+
type LoadBalancerPolicyClientSideWeightedRoundRobinPolicy struct {
1310+
// Whether to enable out-of-band utilization reporting collection from the endpoints.
1311+
EnableOOBLoadReport *bool `json:"enableOobLoadReport,omitempty"`
1312+
1313+
// Load reporting interval to request from the server. Note that the
1314+
// server may not provide reports as frequently as the client requests.
1315+
// Used only when enable_oob_load_report is true.
1316+
OOBReportingPeriod string `json:"oobReportingPeriod,omitempty"`
1317+
1318+
// A given endpoint must report load metrics continuously for at least
1319+
// this long before the endpoint weight will be used. This avoids
1320+
// churn when the set of endpoint addresses changes. Takes effect
1321+
// both immediately after we establish a connection to an endpoint and
1322+
// after weight_expiration_period has caused us to stop using the most
1323+
// recent load metrics.
1324+
BlackoutPeriod string `json:"blackoutPeriod,omitempty"`
1325+
1326+
// If a given endpoint has not reported load metrics in this long,
1327+
// then we stop using the reported weight. This ensures that we do
1328+
// not continue to use very stale weights. Once we stop using a stale
1329+
// value, if we later start seeing fresh reports again, the
1330+
// blackout_period applies.
1331+
WeightExpirationPeriod string `json:"weightExpirationPeriod,omitempty"`
1332+
1333+
// How often endpoint weights are recalculated.
1334+
WeightUpdatePeriod string `json:"weightUpdatePeriod,omitempty"`
1335+
1336+
// The multiplier used to adjust endpoint weights with the error rate
1337+
// calculated as eps/qps.
1338+
ErrorUtilizationPenalty string `json:"errorUtilizationPenalty,omitempty"`
1339+
1340+
// 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.
1341+
// If that field is not set, then utilization will instead be computed by taking the max of the values of the metrics specified here.
1342+
// 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.
1343+
// 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.
1344+
MetricNamesForComputingUtilization []string `json:"metricNamesForComputingUtilization,omitempty"`
13021345
}
13031346

13041347
// HeadersPolicy defines how headers are managed during forwarding.

apis/projectcontour/v1/zz_generated.deepcopy.go

Lines changed: 30 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Adds support for `ClientSideWeightedRoundRobin` LB policy in HTTPProxy and Extension service.

examples/contour/01-crds.yaml

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5188,6 +5188,55 @@ spec:
51885188
`Cookie` and `RequestHash` load balancing strategies cannot be used
51895189
here.
51905190
properties:
5191+
clientSideWeightedRoundRobinPolicy:
5192+
description: ClientSideWeightedRoundRobinPolicy contains configuration
5193+
for a client side WRR LB policy.
5194+
properties:
5195+
blackoutPeriod:
5196+
description: |-
5197+
A given endpoint must report load metrics continuously for at least
5198+
this long before the endpoint weight will be used. This avoids
5199+
churn when the set of endpoint addresses changes. Takes effect
5200+
both immediately after we establish a connection to an endpoint and
5201+
after weight_expiration_period has caused us to stop using the most
5202+
recent load metrics.
5203+
type: string
5204+
enableOobLoadReport:
5205+
description: Whether to enable out-of-band utilization reporting
5206+
collection from the endpoints.
5207+
type: boolean
5208+
errorUtilizationPenalty:
5209+
description: |-
5210+
The multiplier used to adjust endpoint weights with the error rate
5211+
calculated as eps/qps.
5212+
type: string
5213+
metricNamesForComputingUtilization:
5214+
description: |-
5215+
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.
5216+
If that field is not set, then utilization will instead be computed by taking the max of the values of the metrics specified here.
5217+
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.
5218+
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.
5219+
items:
5220+
type: string
5221+
type: array
5222+
oobReportingPeriod:
5223+
description: |-
5224+
Load reporting interval to request from the server. Note that the
5225+
server may not provide reports as frequently as the client requests.
5226+
Used only when enable_oob_load_report is true.
5227+
type: string
5228+
weightExpirationPeriod:
5229+
description: |-
5230+
If a given endpoint has not reported load metrics in this long,
5231+
then we stop using the reported weight. This ensures that we do
5232+
not continue to use very stale weights. Once we stop using a stale
5233+
value, if we later start seeing fresh reports again, the
5234+
blackout_period applies.
5235+
type: string
5236+
weightUpdatePeriod:
5237+
description: How often endpoint weights are recalculated.
5238+
type: string
5239+
type: object
51915240
requestHashPolicies:
51925241
description: |-
51935242
RequestHashPolicies contains a list of hash policies to apply when the
@@ -6245,6 +6294,55 @@ spec:
62456294
loadBalancerPolicy:
62466295
description: The load balancing policy for this route.
62476296
properties:
6297+
clientSideWeightedRoundRobinPolicy:
6298+
description: ClientSideWeightedRoundRobinPolicy contains
6299+
configuration for a client side WRR LB policy.
6300+
properties:
6301+
blackoutPeriod:
6302+
description: |-
6303+
A given endpoint must report load metrics continuously for at least
6304+
this long before the endpoint weight will be used. This avoids
6305+
churn when the set of endpoint addresses changes. Takes effect
6306+
both immediately after we establish a connection to an endpoint and
6307+
after weight_expiration_period has caused us to stop using the most
6308+
recent load metrics.
6309+
type: string
6310+
enableOobLoadReport:
6311+
description: Whether to enable out-of-band utilization
6312+
reporting collection from the endpoints.
6313+
type: boolean
6314+
errorUtilizationPenalty:
6315+
description: |-
6316+
The multiplier used to adjust endpoint weights with the error rate
6317+
calculated as eps/qps.
6318+
type: string
6319+
metricNamesForComputingUtilization:
6320+
description: |-
6321+
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.
6322+
If that field is not set, then utilization will instead be computed by taking the max of the values of the metrics specified here.
6323+
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.
6324+
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.
6325+
items:
6326+
type: string
6327+
type: array
6328+
oobReportingPeriod:
6329+
description: |-
6330+
Load reporting interval to request from the server. Note that the
6331+
server may not provide reports as frequently as the client requests.
6332+
Used only when enable_oob_load_report is true.
6333+
type: string
6334+
weightExpirationPeriod:
6335+
description: |-
6336+
If a given endpoint has not reported load metrics in this long,
6337+
then we stop using the reported weight. This ensures that we do
6338+
not continue to use very stale weights. Once we stop using a stale
6339+
value, if we later start seeing fresh reports again, the
6340+
blackout_period applies.
6341+
type: string
6342+
weightUpdatePeriod:
6343+
description: How often endpoint weights are recalculated.
6344+
type: string
6345+
type: object
62486346
requestHashPolicies:
62496347
description: |-
62506348
RequestHashPolicies contains a list of hash policies to apply when the
@@ -7146,6 +7244,55 @@ spec:
71467244
`Cookie` and `RequestHash` load balancing strategies cannot be used
71477245
here.
71487246
properties:
7247+
clientSideWeightedRoundRobinPolicy:
7248+
description: ClientSideWeightedRoundRobinPolicy contains configuration
7249+
for a client side WRR LB policy.
7250+
properties:
7251+
blackoutPeriod:
7252+
description: |-
7253+
A given endpoint must report load metrics continuously for at least
7254+
this long before the endpoint weight will be used. This avoids
7255+
churn when the set of endpoint addresses changes. Takes effect
7256+
both immediately after we establish a connection to an endpoint and
7257+
after weight_expiration_period has caused us to stop using the most
7258+
recent load metrics.
7259+
type: string
7260+
enableOobLoadReport:
7261+
description: Whether to enable out-of-band utilization
7262+
reporting collection from the endpoints.
7263+
type: boolean
7264+
errorUtilizationPenalty:
7265+
description: |-
7266+
The multiplier used to adjust endpoint weights with the error rate
7267+
calculated as eps/qps.
7268+
type: string
7269+
metricNamesForComputingUtilization:
7270+
description: |-
7271+
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.
7272+
If that field is not set, then utilization will instead be computed by taking the max of the values of the metrics specified here.
7273+
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.
7274+
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.
7275+
items:
7276+
type: string
7277+
type: array
7278+
oobReportingPeriod:
7279+
description: |-
7280+
Load reporting interval to request from the server. Note that the
7281+
server may not provide reports as frequently as the client requests.
7282+
Used only when enable_oob_load_report is true.
7283+
type: string
7284+
weightExpirationPeriod:
7285+
description: |-
7286+
If a given endpoint has not reported load metrics in this long,
7287+
then we stop using the reported weight. This ensures that we do
7288+
not continue to use very stale weights. Once we stop using a stale
7289+
value, if we later start seeing fresh reports again, the
7290+
blackout_period applies.
7291+
type: string
7292+
weightUpdatePeriod:
7293+
description: How often endpoint weights are recalculated.
7294+
type: string
7295+
type: object
71497296
requestHashPolicies:
71507297
description: |-
71517298
RequestHashPolicies contains a list of hash policies to apply when the

0 commit comments

Comments
 (0)