support override host status restriction for stateful session (#19665)

Stateful session will try to parse upstream address from downstream request directly and override the result of load balancing algorithm by the LoadBalancerContext::overrideHostToSelect API.

To avoid the load balancer selecting hosts that in unexpected statuses, specifying some expected statuses are necessary.

In the previous design, we will provide expected statuses of override host by the LoadBalancerContext::overrideHostToSelect API.

And in the PR #18207, after some discussion with @htuch, we found may be cluster-level config may be more reasonable design and implementation.
Ref some more details: #18207 (comment)

So this PR try to close previous discussion in the #18207:

Refactoring LoadBalancerContext::overrideHostToSelect API to remove expected statuses for the return value.
Add new common lb config override_host_status and related implementation.
Risk Level: Mid.
Testing: N/A.
Docs Changes: N/A.
Release Notes: N/A.
Platform Specific Features: N/A.

@wbpcode

Signed-off-by: wbpcode <wbphub@live.com>

Mirrored from https://github.com/envoyproxy/envoy @ 1575185d14abc3bc508ce5a6ba45422393322551
pull/626/head
data-plane-api(Azure Pipelines) 3 years ago
parent 41ca3c7ef9
commit afda4c0b3e
  1. 10
      envoy/config/cluster/v3/cluster.proto
  2. 6
      envoy/config/core/v3/health_check.proto

@ -486,7 +486,7 @@ message Cluster {
}
// Common configuration for all load balancer implementations.
// [#next-free-field: 8]
// [#next-free-field: 9]
message CommonLbConfig {
option (udpa.annotations.versioning).previous_message_type =
"envoy.api.v2.Cluster.CommonLbConfig";
@ -595,6 +595,14 @@ message Cluster {
// Common Configuration for all consistent hashing load balancers (MaglevLb, RingHashLb, etc.)
ConsistentHashingLbConfig consistent_hashing_lb_config = 7;
// This controls what hosts are considered valid when using
// :ref:`host overrides <arch_overview_load_balancing_override_host>`, which is used by some
// filters to modify the load balancing decision.
//
// If this is unset then [UNKNOWN, HEALTHY, DEGRADED] will be applied by default. If this is
// set with an empty set of statuses then host overrides will be ignored by the load balancing.
core.v3.HealthStatusSet override_host_status = 8;
}
message RefreshRate {

@ -54,6 +54,12 @@ enum HealthStatus {
DEGRADED = 5;
}
message HealthStatusSet {
// An order-independent set of health status.
repeated HealthStatus statuses = 1
[(validate.rules).repeated = {items {enum {defined_only: true}}}];
}
// [#next-free-field: 25]
message HealthCheck {
option (udpa.annotations.versioning).previous_message_type = "envoy.api.v2.core.HealthCheck";

Loading…
Cancel
Save