From c2a9991735037dd42c5d72d6ef42d5ac5f5de4db Mon Sep 17 00:00:00 2001 From: "data-plane-api(Azure Pipelines)" Date: Mon, 17 Jan 2022 16:39:00 +0000 Subject: [PATCH] xds: add config for wrr_locality and round_robin LB policy extensions (#19517) This PR adds two new LB policy extension configurations, to be used in gRPC via the new load_balancing_policy field: * round_robin: This allows configuring the built-in ROUND_ROBIN LB policy via the new extension-based API. * wrr_locality: This is an extension config for a new policy that does ROUND_ROBIN-style locality picking and then delegates to a child LB policy extension to pick the endpoint within the locality. This will allow users to plugin their own custom endpoint-picking logic without having to reimplement the locality-picking logic. This is a small step toward moving away from the legacy lb_policy enum. Completing that migration will require work in Envoy to create extension configs for all built-in LB policies and register those extensions. Risk Level: Low Testing: N/A Docs Changes: Included in PR Release Notes: N/A Platform Specific Features: N/A Signed-off-by: Mark D. Roth Mirrored from https://github.com/envoyproxy/envoy @ 65a82d75c3ef1e15fbc4f301c9eacc269a1a6080 --- .../round_robin/v3/BUILD | 12 +++++++++ .../round_robin/v3/round_robin.proto | 26 +++++++++++++++++++ .../wrr_locality/v3/BUILD | 12 +++++++++ .../wrr_locality/v3/wrr_locality.proto | 25 ++++++++++++++++++ versioning/BUILD | 2 ++ 5 files changed, 77 insertions(+) create mode 100644 envoy/extensions/load_balancing_policies/round_robin/v3/BUILD create mode 100644 envoy/extensions/load_balancing_policies/round_robin/v3/round_robin.proto create mode 100644 envoy/extensions/load_balancing_policies/wrr_locality/v3/BUILD create mode 100644 envoy/extensions/load_balancing_policies/wrr_locality/v3/wrr_locality.proto diff --git a/envoy/extensions/load_balancing_policies/round_robin/v3/BUILD b/envoy/extensions/load_balancing_policies/round_robin/v3/BUILD new file mode 100644 index 00000000..b49ae907 --- /dev/null +++ b/envoy/extensions/load_balancing_policies/round_robin/v3/BUILD @@ -0,0 +1,12 @@ +# 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/cluster/v3:pkg", + "@com_github_cncf_udpa//udpa/annotations:pkg", + ], +) diff --git a/envoy/extensions/load_balancing_policies/round_robin/v3/round_robin.proto b/envoy/extensions/load_balancing_policies/round_robin/v3/round_robin.proto new file mode 100644 index 00000000..4875b632 --- /dev/null +++ b/envoy/extensions/load_balancing_policies/round_robin/v3/round_robin.proto @@ -0,0 +1,26 @@ +syntax = "proto3"; + +package envoy.extensions.load_balancing_policies.round_robin.v3; + +import "envoy/config/cluster/v3/cluster.proto"; + +import "udpa/annotations/status.proto"; +import "validate/validate.proto"; + +option java_package = "io.envoyproxy.envoy.extensions.load_balancing_policies.round_robin.v3"; +option java_outer_classname = "RoundRobinProto"; +option java_multiple_files = true; +option go_package = "github.com/envoyproxy/go-control-plane/envoy/extensions/load_balancing_policies/round_robin/v3;round_robinv3"; +option (udpa.annotations.file_status).package_version_status = ACTIVE; + +// [#protodoc-title: Round Robin Load Balancing Policy] + +// 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 +// ` for more information. +// [#extension: envoy.clusters.lb_policy] +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; +} diff --git a/envoy/extensions/load_balancing_policies/wrr_locality/v3/BUILD b/envoy/extensions/load_balancing_policies/wrr_locality/v3/BUILD new file mode 100644 index 00000000..b49ae907 --- /dev/null +++ b/envoy/extensions/load_balancing_policies/wrr_locality/v3/BUILD @@ -0,0 +1,12 @@ +# 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/cluster/v3:pkg", + "@com_github_cncf_udpa//udpa/annotations:pkg", + ], +) diff --git a/envoy/extensions/load_balancing_policies/wrr_locality/v3/wrr_locality.proto b/envoy/extensions/load_balancing_policies/wrr_locality/v3/wrr_locality.proto new file mode 100644 index 00000000..cad403dd --- /dev/null +++ b/envoy/extensions/load_balancing_policies/wrr_locality/v3/wrr_locality.proto @@ -0,0 +1,25 @@ +syntax = "proto3"; + +package envoy.extensions.load_balancing_policies.wrr_locality.v3; + +import "envoy/config/cluster/v3/cluster.proto"; + +import "udpa/annotations/status.proto"; +import "validate/validate.proto"; + +option java_package = "io.envoyproxy.envoy.extensions.load_balancing_policies.wrr_locality.v3"; +option java_outer_classname = "WrrLocalityProto"; +option java_multiple_files = true; +option go_package = "github.com/envoyproxy/go-control-plane/envoy/extensions/load_balancing_policies/wrr_locality/v3;wrr_localityv3"; +option (udpa.annotations.file_status).package_version_status = ACTIVE; + +// [#protodoc-title: Weighted Round Robin Locality-Picking Load Balancing Policy] + +// Configuration for the wrr_locality LB policy. See the :ref:`load balancing architecture overview +// ` for more information. +// [#extension: envoy.clusters.lb_policy] +message WrrLocality { + // The child LB policy to create for endpoint-picking within the chosen locality. + config.cluster.v3.LoadBalancingPolicy endpoint_picking_policy = 1 + [(validate.rules).message = {required: true}]; +} diff --git a/versioning/BUILD b/versioning/BUILD index fb7451e0..b2bba15b 100644 --- a/versioning/BUILD +++ b/versioning/BUILD @@ -155,6 +155,8 @@ 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/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/input_matchers/consistent_hashing/v3:pkg", "//envoy/extensions/matching/input_matchers/ip/v3:pkg",