Skip to content
Merged
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
7 changes: 7 additions & 0 deletions api/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,13 @@ proto_library(
"//envoy/extensions/internal_redirect/previous_routes/v3:pkg",
"//envoy/extensions/internal_redirect/safe_cross_scheme/v3:pkg",
"//envoy/extensions/key_value/file_based/v3:pkg",
"//envoy/extensions/load_balancing_policies/common/v3:pkg",
"//envoy/extensions/load_balancing_policies/least_request/v3:pkg",
"//envoy/extensions/load_balancing_policies/maglev/v3:pkg",
"//envoy/extensions/load_balancing_policies/random/v3:pkg",
"//envoy/extensions/load_balancing_policies/ring_hash/v3:pkg",
"//envoy/extensions/load_balancing_policies/round_robin/v3:pkg",
"//envoy/extensions/load_balancing_policies/wrr_locality/v3:pkg",
"//envoy/extensions/matching/common_inputs/environment_variable/v3:pkg",
"//envoy/extensions/matching/common_inputs/network/v3:pkg",
"//envoy/extensions/matching/common_inputs/ssl/v3:pkg",
Expand Down
13 changes: 13 additions & 0 deletions api/envoy/extensions/load_balancing_policies/common/v3/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# DO NOT EDIT. This file is generated by tools/proto_format/proto_sync.py.

load("@envoy_api//bazel:api_build_system.bzl", "api_proto_package")

licenses(["notice"]) # Apache 2

api_proto_package(
deps = [
"//envoy/config/core/v3:pkg",
"//envoy/type/v3:pkg",
"@com_github_cncf_udpa//udpa/annotations:pkg",
],
)
115 changes: 115 additions & 0 deletions api/envoy/extensions/load_balancing_policies/common/v3/common.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
syntax = "proto3";

package envoy.extensions.load_balancing_policies.common.v3;

import "envoy/config/core/v3/base.proto";
import "envoy/type/v3/percent.proto";

import "google/protobuf/duration.proto";
import "google/protobuf/wrappers.proto";

import "udpa/annotations/status.proto";
import "validate/validate.proto";

option java_package = "io.envoyproxy.envoy.extensions.load_balancing_policies.common.v3";
option java_outer_classname = "CommonProto";
option java_multiple_files = true;
option go_package = "github.com/envoyproxy/go-control-plane/envoy/extensions/load_balancing_policies/common/v3;commonv3";
option (udpa.annotations.file_status).package_version_status = ACTIVE;

// [#protodoc-title: Common configuration for two or more load balancing policy extensions]
// [#not-implemented-hide:]

message LocalityLbConfig {
// Configuration for :ref:`zone aware routing
// <arch_overview_load_balancing_zone_aware_routing>`.
message ZoneAwareLbConfig {
// Configures percentage of requests that will be considered for zone aware routing
// if zone aware routing is configured. If not specified, the default is 100%.
// * :ref:`runtime values <config_cluster_manager_cluster_runtime_zone_routing>`.
// * :ref:`Zone aware routing support <arch_overview_load_balancing_zone_aware_routing>`.
type.v3.Percent routing_enabled = 1;

// Configures minimum upstream cluster size required for zone aware routing
// If upstream cluster size is less than specified, zone aware routing is not performed
// even if zone aware routing is configured. If not specified, the default is 6.
// * :ref:`runtime values <config_cluster_manager_cluster_runtime_zone_routing>`.
// * :ref:`Zone aware routing support <arch_overview_load_balancing_zone_aware_routing>`.
google.protobuf.UInt64Value min_cluster_size = 2;

// If set to true, Envoy will not consider any hosts when the cluster is in :ref:`panic
// mode<arch_overview_load_balancing_panic_threshold>`. Instead, the cluster will fail all
// requests as if all hosts are unhealthy. This can help avoid potentially overwhelming a
// failing service.
bool fail_traffic_on_panic = 3;
}

// Configuration for :ref:`locality weighted load balancing
// <arch_overview_load_balancing_locality_weighted_lb>`
message LocalityWeightedLbConfig {
}

oneof locality_config_specifier {
option (validate.required) = true;

// Configuration for local zone aware load balancing.
ZoneAwareLbConfig zone_aware_lb_config = 1;

// Enable locality weighted load balancing.
LocalityWeightedLbConfig locality_weighted_lb_config = 2;
}
}

// Configuration for :ref:`slow start mode <arch_overview_load_balancing_slow_start>`.
message SlowStartConfig {
// Represents the size of slow start window.
// If set, the newly created host remains in slow start mode starting from its creation time
// for the duration of slow start window.
google.protobuf.Duration slow_start_window = 1;

// This parameter controls the speed of traffic increase over the slow start window. Defaults to 1.0,
// so that endpoint would get linearly increasing amount of traffic.
// When increasing the value for this parameter, the speed of traffic ramp-up increases non-linearly.
// The value of aggression parameter should be greater than 0.0.
// By tuning the parameter, is possible to achieve polynomial or exponential shape of ramp-up curve.
//
// During slow start window, effective weight of an endpoint would be scaled with time factor and aggression:
// ``new_weight = weight * max(min_weight_percent, time_factor ^ (1 / aggression))``,
// where ``time_factor=(time_since_start_seconds / slow_start_time_seconds)``.
//
// As time progresses, more and more traffic would be sent to endpoint, which is in slow start window.
// Once host exits slow start, time_factor and aggression no longer affect its weight.
config.core.v3.RuntimeDouble aggression = 2;

// Configures the minimum percentage of origin weight that avoids too small new weight,
// which may cause endpoints in slow start mode receive no traffic in slow start window.
// If not specified, the default is 10%.
type.v3.Percent min_weight_percent = 3;
}

// Common Configuration for all consistent hashing load balancers (MaglevLb, RingHashLb, etc.)
message ConsistentHashingLbConfig {
// If set to ``true``, the cluster will use hostname instead of the resolved
// address as the key to consistently hash to an upstream host. Only valid for StrictDNS clusters with hostnames which resolve to a single IP address.
bool use_hostname_for_hashing = 1;

// Configures percentage of average cluster load to bound per upstream host. For example, with a value of 150
// no upstream host will get a load more than 1.5 times the average load of all the hosts in the cluster.
// If not specified, the load is not bounded for any upstream host. Typical value for this parameter is between 120 and 200.
// Minimum is 100.
//
// Applies to both Ring Hash and Maglev load balancers.
//
// This is implemented based on the method described in the paper https://arxiv.org/abs/1608.01350. For the specified
// ``hash_balance_factor``, requests to any upstream host are capped at ``hash_balance_factor/100`` times the average number of requests
// across the cluster. When a request arrives for an upstream host that is currently serving at its max capacity, linear probing
// is used to identify an eligible host. Further, the linear probe is implemented using a random jump in hosts ring/table to identify
// the eligible host (this technique is as described in the paper https://arxiv.org/abs/1908.08762 - the random jump avoids the
// cascading overflow effect when choosing the next host in the ring/table).
//
// If weights are specified on the hosts, they are respected.
//
// This is an O(N) algorithm, unlike other load balancers. Using a lower ``hash_balance_factor`` results in more hosts
// being probed, so use a higher value if you require better performance.
google.protobuf.UInt32Value hash_balance_factor = 2 [(validate.rules).uint32 = {gte: 100}];
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ licenses(["notice"]) # Apache 2

api_proto_package(
deps = [
"//envoy/config/cluster/v3:pkg",
"//envoy/config/core/v3:pkg",
"//envoy/extensions/load_balancing_policies/common/v3:pkg",
"@com_github_cncf_udpa//udpa/annotations:pkg",
],
)
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ syntax = "proto3";

package envoy.extensions.load_balancing_policies.least_request.v3;

import "envoy/config/cluster/v3/cluster.proto";
import "envoy/config/core/v3/base.proto";
import "envoy/extensions/load_balancing_policies/common/v3/common.proto";

import "google/protobuf/wrappers.proto";

Expand All @@ -22,7 +22,6 @@ option (udpa.annotations.file_status).package_version_status = ACTIVE;
// This configuration allows the built-in LEAST_REQUEST LB policy to be configured via the LB policy
// extension point. See the :ref:`load balancing architecture overview
// <arch_overview_load_balancing_types>` for more information.
// [#extension: envoy.load_balancing_policies]
Copy link
Contributor

Choose a reason for hiding this comment

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

Why remove these extension comments? I think they're needed to generate the right documentation.

Copy link
Member Author

Choose a reason for hiding this comment

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

These comments are wrong. The [#extension] comment should be complete name of extension.
I will ensure all these are correct when I implement these extensions.

message LeastRequest {
// The number of random healthy hosts from which the host with the fewest active requests will
// be chosen. Defaults to 2 so that we perform two-choice selection if the field is not set.
Expand Down Expand Up @@ -55,5 +54,8 @@ message LeastRequest {

// Configuration for slow start mode.
// If this configuration is not set, slow start will not be not enabled.
config.cluster.v3.Cluster.SlowStartConfig slow_start_config = 3;
common.v3.SlowStartConfig slow_start_config = 3;

// Configuration for local zone aware load balancing or locality weighted load balancing.
common.v3.LocalityLbConfig locality_lb_config = 4;
}
5 changes: 4 additions & 1 deletion api/envoy/extensions/load_balancing_policies/maglev/v3/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,8 @@ load("@envoy_api//bazel:api_build_system.bzl", "api_proto_package")
licenses(["notice"]) # Apache 2

api_proto_package(
deps = ["@com_github_cncf_udpa//udpa/annotations:pkg"],
deps = [
"//envoy/extensions/load_balancing_policies/common/v3:pkg",
"@com_github_cncf_udpa//udpa/annotations:pkg",
],
)
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ syntax = "proto3";

package envoy.extensions.load_balancing_policies.maglev.v3;

import "envoy/extensions/load_balancing_policies/common/v3/common.proto";

import "google/protobuf/wrappers.proto";

import "udpa/annotations/status.proto";
Expand All @@ -19,11 +21,13 @@ option (udpa.annotations.file_status).package_version_status = ACTIVE;
// This configuration allows the built-in Maglev LB policy to be configured via the LB policy
// extension point. See the :ref:`load balancing architecture overview
// <arch_overview_load_balancing_types>` and :ref:`Maglev<arch_overview_load_balancing_types_maglev>` for more information.
// [#extension: envoy.load_balancing_policies]
message Maglev {
// The table size for Maglev hashing. Maglev aims for "minimal disruption" rather than an absolute guarantee.
// Minimal disruption means that when the set of upstream hosts change, a connection will likely be sent to the same
// upstream as it was before. Increasing the table size reduces the amount of disruption.
// The table size must be prime number limited to 5000011. If it is not specified, the default is 65537.
google.protobuf.UInt64Value table_size = 1 [(validate.rules).uint64 = {lte: 5000011}];

// Common configuration for hashing-based load balancing policies.
common.v3.ConsistentHashingLbConfig consistent_hashing_lb_config = 2;
}
5 changes: 4 additions & 1 deletion api/envoy/extensions/load_balancing_policies/random/v3/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,8 @@ load("@envoy_api//bazel:api_build_system.bzl", "api_proto_package")
licenses(["notice"]) # Apache 2

api_proto_package(
deps = ["@com_github_cncf_udpa//udpa/annotations:pkg"],
deps = [
"//envoy/extensions/load_balancing_policies/common/v3:pkg",
"@com_github_cncf_udpa//udpa/annotations:pkg",
],
)
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ syntax = "proto3";

package envoy.extensions.load_balancing_policies.random.v3;

import "envoy/extensions/load_balancing_policies/common/v3/common.proto";

import "udpa/annotations/status.proto";

option java_package = "io.envoyproxy.envoy.extensions.load_balancing_policies.random.v3";
Expand All @@ -16,6 +18,7 @@ option (udpa.annotations.file_status).package_version_status = ACTIVE;
// This configuration allows the built-in Random LB policy to be configured via the LB policy
// extension point. See the :ref:`load balancing architecture overview
// <arch_overview_load_balancing_types>` for more information.
// [#extension: envoy.load_balancing_policies]
message Random {
// Configuration for local zone aware load balancing or locality weighted load balancing.
common.v3.LocalityLbConfig locality_lb_config = 1;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,9 @@ load("@envoy_api//bazel:api_build_system.bzl", "api_proto_package")
licenses(["notice"]) # Apache 2

api_proto_package(
deps = ["@com_github_cncf_udpa//udpa/annotations:pkg"],
deps = [
"//envoy/annotations:pkg",
"//envoy/extensions/load_balancing_policies/common/v3:pkg",
"@com_github_cncf_udpa//udpa/annotations:pkg",
],
)
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ syntax = "proto3";

package envoy.extensions.load_balancing_policies.ring_hash.v3;

import "envoy/extensions/load_balancing_policies/common/v3/common.proto";

import "google/protobuf/wrappers.proto";

import "envoy/annotations/deprecation.proto";
import "udpa/annotations/status.proto";
import "validate/validate.proto";

Expand All @@ -19,8 +22,7 @@ option (udpa.annotations.file_status).package_version_status = ACTIVE;
// This configuration allows the built-in RING_HASH LB policy to be configured via the LB policy
// extension point. See the :ref:`load balancing architecture overview
// <arch_overview_load_balancing_types>` for more information.
// [#extension: envoy.load_balancing_policies]
// [#next-free-field: 6]
// [#next-free-field: 7]
message RingHash {
// The hash function used to hash hosts onto the ketama ring.
enum HashFunction {
Expand Down Expand Up @@ -53,7 +55,12 @@ message RingHash {

// If set to `true`, the cluster will use hostname instead of the resolved
// address as the key to consistently hash to an upstream host. Only valid for StrictDNS clusters with hostnames which resolve to a single IP address.
bool use_hostname_for_hashing = 4;
//
// ..note::
// This is deprecated and please use :ref:`consistent_hashing_lb_config
// <envoy_v3_api_field_extensions.load_balancing_policies.ring_hash.v3.RingHash.consistent_hashing_lb_config>` instead.
bool use_hostname_for_hashing = 4
[deprecated = true, (envoy.annotations.deprecated_at_minor_version) = "3.0"];

// Configures percentage of average cluster load to bound per upstream host. For example, with a value of 150
// no upstream host will get a load more than 1.5 times the average load of all the hosts in the cluster.
Expand All @@ -71,5 +78,16 @@ message RingHash {
//
// This is an O(N) algorithm, unlike other load balancers. Using a lower `hash_balance_factor` results in more hosts
// being probed, so use a higher value if you require better performance.
google.protobuf.UInt32Value hash_balance_factor = 5 [(validate.rules).uint32 = {gte: 100}];
//
// ..note::
// This is deprecated and please use :ref:`consistent_hashing_lb_config
// <envoy_v3_api_field_extensions.load_balancing_policies.ring_hash.v3.RingHash.consistent_hashing_lb_config>` instead.
google.protobuf.UInt32Value hash_balance_factor = 5 [
deprecated = true,
(validate.rules).uint32 = {gte: 100},
(envoy.annotations.deprecated_at_minor_version) = "3.0"
];

// Common configuration for hashing-based load balancing policies.
common.v3.ConsistentHashingLbConfig consistent_hashing_lb_config = 6;
Copy link
Contributor

Choose a reason for hiding this comment

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

Docs for this here and for the other lib configs?

Copy link
Member Author

Choose a reason for hiding this comment

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

Most docs are comments of inner fields of common.v3.ConsistentHashingLbConfig. And simple comments to consistent_hashing_lb_config are added.

}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ licenses(["notice"]) # Apache 2

api_proto_package(
deps = [
"//envoy/config/cluster/v3:pkg",
"//envoy/extensions/load_balancing_policies/common/v3:pkg",
"@com_github_cncf_udpa//udpa/annotations:pkg",
],
)
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ syntax = "proto3";

package envoy.extensions.load_balancing_policies.round_robin.v3;

import "envoy/config/cluster/v3/cluster.proto";
import "envoy/extensions/load_balancing_policies/common/v3/common.proto";

import "udpa/annotations/status.proto";

Expand All @@ -18,9 +18,11 @@ option (udpa.annotations.file_status).package_version_status = ACTIVE;
// This configuration allows the built-in ROUND_ROBIN LB policy to be configured via the LB policy
// extension point. See the :ref:`load balancing architecture overview
// <arch_overview_load_balancing_types>` for more information.
// [#extension: envoy.load_balancing_policies]
message RoundRobin {
// Configuration for slow start mode.
// If this configuration is not set, slow start will not be not enabled.
config.cluster.v3.Cluster.SlowStartConfig slow_start_config = 1;
common.v3.SlowStartConfig slow_start_config = 1;

// Configuration for local zone aware load balancing or locality weighted load balancing.
common.v3.LocalityLbConfig locality_lb_config = 2;
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ option go_package = "github.com/envoyproxy/go-control-plane/envoy/extensions/loa
option (udpa.annotations.file_status).package_version_status = ACTIVE;

// [#protodoc-title: Weighted Round Robin Locality-Picking Load Balancing Policy]
// [#not-implemented-hide:]

// Configuration for the wrr_locality LB policy. See the :ref:`load balancing architecture overview
// <arch_overview_load_balancing_types>` for more information.
// [#extension: envoy.load_balancing_policies]
message WrrLocality {
// The child LB policy to create for endpoint-picking within the chosen locality.
config.cluster.v3.LoadBalancingPolicy endpoint_picking_policy = 1
Expand Down
1 change: 1 addition & 0 deletions api/versioning/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ proto_library(
"//envoy/extensions/internal_redirect/previous_routes/v3:pkg",
"//envoy/extensions/internal_redirect/safe_cross_scheme/v3:pkg",
"//envoy/extensions/key_value/file_based/v3:pkg",
"//envoy/extensions/load_balancing_policies/common/v3:pkg",
"//envoy/extensions/load_balancing_policies/least_request/v3:pkg",
"//envoy/extensions/load_balancing_policies/maglev/v3:pkg",
"//envoy/extensions/load_balancing_policies/random/v3:pkg",
Expand Down