mirror of https://github.com/status-im/consul.git
[NET-6221] Ensure LB policy set for locality-aware routing (CE) (#19283)
Ensure LB policy set for locality-aware routing (CE) `overprovisioningFactor` should be overridden with the expected value (100,000) when there are multiple endpoint groups. Update code and tests to enforce this. This is an Enterprise feature. This commit represents the CE portions of the change; tests are added in the corresponding `consul-enterprise` change.
This commit is contained in:
parent
d52ee6a222
commit
5e517c5980
|
@ -880,13 +880,7 @@ func makeLoadAssignment(logger hclog.Logger, cfgSnap *proxycfg.ConfigSnapshot, c
|
||||||
Endpoints: make([]*envoy_endpoint_v3.LocalityLbEndpoints, 0, len(endpointGroups)),
|
Endpoints: make([]*envoy_endpoint_v3.LocalityLbEndpoints, 0, len(endpointGroups)),
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(endpointGroups) > 1 {
|
setFullFailoverProvisioningFactor := len(endpointGroups) > 1
|
||||||
cla.Policy = &envoy_endpoint_v3.ClusterLoadAssignment_Policy{
|
|
||||||
// We choose such a large value here that the failover math should
|
|
||||||
// in effect not happen until zero instances are healthy.
|
|
||||||
OverprovisioningFactor: response.MakeUint32Value(100000),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var priority uint32
|
var priority uint32
|
||||||
|
|
||||||
|
@ -897,6 +891,10 @@ func makeLoadAssignment(logger hclog.Logger, cfgSnap *proxycfg.ConfigSnapshot, c
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(endpointsByLocality) > 1 {
|
||||||
|
setFullFailoverProvisioningFactor = true
|
||||||
|
}
|
||||||
|
|
||||||
for _, endpoints := range endpointsByLocality {
|
for _, endpoints := range endpointsByLocality {
|
||||||
es := make([]*envoy_endpoint_v3.LbEndpoint, 0, len(endpointGroup.Endpoints))
|
es := make([]*envoy_endpoint_v3.LbEndpoint, 0, len(endpointGroup.Endpoints))
|
||||||
|
|
||||||
|
@ -930,6 +928,14 @@ func makeLoadAssignment(logger hclog.Logger, cfgSnap *proxycfg.ConfigSnapshot, c
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if setFullFailoverProvisioningFactor {
|
||||||
|
cla.Policy = &envoy_endpoint_v3.ClusterLoadAssignment_Policy{
|
||||||
|
// We choose such a large value here that the failover math should
|
||||||
|
// in effect not happen until zero instances are healthy.
|
||||||
|
OverprovisioningFactor: response.MakeUint32Value(100000),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return cla
|
return cla
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue