RLS LB policy (#27352)

* RLS LB policy plugin implementation

* Add RLS tests

* rls proto

* generate projects

* Fix adding child policy to child policy map

* Fix issues

* Fix rotten bits

* generate projects

* revert some strange changes

* First batch of fixes

* second batch of addressing comments

* generate_projects

* 3rd batch of fixes

* generate_projects

* 4th batch of fix

* 5th batch of fix

* Empty commit to trigger github PR refresh

* Add insecure build

* generate project

* update picker in a closure

* mutex guard audit

* clang-format

* Aggregate child policy states

* Use OrphanablePtr on ChildPolicyOwner()

* More fixes on comments

* Remove include grpc_security from rls.cc

* Fix key builder test as we removed RlsFindPathFromMetadata

* Update rls proto and add multi-target capability

* code changes to fix build after merging master

* remove support for insecure builds

* WIP

* add LB policy metadata lookup API

* add API for creating errors from C++ strings

* add missing include

* finished updating JSON parsing

* use DualRefCounted<> for ChildPolicyWrapper

* use grpc_core::Mutex instead of std::recursive_mutex

* add lock annotations and fix some lifetime issues

* misc fixes and cleanups

* simplify child policy connectivity state machine

* add comment about hopping into ExecCtx

* don't use wait_for_ready for RLS call

* extraKeys and constantKeys support

* add lock annotations for child policy wrapper connectivity state

* improve logging

* simplify child policy state handling in picker

* use C++ style comments

* remove rls_config.proto, since it's not needed

* rewrote tests

* fix build

* fix copyright headers

* clang-format

* appease clang-tidy

* remove unnecessary dependendency on grpclb

* buildifier

* remove illegal term

* remove unneeded includes

* clang-format

* fix clang-tidy

* fix build

* move class declaration into .cc file

* clang-tidy again

* fix build

* reorganize code and misc cleanups

* clang-format

* fixed a bunch of asan bugs; still some left to debug

* fix asan problem

* make test work on IPv6-only machines

* move LRU list handling into Cache::Entry and add lock annotations

* use preincrement instead of postincrement

* fix deadlock

* add more FIXMEs

* clean up backoff timer logic

* fix build from merge

* clang-format

* fix include path to work on podspec builds

* clean up picker logic

* clang-format

* update rls.proto

* populate reason and stale_header_data in RLS request

* improve logging and fix some cache size type issues

* clang-format

* add some TODOs about a better way to expose channel creds to LB policies

* centralize handling of channel's default authority

* clang-format

* fix backup poller bug

* fix handling of call creds and authority on RLS channel

* remove unused params

* clang-format

* use two-phase update for child policies to avoid deadlocks

* fix portability issue

* minor cleanups

* update for change in grpc_error_get_status() API

* change test to store RLS requests and responses in proto form

* clang-format

* account for test slowdown factor in timeouts

* fix tsan failure and channelz linkage

* fix RLS authority death test

* fix test to not try to connect to target that should not work

* remove illegal term

* cacheSizeBytes is a required field

* add missing BUILD deps from merge

* add tests for connectivity state reporting and fix bugs found

* fix BUILD sanity

* buildifier

* fix BUILD package path

* fix bugs related to child policy lifetime and updates

* remove unnecessary srand() call from grpc_init()

* add test for two cache entries with the same target

* update rls.proto

* change RLS config parser test to support GRPC_ERROR_IS_ABSEIL_STATUS

* update upb codegen

* fix include path

* add env var guard

* avoid duplication of CountedService

* generate_projects

* add upper limit for cacheSizeBytes

* fix build

Co-authored-by: Muxi Yan <mxyan@google.com>
pull/27705/head
Mark D. Roth 3 years ago committed by GitHub
parent d1297bcc17
commit 84ddc3289f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 46
      BUILD
  2. 105
      CMakeLists.txt
  3. 4
      Makefile
  4. 33
      build_autogenerated.yaml
  5. 4
      config.m4
  6. 5
      config.w32
  7. 1
      doc/environment_variables.md
  8. 3
      gRPC-C++.podspec
  9. 5
      gRPC-Core.podspec
  10. 3
      grpc.gemspec
  11. 3
      grpc.gyp
  12. 3
      package.xml
  13. 5
      src/core/ext/filters/client_channel/lb_policy.h
  14. 2502
      src/core/ext/filters/client_channel/lb_policy/rls/rls.cc
  15. 8
      src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc
  16. 4
      src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc
  17. 2
      src/core/ext/filters/client_channel/resolver_result_parsing.cc
  18. 55
      src/core/ext/upb-generated/src/proto/grpc/lookup/v1/rls.upb.c
  19. 154
      src/core/ext/upb-generated/src/proto/grpc/lookup/v1/rls.upb.h
  20. 63
      src/core/ext/upbdefs-generated/src/proto/grpc/lookup/v1/rls.upbdefs.c
  21. 45
      src/core/ext/upbdefs-generated/src/proto/grpc/lookup/v1/rls.upbdefs.h
  22. 13
      src/core/lib/json/json_util.h
  23. 5
      src/core/lib/security/credentials/credentials.h
  24. 4
      src/core/plugin_registry/grpc_plugin_registry.cc
  25. 28
      src/proto/grpc/lookup/v1/BUILD
  26. 62
      src/proto/grpc/lookup/v1/rls.proto
  27. 2
      src/python/grpcio/grpc_core_dependencies.py
  28. 13
      test/core/client_channel/BUILD
  29. 550
      test/core/client_channel/rls_lb_config_parser_test.cc
  30. 120
      test/core/util/test_lb_policies.cc
  31. 4
      test/core/util/test_lb_policies.h
  32. 24
      test/cpp/end2end/BUILD
  33. 1458
      test/cpp/end2end/rls_end2end_test.cc
  34. 1
      tools/codegen/core/gen_upb_api.sh
  35. 3
      tools/doxygen/Doxyfile.c++.internal
  36. 3
      tools/doxygen/Doxyfile.core.internal
  37. 48
      tools/run_tests/generated/tests.json

46
BUILD

@ -402,6 +402,7 @@ grpc_cc_library(
"grpc_base",
"grpc_common",
"grpc_lb_policy_grpclb_secure",
"grpc_lb_policy_rls",
"grpc_secure",
"grpc_trace",
"grpc_transport_chttp2_client_secure",
@ -2255,6 +2256,51 @@ grpc_cc_library(
],
)
grpc_cc_library(
name = "rls_upb",
srcs = [
"src/core/ext/upb-generated/src/proto/grpc/lookup/v1/rls.upb.c",
],
hdrs = [
"src/core/ext/upb-generated/src/proto/grpc/lookup/v1/rls.upb.h",
],
external_deps = [
"upb_lib",
"upb_lib_descriptor",
"upb_generated_code_support__only_for_generated_code_do_not_use__i_give_permission_to_break_me",
],
language = "c++",
)
grpc_cc_library(
name = "grpc_lb_policy_rls",
srcs = [
"src/core/ext/filters/client_channel/lb_policy/rls/rls.cc",
],
external_deps = [
"absl/container:inlined_vector",
"absl/hash",
"absl/memory",
"absl/strings",
"upb_lib",
],
language = "c++",
deps = [
"dual_ref_counted",
"gpr_base",
"gpr_codegen",
"grpc_base",
"grpc_client_channel",
"grpc_codegen",
"grpc_secure",
"json",
"json_util",
"orphanable",
"ref_counted",
"rls_upb",
],
)
grpc_cc_library(
name = "grpc_xds_client",
srcs = [

105
CMakeLists.txt generated

@ -394,6 +394,9 @@ protobuf_generate_grpc_cpp(
protobuf_generate_grpc_cpp(
src/proto/grpc/lb/v1/load_balancer.proto
)
protobuf_generate_grpc_cpp(
src/proto/grpc/lookup/v1/rls.proto
)
protobuf_generate_grpc_cpp(
src/proto/grpc/reflection/v1alpha/reflection.proto
)
@ -888,6 +891,8 @@ if(gRPC_BUILD_TESTS)
add_dependencies(buildtests_cxx remove_stream_from_stalled_lists_test)
endif()
add_dependencies(buildtests_cxx retry_throttle_test)
add_dependencies(buildtests_cxx rls_end2end_test)
add_dependencies(buildtests_cxx rls_lb_config_parser_test)
add_dependencies(buildtests_cxx sdk_authz_end2end_test)
add_dependencies(buildtests_cxx secure_auth_context_test)
add_dependencies(buildtests_cxx seq_test)
@ -1511,6 +1516,7 @@ add_library(grpc
src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc
src/core/ext/filters/client_channel/lb_policy/priority/priority.cc
src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc
src/core/ext/filters/client_channel/lb_policy/rls/rls.cc
src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc
src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc
src/core/ext/filters/client_channel/lb_policy/xds/cds.cc
@ -1671,6 +1677,7 @@ add_library(grpc
src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c
src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c
src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c
src/core/ext/upb-generated/src/proto/grpc/lookup/v1/rls.upb.c
src/core/ext/upb-generated/udpa/annotations/migrate.upb.c
src/core/ext/upb-generated/udpa/annotations/security.upb.c
src/core/ext/upb-generated/udpa/annotations/sensitive.upb.c
@ -2092,6 +2099,7 @@ target_link_libraries(grpc
absl::flat_hash_map
absl::inlined_vector
absl::bind_front
absl::hash
absl::statusor
absl::variant
absl::utility
@ -14046,6 +14054,99 @@ target_link_libraries(retry_throttle_test
)
endif()
if(gRPC_BUILD_TESTS)
add_executable(rls_end2end_test
${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/lookup/v1/rls.pb.cc
${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/lookup/v1/rls.grpc.pb.cc
${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/lookup/v1/rls.pb.h
${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/lookup/v1/rls.grpc.pb.h
${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/duplicate/echo_duplicate.pb.cc
${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.cc
${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/duplicate/echo_duplicate.pb.h
${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.h
${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/echo.pb.cc
${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/echo.grpc.pb.cc
${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/echo.pb.h
${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/echo.grpc.pb.h
${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/echo_messages.pb.cc
${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/echo_messages.grpc.pb.cc
${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/echo_messages.pb.h
${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/echo_messages.grpc.pb.h
${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/simple_messages.pb.cc
${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/simple_messages.grpc.pb.cc
${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/simple_messages.pb.h
${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/simple_messages.grpc.pb.h
test/core/util/test_lb_policies.cc
test/cpp/end2end/rls_end2end_test.cc
test/cpp/end2end/test_service_impl.cc
third_party/googletest/googletest/src/gtest-all.cc
third_party/googletest/googlemock/src/gmock-all.cc
)
target_include_directories(rls_end2end_test
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/include
${_gRPC_ADDRESS_SORTING_INCLUDE_DIR}
${_gRPC_RE2_INCLUDE_DIR}
${_gRPC_SSL_INCLUDE_DIR}
${_gRPC_UPB_GENERATED_DIR}
${_gRPC_UPB_GRPC_GENERATED_DIR}
${_gRPC_UPB_INCLUDE_DIR}
${_gRPC_XXHASH_INCLUDE_DIR}
${_gRPC_ZLIB_INCLUDE_DIR}
third_party/googletest/googletest/include
third_party/googletest/googletest
third_party/googletest/googlemock/include
third_party/googletest/googlemock
${_gRPC_PROTO_GENS_DIR}
)
target_link_libraries(rls_end2end_test
${_gRPC_PROTOBUF_LIBRARIES}
${_gRPC_ALLTARGETS_LIBRARIES}
grpc++_test_config
grpc++_test_util
)
endif()
if(gRPC_BUILD_TESTS)
add_executable(rls_lb_config_parser_test
test/core/client_channel/rls_lb_config_parser_test.cc
third_party/googletest/googletest/src/gtest-all.cc
third_party/googletest/googlemock/src/gmock-all.cc
)
target_include_directories(rls_lb_config_parser_test
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/include
${_gRPC_ADDRESS_SORTING_INCLUDE_DIR}
${_gRPC_RE2_INCLUDE_DIR}
${_gRPC_SSL_INCLUDE_DIR}
${_gRPC_UPB_GENERATED_DIR}
${_gRPC_UPB_GRPC_GENERATED_DIR}
${_gRPC_UPB_INCLUDE_DIR}
${_gRPC_XXHASH_INCLUDE_DIR}
${_gRPC_ZLIB_INCLUDE_DIR}
third_party/googletest/googletest/include
third_party/googletest/googletest
third_party/googletest/googlemock/include
third_party/googletest/googlemock
${_gRPC_PROTO_GENS_DIR}
)
target_link_libraries(rls_lb_config_parser_test
${_gRPC_PROTOBUF_LIBRARIES}
${_gRPC_ALLTARGETS_LIBRARIES}
grpc_test_util
)
endif()
if(gRPC_BUILD_TESTS)
@ -16757,7 +16858,7 @@ generate_pkgconfig(
"gRPC"
"high performance general RPC framework"
"${gRPC_CORE_VERSION}"
"gpr openssl absl_base absl_bind_front absl_cord absl_core_headers absl_flat_hash_map absl_inlined_vector absl_memory absl_optional absl_status absl_statusor absl_str_format absl_strings absl_synchronization absl_time absl_utility absl_variant"
"gpr openssl absl_base absl_bind_front absl_cord absl_core_headers absl_flat_hash_map absl_hash absl_inlined_vector absl_memory absl_optional absl_status absl_statusor absl_str_format absl_strings absl_synchronization absl_time absl_utility absl_variant"
"-lgrpc -laddress_sorting -lre2 -lupb -lcares -lz"
""
"grpc.pc")
@ -16777,7 +16878,7 @@ generate_pkgconfig(
"gRPC++"
"C++ wrapper for gRPC"
"${gRPC_CPP_VERSION}"
"grpc absl_base absl_bind_front absl_cord absl_core_headers absl_flat_hash_map absl_inlined_vector absl_memory absl_optional absl_status absl_statusor absl_str_format absl_strings absl_synchronization absl_time absl_utility absl_variant"
"grpc absl_base absl_bind_front absl_cord absl_core_headers absl_flat_hash_map absl_hash absl_inlined_vector absl_memory absl_optional absl_status absl_statusor absl_str_format absl_strings absl_synchronization absl_time absl_utility absl_variant"
"-lgrpc++"
""
"grpc++.pc")

4
Makefile generated

@ -1071,6 +1071,7 @@ LIBGRPC_SRC = \
src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc \
src/core/ext/filters/client_channel/lb_policy/priority/priority.cc \
src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc \
src/core/ext/filters/client_channel/lb_policy/rls/rls.cc \
src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc \
src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc \
src/core/ext/filters/client_channel/lb_policy/xds/cds.cc \
@ -1231,6 +1232,7 @@ LIBGRPC_SRC = \
src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c \
src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c \
src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c \
src/core/ext/upb-generated/src/proto/grpc/lookup/v1/rls.upb.c \
src/core/ext/upb-generated/udpa/annotations/migrate.upb.c \
src/core/ext/upb-generated/udpa/annotations/security.upb.c \
src/core/ext/upb-generated/udpa/annotations/sensitive.upb.c \
@ -2700,6 +2702,7 @@ ifneq ($(OPENSSL_DEP),)
# installing headers to their final destination on the drive. We need this
# otherwise parallel compilation will fail if a source is compiled first.
src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc: $(OPENSSL_DEP)
src/core/ext/filters/client_channel/lb_policy/rls/rls.cc: $(OPENSSL_DEP)
src/core/ext/filters/client_channel/lb_policy/xds/cds.cc: $(OPENSSL_DEP)
src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_impl.cc: $(OPENSSL_DEP)
src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc: $(OPENSSL_DEP)
@ -2783,6 +2786,7 @@ src/core/ext/upb-generated/envoy/type/v3/semantic_version.upb.c: $(OPENSSL_DEP)
src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c: $(OPENSSL_DEP)
src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c: $(OPENSSL_DEP)
src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c: $(OPENSSL_DEP)
src/core/ext/upb-generated/src/proto/grpc/lookup/v1/rls.upb.c: $(OPENSSL_DEP)
src/core/ext/upb-generated/udpa/annotations/migrate.upb.c: $(OPENSSL_DEP)
src/core/ext/upb-generated/udpa/annotations/security.upb.c: $(OPENSSL_DEP)
src/core/ext/upb-generated/udpa/annotations/sensitive.upb.c: $(OPENSSL_DEP)

@ -599,6 +599,7 @@ libs:
- src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.h
- src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h
- src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h
- src/core/ext/upb-generated/src/proto/grpc/lookup/v1/rls.upb.h
- src/core/ext/upb-generated/udpa/annotations/migrate.upb.h
- src/core/ext/upb-generated/udpa/annotations/security.upb.h
- src/core/ext/upb-generated/udpa/annotations/sensitive.upb.h
@ -984,6 +985,7 @@ libs:
- src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc
- src/core/ext/filters/client_channel/lb_policy/priority/priority.cc
- src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc
- src/core/ext/filters/client_channel/lb_policy/rls/rls.cc
- src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc
- src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc
- src/core/ext/filters/client_channel/lb_policy/xds/cds.cc
@ -1144,6 +1146,7 @@ libs:
- src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c
- src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c
- src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c
- src/core/ext/upb-generated/src/proto/grpc/lookup/v1/rls.upb.c
- src/core/ext/upb-generated/udpa/annotations/migrate.upb.c
- src/core/ext/upb-generated/udpa/annotations/security.upb.c
- src/core/ext/upb-generated/udpa/annotations/sensitive.upb.c
@ -1527,6 +1530,7 @@ libs:
- absl/container:flat_hash_map
- absl/container:inlined_vector
- absl/functional:bind_front
- absl/hash:hash
- absl/status:statusor
- absl/types:variant
- absl/utility:utility
@ -7202,6 +7206,35 @@ targets:
deps:
- grpc_test_util
uses_polling: false
- name: rls_end2end_test
gtest: true
build: test
language: c++
headers:
- test/core/util/test_lb_policies.h
- test/cpp/end2end/counted_service.h
- test/cpp/end2end/test_service_impl.h
src:
- src/proto/grpc/lookup/v1/rls.proto
- src/proto/grpc/testing/duplicate/echo_duplicate.proto
- src/proto/grpc/testing/echo.proto
- src/proto/grpc/testing/echo_messages.proto
- src/proto/grpc/testing/simple_messages.proto
- test/core/util/test_lb_policies.cc
- test/cpp/end2end/rls_end2end_test.cc
- test/cpp/end2end/test_service_impl.cc
deps:
- grpc++_test_config
- grpc++_test_util
- name: rls_lb_config_parser_test
gtest: true
build: test
language: c++
headers: []
src:
- test/core/client_channel/rls_lb_config_parser_test.cc
deps:
- grpc_test_util
- name: sdk_authz_end2end_test
gtest: true
build: test

4
config.m4 generated

@ -66,6 +66,7 @@ if test "$PHP_GRPC" != "no"; then
src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc \
src/core/ext/filters/client_channel/lb_policy/priority/priority.cc \
src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc \
src/core/ext/filters/client_channel/lb_policy/rls/rls.cc \
src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc \
src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc \
src/core/ext/filters/client_channel/lb_policy/xds/cds.cc \
@ -238,6 +239,7 @@ if test "$PHP_GRPC" != "no"; then
src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c \
src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c \
src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c \
src/core/ext/upb-generated/src/proto/grpc/lookup/v1/rls.upb.c \
src/core/ext/upb-generated/udpa/annotations/migrate.upb.c \
src/core/ext/upb-generated/udpa/annotations/security.upb.c \
src/core/ext/upb-generated/udpa/annotations/sensitive.upb.c \
@ -1068,6 +1070,7 @@ if test "$PHP_GRPC" != "no"; then
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/client_channel/lb_policy/pick_first)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/client_channel/lb_policy/priority)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/client_channel/lb_policy/ring_hash)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/client_channel/lb_policy/rls)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/client_channel/lb_policy/round_robin)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/client_channel/lb_policy/weighted_target)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/client_channel/lb_policy/xds)
@ -1135,6 +1138,7 @@ if test "$PHP_GRPC" != "no"; then
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/upb-generated/src/proto/grpc/gcp)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/upb-generated/src/proto/grpc/health/v1)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/upb-generated/src/proto/grpc/lb/v1)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/upb-generated/src/proto/grpc/lookup/v1)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/upb-generated/udpa/annotations)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/upb-generated/validate)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/upb-generated/xds/annotations/v3)

5
config.w32 generated

@ -32,6 +32,7 @@ if (PHP_GRPC != "no") {
"src\\core\\ext\\filters\\client_channel\\lb_policy\\pick_first\\pick_first.cc " +
"src\\core\\ext\\filters\\client_channel\\lb_policy\\priority\\priority.cc " +
"src\\core\\ext\\filters\\client_channel\\lb_policy\\ring_hash\\ring_hash.cc " +
"src\\core\\ext\\filters\\client_channel\\lb_policy\\rls\\rls.cc " +
"src\\core\\ext\\filters\\client_channel\\lb_policy\\round_robin\\round_robin.cc " +
"src\\core\\ext\\filters\\client_channel\\lb_policy\\weighted_target\\weighted_target.cc " +
"src\\core\\ext\\filters\\client_channel\\lb_policy\\xds\\cds.cc " +
@ -204,6 +205,7 @@ if (PHP_GRPC != "no") {
"src\\core\\ext\\upb-generated\\src\\proto\\grpc\\gcp\\transport_security_common.upb.c " +
"src\\core\\ext\\upb-generated\\src\\proto\\grpc\\health\\v1\\health.upb.c " +
"src\\core\\ext\\upb-generated\\src\\proto\\grpc\\lb\\v1\\load_balancer.upb.c " +
"src\\core\\ext\\upb-generated\\src\\proto\\grpc\\lookup\\v1\\rls.upb.c " +
"src\\core\\ext\\upb-generated\\udpa\\annotations\\migrate.upb.c " +
"src\\core\\ext\\upb-generated\\udpa\\annotations\\security.upb.c " +
"src\\core\\ext\\upb-generated\\udpa\\annotations\\sensitive.upb.c " +
@ -1066,6 +1068,7 @@ if (PHP_GRPC != "no") {
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\client_channel\\lb_policy\\pick_first");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\client_channel\\lb_policy\\priority");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\client_channel\\lb_policy\\ring_hash");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\client_channel\\lb_policy\\rls");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\client_channel\\lb_policy\\round_robin");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\client_channel\\lb_policy\\weighted_target");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\client_channel\\lb_policy\\xds");
@ -1184,6 +1187,8 @@ if (PHP_GRPC != "no") {
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\src\\proto\\grpc\\health\\v1");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\src\\proto\\grpc\\lb");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\src\\proto\\grpc\\lb\\v1");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\src\\proto\\grpc\\lookup");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\src\\proto\\grpc\\lookup\\v1");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\udpa");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\udpa\\annotations");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upb-generated\\validate");

@ -76,6 +76,7 @@ some configuration as environment variables that can be set.
- priority_lb - traces priority LB policy
- resource_quota - trace resource quota objects internals
- ring_hash_lb - traces the ring hash load balancing policy
- rls_lb - traces the RLS load balancing policy
- round_robin - traces the round_robin load balancing policy
- queue_pluck
- sdk_authz - traces sdk authorization

3
gRPC-C++.podspec generated

@ -196,6 +196,7 @@ Pod::Spec.new do |s|
ss.dependency 'abseil/container/flat_hash_map', abseil_version
ss.dependency 'abseil/container/inlined_vector', abseil_version
ss.dependency 'abseil/functional/bind_front', abseil_version
ss.dependency 'abseil/hash/hash', abseil_version
ss.dependency 'abseil/memory/memory', abseil_version
ss.dependency 'abseil/status/status', abseil_version
ss.dependency 'abseil/status/statusor', abseil_version
@ -386,6 +387,7 @@ Pod::Spec.new do |s|
'src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.h',
'src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h',
'src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h',
'src/core/ext/upb-generated/src/proto/grpc/lookup/v1/rls.upb.h',
'src/core/ext/upb-generated/udpa/annotations/migrate.upb.h',
'src/core/ext/upb-generated/udpa/annotations/security.upb.h',
'src/core/ext/upb-generated/udpa/annotations/sensitive.upb.h',
@ -1057,6 +1059,7 @@ Pod::Spec.new do |s|
'src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.h',
'src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h',
'src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h',
'src/core/ext/upb-generated/src/proto/grpc/lookup/v1/rls.upb.h',
'src/core/ext/upb-generated/udpa/annotations/migrate.upb.h',
'src/core/ext/upb-generated/udpa/annotations/security.upb.h',
'src/core/ext/upb-generated/udpa/annotations/sensitive.upb.h',

5
gRPC-Core.podspec generated

@ -175,6 +175,7 @@ Pod::Spec.new do |s|
ss.dependency 'abseil/container/flat_hash_map', abseil_version
ss.dependency 'abseil/container/inlined_vector', abseil_version
ss.dependency 'abseil/functional/bind_front', abseil_version
ss.dependency 'abseil/hash/hash', abseil_version
ss.dependency 'abseil/memory/memory', abseil_version
ss.dependency 'abseil/status/status', abseil_version
ss.dependency 'abseil/status/statusor', abseil_version
@ -236,6 +237,7 @@ Pod::Spec.new do |s|
'src/core/ext/filters/client_channel/lb_policy/priority/priority.cc',
'src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc',
'src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.h',
'src/core/ext/filters/client_channel/lb_policy/rls/rls.cc',
'src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc',
'src/core/ext/filters/client_channel/lb_policy/subchannel_list.h',
'src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc',
@ -564,6 +566,8 @@ Pod::Spec.new do |s|
'src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h',
'src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c',
'src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h',
'src/core/ext/upb-generated/src/proto/grpc/lookup/v1/rls.upb.c',
'src/core/ext/upb-generated/src/proto/grpc/lookup/v1/rls.upb.h',
'src/core/ext/upb-generated/udpa/annotations/migrate.upb.c',
'src/core/ext/upb-generated/udpa/annotations/migrate.upb.h',
'src/core/ext/upb-generated/udpa/annotations/security.upb.c',
@ -1630,6 +1634,7 @@ Pod::Spec.new do |s|
'src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.h',
'src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h',
'src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h',
'src/core/ext/upb-generated/src/proto/grpc/lookup/v1/rls.upb.h',
'src/core/ext/upb-generated/udpa/annotations/migrate.upb.h',
'src/core/ext/upb-generated/udpa/annotations/security.upb.h',
'src/core/ext/upb-generated/udpa/annotations/sensitive.upb.h',

3
grpc.gemspec generated

@ -157,6 +157,7 @@ Gem::Specification.new do |s|
s.files += %w( src/core/ext/filters/client_channel/lb_policy/priority/priority.cc )
s.files += %w( src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc )
s.files += %w( src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.h )
s.files += %w( src/core/ext/filters/client_channel/lb_policy/rls/rls.cc )
s.files += %w( src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc )
s.files += %w( src/core/ext/filters/client_channel/lb_policy/subchannel_list.h )
s.files += %w( src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc )
@ -485,6 +486,8 @@ Gem::Specification.new do |s|
s.files += %w( src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h )
s.files += %w( src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c )
s.files += %w( src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h )
s.files += %w( src/core/ext/upb-generated/src/proto/grpc/lookup/v1/rls.upb.c )
s.files += %w( src/core/ext/upb-generated/src/proto/grpc/lookup/v1/rls.upb.h )
s.files += %w( src/core/ext/upb-generated/udpa/annotations/migrate.upb.c )
s.files += %w( src/core/ext/upb-generated/udpa/annotations/migrate.upb.h )
s.files += %w( src/core/ext/upb-generated/udpa/annotations/security.upb.c )

3
grpc.gyp generated

@ -478,6 +478,7 @@
'absl/container:flat_hash_map',
'absl/container:inlined_vector',
'absl/functional:bind_front',
'absl/hash:hash',
'absl/status:statusor',
'absl/types:variant',
'absl/utility:utility',
@ -511,6 +512,7 @@
'src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc',
'src/core/ext/filters/client_channel/lb_policy/priority/priority.cc',
'src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc',
'src/core/ext/filters/client_channel/lb_policy/rls/rls.cc',
'src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc',
'src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc',
'src/core/ext/filters/client_channel/lb_policy/xds/cds.cc',
@ -671,6 +673,7 @@
'src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c',
'src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c',
'src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c',
'src/core/ext/upb-generated/src/proto/grpc/lookup/v1/rls.upb.c',
'src/core/ext/upb-generated/udpa/annotations/migrate.upb.c',
'src/core/ext/upb-generated/udpa/annotations/security.upb.c',
'src/core/ext/upb-generated/udpa/annotations/sensitive.upb.c',

3
package.xml generated

@ -137,6 +137,7 @@
<file baseinstalldir="/" name="src/core/ext/filters/client_channel/lb_policy/priority/priority.cc" role="src" />
<file baseinstalldir="/" name="src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc" role="src" />
<file baseinstalldir="/" name="src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.h" role="src" />
<file baseinstalldir="/" name="src/core/ext/filters/client_channel/lb_policy/rls/rls.cc" role="src" />
<file baseinstalldir="/" name="src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc" role="src" />
<file baseinstalldir="/" name="src/core/ext/filters/client_channel/lb_policy/subchannel_list.h" role="src" />
<file baseinstalldir="/" name="src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc" role="src" />
@ -465,6 +466,8 @@
<file baseinstalldir="/" name="src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h" role="src" />
<file baseinstalldir="/" name="src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c" role="src" />
<file baseinstalldir="/" name="src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h" role="src" />
<file baseinstalldir="/" name="src/core/ext/upb-generated/src/proto/grpc/lookup/v1/rls.upb.c" role="src" />
<file baseinstalldir="/" name="src/core/ext/upb-generated/src/proto/grpc/lookup/v1/rls.upb.h" role="src" />
<file baseinstalldir="/" name="src/core/ext/upb-generated/udpa/annotations/migrate.upb.c" role="src" />
<file baseinstalldir="/" name="src/core/ext/upb-generated/udpa/annotations/migrate.upb.h" role="src" />
<file baseinstalldir="/" name="src/core/ext/upb-generated/udpa/annotations/security.upb.c" role="src" />

@ -263,6 +263,11 @@ class LoadBalancingPolicy : public InternallyRefCounted<LoadBalancingPolicy> {
/// A proxy object implemented by the client channel and used by the
/// LB policy to communicate with the channel.
// TODO(roth): Once insecure builds go away, add methods for accessing
// channel creds. By default, that should strip off the call creds
// attached to the channel creds, but there should also be a "use at
// your own risk" option to get the channel creds without stripping
// off the attached call creds.
class ChannelControlHelper {
public:
ChannelControlHelper() = default;

File diff suppressed because it is too large Load Diff

@ -445,7 +445,13 @@ void AresDnsResolver::StartResolvingLocked() {
class AresDnsResolverFactory : public ResolverFactory {
public:
bool IsValidUri(const URI& /*uri*/) const override { return true; }
bool IsValidUri(const URI& uri) const override {
if (absl::StripPrefix(uri.path(), "/").empty()) {
gpr_log(GPR_ERROR, "no server name supplied in dns URI");
return false;
}
return true;
}
OrphanablePtr<Resolver> CreateResolver(ResolverArgs args) const override {
return MakeOrphanable<AresDnsResolver>(std::move(args));

@ -291,6 +291,10 @@ class NativeDnsResolverFactory : public ResolverFactory {
gpr_log(GPR_ERROR, "authority based dns uri's not supported");
return false;
}
if (absl::StripPrefix(uri.path(), "/").empty()) {
gpr_log(GPR_ERROR, "no server name supplied in dns URI");
return false;
}
return true;
}

@ -100,7 +100,7 @@ ClientChannelServiceConfigParser::ParseGlobalParams(
grpc_error_handle parse_error = GRPC_ERROR_NONE;
parsed_lb_config = LoadBalancingPolicyRegistry::ParseLoadBalancingConfig(
it->second, &parse_error);
if (parsed_lb_config == nullptr) {
if (parse_error != GRPC_ERROR_NONE) {
std::vector<grpc_error_handle> lb_errors;
lb_errors.push_back(parse_error);
error_list.push_back(GRPC_ERROR_CREATE_FROM_VECTOR(

@ -0,0 +1,55 @@
/* This file was generated by upbc (the upb compiler) from the input
* file:
*
* src/proto/grpc/lookup/v1/rls.proto
*
* Do not edit -- your changes will be discarded when the file is
* regenerated. */
#include <stddef.h>
#include "upb/msg_internal.h"
#include "src/proto/grpc/lookup/v1/rls.upb.h"
#include "upb/port_def.inc"
static const upb_msglayout *const grpc_lookup_v1_RouteLookupRequest_submsgs[1] = {
&grpc_lookup_v1_RouteLookupRequest_KeyMapEntry_msginit,
};
static const upb_msglayout_field grpc_lookup_v1_RouteLookupRequest__fields[4] = {
{3, UPB_SIZE(4, 8), 0, 0, 9, _UPB_MODE_SCALAR},
{4, UPB_SIZE(20, 40), 0, 0, 11, _UPB_MODE_MAP},
{5, UPB_SIZE(0, 0), 0, 0, 14, _UPB_MODE_SCALAR},
{6, UPB_SIZE(12, 24), 0, 0, 9, _UPB_MODE_SCALAR},
};
const upb_msglayout grpc_lookup_v1_RouteLookupRequest_msginit = {
&grpc_lookup_v1_RouteLookupRequest_submsgs[0],
&grpc_lookup_v1_RouteLookupRequest__fields[0],
UPB_SIZE(24, 48), 4, false, 0, 255,
};
static const upb_msglayout_field grpc_lookup_v1_RouteLookupRequest_KeyMapEntry__fields[2] = {
{1, UPB_SIZE(0, 0), 0, 0, 9, _UPB_MODE_SCALAR},
{2, UPB_SIZE(8, 16), 0, 0, 9, _UPB_MODE_SCALAR},
};
const upb_msglayout grpc_lookup_v1_RouteLookupRequest_KeyMapEntry_msginit = {
NULL,
&grpc_lookup_v1_RouteLookupRequest_KeyMapEntry__fields[0],
UPB_SIZE(16, 32), 2, false, 2, 255,
};
static const upb_msglayout_field grpc_lookup_v1_RouteLookupResponse__fields[2] = {
{2, UPB_SIZE(0, 0), 0, 0, 9, _UPB_MODE_SCALAR},
{3, UPB_SIZE(8, 16), 0, 0, 9, _UPB_MODE_ARRAY},
};
const upb_msglayout grpc_lookup_v1_RouteLookupResponse_msginit = {
NULL,
&grpc_lookup_v1_RouteLookupResponse__fields[0],
UPB_SIZE(16, 32), 2, false, 0, 255,
};
#include "upb/port_undef.inc"

@ -0,0 +1,154 @@
/* This file was generated by upbc (the upb compiler) from the input
* file:
*
* src/proto/grpc/lookup/v1/rls.proto
*
* Do not edit -- your changes will be discarded when the file is
* regenerated. */
#ifndef SRC_PROTO_GRPC_LOOKUP_V1_RLS_PROTO_UPB_H_
#define SRC_PROTO_GRPC_LOOKUP_V1_RLS_PROTO_UPB_H_
#include "upb/msg_internal.h"
#include "upb/decode.h"
#include "upb/decode_fast.h"
#include "upb/encode.h"
#include "upb/port_def.inc"
#ifdef __cplusplus
extern "C" {
#endif
struct grpc_lookup_v1_RouteLookupRequest;
struct grpc_lookup_v1_RouteLookupRequest_KeyMapEntry;
struct grpc_lookup_v1_RouteLookupResponse;
typedef struct grpc_lookup_v1_RouteLookupRequest grpc_lookup_v1_RouteLookupRequest;
typedef struct grpc_lookup_v1_RouteLookupRequest_KeyMapEntry grpc_lookup_v1_RouteLookupRequest_KeyMapEntry;
typedef struct grpc_lookup_v1_RouteLookupResponse grpc_lookup_v1_RouteLookupResponse;
extern const upb_msglayout grpc_lookup_v1_RouteLookupRequest_msginit;
extern const upb_msglayout grpc_lookup_v1_RouteLookupRequest_KeyMapEntry_msginit;
extern const upb_msglayout grpc_lookup_v1_RouteLookupResponse_msginit;
typedef enum {
grpc_lookup_v1_RouteLookupRequest_REASON_UNKNOWN = 0,
grpc_lookup_v1_RouteLookupRequest_REASON_MISS = 1,
grpc_lookup_v1_RouteLookupRequest_REASON_STALE = 2
} grpc_lookup_v1_RouteLookupRequest_Reason;
/* grpc.lookup.v1.RouteLookupRequest */
UPB_INLINE grpc_lookup_v1_RouteLookupRequest *grpc_lookup_v1_RouteLookupRequest_new(upb_arena *arena) {
return (grpc_lookup_v1_RouteLookupRequest *)_upb_msg_new(&grpc_lookup_v1_RouteLookupRequest_msginit, arena);
}
UPB_INLINE grpc_lookup_v1_RouteLookupRequest *grpc_lookup_v1_RouteLookupRequest_parse(const char *buf, size_t size,
upb_arena *arena) {
grpc_lookup_v1_RouteLookupRequest *ret = grpc_lookup_v1_RouteLookupRequest_new(arena);
if (!ret) return NULL;
if (!upb_decode(buf, size, ret, &grpc_lookup_v1_RouteLookupRequest_msginit, arena)) return NULL;
return ret;
}
UPB_INLINE grpc_lookup_v1_RouteLookupRequest *grpc_lookup_v1_RouteLookupRequest_parse_ex(const char *buf, size_t size,
const upb_extreg *extreg, int options,
upb_arena *arena) {
grpc_lookup_v1_RouteLookupRequest *ret = grpc_lookup_v1_RouteLookupRequest_new(arena);
if (!ret) return NULL;
if (!_upb_decode(buf, size, ret, &grpc_lookup_v1_RouteLookupRequest_msginit, extreg, options, arena)) {
return NULL;
}
return ret;
}
UPB_INLINE char *grpc_lookup_v1_RouteLookupRequest_serialize(const grpc_lookup_v1_RouteLookupRequest *msg, upb_arena *arena, size_t *len) {
return upb_encode(msg, &grpc_lookup_v1_RouteLookupRequest_msginit, arena, len);
}
UPB_INLINE upb_strview grpc_lookup_v1_RouteLookupRequest_target_type(const grpc_lookup_v1_RouteLookupRequest *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(4, 8), upb_strview); }
UPB_INLINE bool grpc_lookup_v1_RouteLookupRequest_has_key_map(const grpc_lookup_v1_RouteLookupRequest *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(20, 40)); }
UPB_INLINE size_t grpc_lookup_v1_RouteLookupRequest_key_map_size(const grpc_lookup_v1_RouteLookupRequest *msg) {return _upb_msg_map_size(msg, UPB_SIZE(20, 40)); }
UPB_INLINE bool grpc_lookup_v1_RouteLookupRequest_key_map_get(const grpc_lookup_v1_RouteLookupRequest *msg, upb_strview key, upb_strview *val) { return _upb_msg_map_get(msg, UPB_SIZE(20, 40), &key, 0, val, 0); }
UPB_INLINE const grpc_lookup_v1_RouteLookupRequest_KeyMapEntry* grpc_lookup_v1_RouteLookupRequest_key_map_next(const grpc_lookup_v1_RouteLookupRequest *msg, size_t* iter) { return (const grpc_lookup_v1_RouteLookupRequest_KeyMapEntry*)_upb_msg_map_next(msg, UPB_SIZE(20, 40), iter); }
UPB_INLINE int32_t grpc_lookup_v1_RouteLookupRequest_reason(const grpc_lookup_v1_RouteLookupRequest *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(0, 0), int32_t); }
UPB_INLINE upb_strview grpc_lookup_v1_RouteLookupRequest_stale_header_data(const grpc_lookup_v1_RouteLookupRequest *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(12, 24), upb_strview); }
UPB_INLINE void grpc_lookup_v1_RouteLookupRequest_set_target_type(grpc_lookup_v1_RouteLookupRequest *msg, upb_strview value) {
*UPB_PTR_AT(msg, UPB_SIZE(4, 8), upb_strview) = value;
}
UPB_INLINE void grpc_lookup_v1_RouteLookupRequest_key_map_clear(grpc_lookup_v1_RouteLookupRequest *msg) { _upb_msg_map_clear(msg, UPB_SIZE(20, 40)); }
UPB_INLINE bool grpc_lookup_v1_RouteLookupRequest_key_map_set(grpc_lookup_v1_RouteLookupRequest *msg, upb_strview key, upb_strview val, upb_arena *a) { return _upb_msg_map_set(msg, UPB_SIZE(20, 40), &key, 0, &val, 0, a); }
UPB_INLINE bool grpc_lookup_v1_RouteLookupRequest_key_map_delete(grpc_lookup_v1_RouteLookupRequest *msg, upb_strview key) { return _upb_msg_map_delete(msg, UPB_SIZE(20, 40), &key, 0); }
UPB_INLINE grpc_lookup_v1_RouteLookupRequest_KeyMapEntry* grpc_lookup_v1_RouteLookupRequest_key_map_nextmutable(grpc_lookup_v1_RouteLookupRequest *msg, size_t* iter) { return (grpc_lookup_v1_RouteLookupRequest_KeyMapEntry*)_upb_msg_map_next(msg, UPB_SIZE(20, 40), iter); }
UPB_INLINE void grpc_lookup_v1_RouteLookupRequest_set_reason(grpc_lookup_v1_RouteLookupRequest *msg, int32_t value) {
*UPB_PTR_AT(msg, UPB_SIZE(0, 0), int32_t) = value;
}
UPB_INLINE void grpc_lookup_v1_RouteLookupRequest_set_stale_header_data(grpc_lookup_v1_RouteLookupRequest *msg, upb_strview value) {
*UPB_PTR_AT(msg, UPB_SIZE(12, 24), upb_strview) = value;
}
/* grpc.lookup.v1.RouteLookupRequest.KeyMapEntry */
UPB_INLINE upb_strview grpc_lookup_v1_RouteLookupRequest_KeyMapEntry_key(const grpc_lookup_v1_RouteLookupRequest_KeyMapEntry *msg) {
upb_strview ret;
_upb_msg_map_key(msg, &ret, 0);
return ret;
}
UPB_INLINE upb_strview grpc_lookup_v1_RouteLookupRequest_KeyMapEntry_value(const grpc_lookup_v1_RouteLookupRequest_KeyMapEntry *msg) {
upb_strview ret;
_upb_msg_map_value(msg, &ret, 0);
return ret;
}
UPB_INLINE void grpc_lookup_v1_RouteLookupRequest_KeyMapEntry_set_value(grpc_lookup_v1_RouteLookupRequest_KeyMapEntry *msg, upb_strview value) {
_upb_msg_map_set_value(msg, &value, 0);
}
/* grpc.lookup.v1.RouteLookupResponse */
UPB_INLINE grpc_lookup_v1_RouteLookupResponse *grpc_lookup_v1_RouteLookupResponse_new(upb_arena *arena) {
return (grpc_lookup_v1_RouteLookupResponse *)_upb_msg_new(&grpc_lookup_v1_RouteLookupResponse_msginit, arena);
}
UPB_INLINE grpc_lookup_v1_RouteLookupResponse *grpc_lookup_v1_RouteLookupResponse_parse(const char *buf, size_t size,
upb_arena *arena) {
grpc_lookup_v1_RouteLookupResponse *ret = grpc_lookup_v1_RouteLookupResponse_new(arena);
if (!ret) return NULL;
if (!upb_decode(buf, size, ret, &grpc_lookup_v1_RouteLookupResponse_msginit, arena)) return NULL;
return ret;
}
UPB_INLINE grpc_lookup_v1_RouteLookupResponse *grpc_lookup_v1_RouteLookupResponse_parse_ex(const char *buf, size_t size,
const upb_extreg *extreg, int options,
upb_arena *arena) {
grpc_lookup_v1_RouteLookupResponse *ret = grpc_lookup_v1_RouteLookupResponse_new(arena);
if (!ret) return NULL;
if (!_upb_decode(buf, size, ret, &grpc_lookup_v1_RouteLookupResponse_msginit, extreg, options, arena)) {
return NULL;
}
return ret;
}
UPB_INLINE char *grpc_lookup_v1_RouteLookupResponse_serialize(const grpc_lookup_v1_RouteLookupResponse *msg, upb_arena *arena, size_t *len) {
return upb_encode(msg, &grpc_lookup_v1_RouteLookupResponse_msginit, arena, len);
}
UPB_INLINE upb_strview grpc_lookup_v1_RouteLookupResponse_header_data(const grpc_lookup_v1_RouteLookupResponse *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(0, 0), upb_strview); }
UPB_INLINE upb_strview const* grpc_lookup_v1_RouteLookupResponse_targets(const grpc_lookup_v1_RouteLookupResponse *msg, size_t *len) { return (upb_strview const*)_upb_array_accessor(msg, UPB_SIZE(8, 16), len); }
UPB_INLINE void grpc_lookup_v1_RouteLookupResponse_set_header_data(grpc_lookup_v1_RouteLookupResponse *msg, upb_strview value) {
*UPB_PTR_AT(msg, UPB_SIZE(0, 0), upb_strview) = value;
}
UPB_INLINE upb_strview* grpc_lookup_v1_RouteLookupResponse_mutable_targets(grpc_lookup_v1_RouteLookupResponse *msg, size_t *len) {
return (upb_strview*)_upb_array_mutable_accessor(msg, UPB_SIZE(8, 16), len);
}
UPB_INLINE upb_strview* grpc_lookup_v1_RouteLookupResponse_resize_targets(grpc_lookup_v1_RouteLookupResponse *msg, size_t len, upb_arena *arena) {
return (upb_strview*)_upb_array_resize_accessor2(msg, UPB_SIZE(8, 16), len, UPB_SIZE(3, 4), arena);
}
UPB_INLINE bool grpc_lookup_v1_RouteLookupResponse_add_targets(grpc_lookup_v1_RouteLookupResponse *msg, upb_strview val, upb_arena *arena) {
return _upb_array_append_accessor2(msg, UPB_SIZE(8, 16), UPB_SIZE(3, 4), &val,
arena);
}
#ifdef __cplusplus
} /* extern "C" */
#endif
#include "upb/port_undef.inc"
#endif /* SRC_PROTO_GRPC_LOOKUP_V1_RLS_PROTO_UPB_H_ */

@ -0,0 +1,63 @@
/* This file was generated by upbc (the upb compiler) from the input
* file:
*
* src/proto/grpc/lookup/v1/rls.proto
*
* Do not edit -- your changes will be discarded when the file is
* regenerated. */
#include "upb/def.h"
#include "src/proto/grpc/lookup/v1/rls.upbdefs.h"
extern const upb_msglayout grpc_lookup_v1_RouteLookupRequest_msginit;
extern const upb_msglayout grpc_lookup_v1_RouteLookupRequest_KeyMapEntry_msginit;
extern const upb_msglayout grpc_lookup_v1_RouteLookupResponse_msginit;
static const upb_msglayout *layouts[3] = {
&grpc_lookup_v1_RouteLookupRequest_msginit,
&grpc_lookup_v1_RouteLookupRequest_KeyMapEntry_msginit,
&grpc_lookup_v1_RouteLookupResponse_msginit,
};
static const char descriptor[737] = {'\n', '\"', 's', 'r', 'c', '/', 'p', 'r', 'o', 't', 'o', '/', 'g', 'r', 'p', 'c', '/', 'l', 'o', 'o', 'k', 'u', 'p', '/', 'v',
'1', '/', 'r', 'l', 's', '.', 'p', 'r', 'o', 't', 'o', '\022', '\016', 'g', 'r', 'p', 'c', '.', 'l', 'o', 'o', 'k', 'u', 'p', '.',
'v', '1', '\"', '\203', '\003', '\n', '\022', 'R', 'o', 'u', 't', 'e', 'L', 'o', 'o', 'k', 'u', 'p', 'R', 'e', 'q', 'u', 'e', 's', 't',
'\022', '\037', '\n', '\013', 't', 'a', 'r', 'g', 'e', 't', '_', 't', 'y', 'p', 'e', '\030', '\003', ' ', '\001', '(', '\t', 'R', '\n', 't', 'a',
'r', 'g', 'e', 't', 'T', 'y', 'p', 'e', '\022', 'A', '\n', '\006', 'r', 'e', 'a', 's', 'o', 'n', '\030', '\005', ' ', '\001', '(', '\016', '2',
')', '.', 'g', 'r', 'p', 'c', '.', 'l', 'o', 'o', 'k', 'u', 'p', '.', 'v', '1', '.', 'R', 'o', 'u', 't', 'e', 'L', 'o', 'o',
'k', 'u', 'p', 'R', 'e', 'q', 'u', 'e', 's', 't', '.', 'R', 'e', 'a', 's', 'o', 'n', 'R', '\006', 'r', 'e', 'a', 's', 'o', 'n',
'\022', '*', '\n', '\021', 's', 't', 'a', 'l', 'e', '_', 'h', 'e', 'a', 'd', 'e', 'r', '_', 'd', 'a', 't', 'a', '\030', '\006', ' ', '\001',
'(', '\t', 'R', '\017', 's', 't', 'a', 'l', 'e', 'H', 'e', 'a', 'd', 'e', 'r', 'D', 'a', 't', 'a', '\022', 'G', '\n', '\007', 'k', 'e',
'y', '_', 'm', 'a', 'p', '\030', '\004', ' ', '\003', '(', '\013', '2', '.', '.', 'g', 'r', 'p', 'c', '.', 'l', 'o', 'o', 'k', 'u', 'p',
'.', 'v', '1', '.', 'R', 'o', 'u', 't', 'e', 'L', 'o', 'o', 'k', 'u', 'p', 'R', 'e', 'q', 'u', 'e', 's', 't', '.', 'K', 'e',
'y', 'M', 'a', 'p', 'E', 'n', 't', 'r', 'y', 'R', '\006', 'k', 'e', 'y', 'M', 'a', 'p', '\032', '9', '\n', '\013', 'K', 'e', 'y', 'M',
'a', 'p', 'E', 'n', 't', 'r', 'y', '\022', '\020', '\n', '\003', 'k', 'e', 'y', '\030', '\001', ' ', '\001', '(', '\t', 'R', '\003', 'k', 'e', 'y',
'\022', '\024', '\n', '\005', 'v', 'a', 'l', 'u', 'e', '\030', '\002', ' ', '\001', '(', '\t', 'R', '\005', 'v', 'a', 'l', 'u', 'e', ':', '\002', '8',
'\001', '\"', '?', '\n', '\006', 'R', 'e', 'a', 's', 'o', 'n', '\022', '\022', '\n', '\016', 'R', 'E', 'A', 'S', 'O', 'N', '_', 'U', 'N', 'K',
'N', 'O', 'W', 'N', '\020', '\000', '\022', '\017', '\n', '\013', 'R', 'E', 'A', 'S', 'O', 'N', '_', 'M', 'I', 'S', 'S', '\020', '\001', '\022', '\020',
'\n', '\014', 'R', 'E', 'A', 'S', 'O', 'N', '_', 'S', 'T', 'A', 'L', 'E', '\020', '\002', 'J', '\004', '\010', '\001', '\020', '\002', 'J', '\004', '\010',
'\002', '\020', '\003', 'R', '\006', 's', 'e', 'r', 'v', 'e', 'r', 'R', '\004', 'p', 'a', 't', 'h', '\"', '^', '\n', '\023', 'R', 'o', 'u', 't',
'e', 'L', 'o', 'o', 'k', 'u', 'p', 'R', 'e', 's', 'p', 'o', 'n', 's', 'e', '\022', '\030', '\n', '\007', 't', 'a', 'r', 'g', 'e', 't',
's', '\030', '\003', ' ', '\003', '(', '\t', 'R', '\007', 't', 'a', 'r', 'g', 'e', 't', 's', '\022', '\037', '\n', '\013', 'h', 'e', 'a', 'd', 'e',
'r', '_', 'd', 'a', 't', 'a', '\030', '\002', ' ', '\001', '(', '\t', 'R', '\n', 'h', 'e', 'a', 'd', 'e', 'r', 'D', 'a', 't', 'a', 'J',
'\004', '\010', '\001', '\020', '\002', 'R', '\006', 't', 'a', 'r', 'g', 'e', 't', '2', 'n', '\n', '\022', 'R', 'o', 'u', 't', 'e', 'L', 'o', 'o',
'k', 'u', 'p', 'S', 'e', 'r', 'v', 'i', 'c', 'e', '\022', 'X', '\n', '\013', 'R', 'o', 'u', 't', 'e', 'L', 'o', 'o', 'k', 'u', 'p',
'\022', '\"', '.', 'g', 'r', 'p', 'c', '.', 'l', 'o', 'o', 'k', 'u', 'p', '.', 'v', '1', '.', 'R', 'o', 'u', 't', 'e', 'L', 'o',
'o', 'k', 'u', 'p', 'R', 'e', 'q', 'u', 'e', 's', 't', '\032', '#', '.', 'g', 'r', 'p', 'c', '.', 'l', 'o', 'o', 'k', 'u', 'p',
'.', 'v', '1', '.', 'R', 'o', 'u', 't', 'e', 'L', 'o', 'o', 'k', 'u', 'p', 'R', 'e', 's', 'p', 'o', 'n', 's', 'e', '\"', '\000',
'B', 'M', '\n', '\021', 'i', 'o', '.', 'g', 'r', 'p', 'c', '.', 'l', 'o', 'o', 'k', 'u', 'p', '.', 'v', '1', 'B', '\010', 'R', 'l',
's', 'P', 'r', 'o', 't', 'o', 'P', '\001', 'Z', ',', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'g', 'o', 'l', 'a', 'n', 'g', '.', 'o',
'r', 'g', '/', 'g', 'r', 'p', 'c', '/', 'l', 'o', 'o', 'k', 'u', 'p', '/', 'g', 'r', 'p', 'c', '_', 'l', 'o', 'o', 'k', 'u',
'p', '_', 'v', '1', 'b', '\006', 'p', 'r', 'o', 't', 'o', '3',
};
static upb_def_init *deps[1] = {
NULL
};
upb_def_init src_proto_grpc_lookup_v1_rls_proto_upbdefinit = {
deps,
layouts,
"src/proto/grpc/lookup/v1/rls.proto",
UPB_STRVIEW_INIT(descriptor, 737)
};

@ -0,0 +1,45 @@
/* This file was generated by upbc (the upb compiler) from the input
* file:
*
* src/proto/grpc/lookup/v1/rls.proto
*
* Do not edit -- your changes will be discarded when the file is
* regenerated. */
#ifndef SRC_PROTO_GRPC_LOOKUP_V1_RLS_PROTO_UPBDEFS_H_
#define SRC_PROTO_GRPC_LOOKUP_V1_RLS_PROTO_UPBDEFS_H_
#include "upb/def.h"
#include "upb/port_def.inc"
#ifdef __cplusplus
extern "C" {
#endif
#include "upb/def.h"
#include "upb/port_def.inc"
extern upb_def_init src_proto_grpc_lookup_v1_rls_proto_upbdefinit;
UPB_INLINE const upb_msgdef *grpc_lookup_v1_RouteLookupRequest_getmsgdef(upb_symtab *s) {
_upb_symtab_loaddefinit(s, &src_proto_grpc_lookup_v1_rls_proto_upbdefinit);
return upb_symtab_lookupmsg(s, "grpc.lookup.v1.RouteLookupRequest");
}
UPB_INLINE const upb_msgdef *grpc_lookup_v1_RouteLookupRequest_KeyMapEntry_getmsgdef(upb_symtab *s) {
_upb_symtab_loaddefinit(s, &src_proto_grpc_lookup_v1_rls_proto_upbdefinit);
return upb_symtab_lookupmsg(s, "grpc.lookup.v1.RouteLookupRequest.KeyMapEntry");
}
UPB_INLINE const upb_msgdef *grpc_lookup_v1_RouteLookupResponse_getmsgdef(upb_symtab *s) {
_upb_symtab_loaddefinit(s, &src_proto_grpc_lookup_v1_rls_proto_upbdefinit);
return upb_symtab_lookupmsg(s, "grpc.lookup.v1.RouteLookupResponse");
}
#ifdef __cplusplus
} /* extern "C" */
#endif
#include "upb/port_undef.inc"
#endif /* SRC_PROTO_GRPC_LOOKUP_V1_RLS_PROTO_UPBDEFS_H_ */

@ -75,10 +75,10 @@ inline bool ExtractJsonBool(const Json& json, const std::string& field_name,
}
}
template <typename ErrorVectorType>
// OutputType can be std::string or absl::string_view.
template <typename OutputType, typename ErrorVectorType>
inline bool ExtractJsonString(const Json& json, const std::string& field_name,
std::string* output,
ErrorVectorType* error_list) {
OutputType* output, ErrorVectorType* error_list) {
if (json.type() != Json::Type::STRING) {
*output = "";
error_list->push_back(GRPC_ERROR_CREATE_FROM_CPP_STRING(
@ -135,6 +135,13 @@ inline bool ExtractJsonType(const Json& json, const std::string& field_name,
return ExtractJsonString(json, field_name, output, error_list);
}
template <typename ErrorVectorType>
inline bool ExtractJsonType(const Json& json, const std::string& field_name,
absl::string_view* output,
ErrorVectorType* error_list) {
return ExtractJsonString(json, field_name, output, error_list);
}
template <typename ErrorVectorType>
inline bool ExtractJsonType(const Json& json, const std::string& field_name,
const Json::Array** output,

@ -137,6 +137,11 @@ struct grpc_channel_credentials
const char* type_;
};
// TODO(roth): Once we eliminate insecure builds, find a better way to
// plumb credentials so that it doesn't need to flow through channel
// args. For example, we'll want to expose it to LB policies by adding
// methods on the helper API.
/* Util to encapsulate the channel credentials in a channel arg. */
grpc_arg grpc_channel_credentials_to_arg(grpc_channel_credentials* credentials);

@ -54,6 +54,8 @@ void FaultInjectionFilterInit(void);
void FaultInjectionFilterShutdown(void);
void GrpcLbPolicyRingHashInit(void);
void GrpcLbPolicyRingHashShutdown(void);
void RlsLbPluginInit();
void RlsLbPluginShutdown();
void ServiceConfigParserInit(void);
void ServiceConfigParserShutdown(void);
} // namespace grpc_core
@ -94,6 +96,8 @@ void grpc_register_built_in_plugins(void) {
grpc_register_plugin(grpc_resolver_fake_init, grpc_resolver_fake_shutdown);
grpc_register_plugin(grpc_lb_policy_grpclb_init,
grpc_lb_policy_grpclb_shutdown);
grpc_register_plugin(grpc_core::RlsLbPluginInit,
grpc_core::RlsLbPluginShutdown);
grpc_register_plugin(grpc_lb_policy_priority_init,
grpc_lb_policy_priority_shutdown);
grpc_register_plugin(grpc_lb_policy_weighted_target_init,

@ -0,0 +1,28 @@
# Copyright 2020 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
licenses(["notice"])
load("//bazel:grpc_build_system.bzl", "grpc_package", "grpc_proto_library")
grpc_package(
name = "src/proto/grpc/lookup/v1",
visibility = "public",
)
grpc_proto_library(
name = "rls_proto",
srcs = ["rls.proto"],
well_known_protos = True,
)

@ -0,0 +1,62 @@
// Copyright 2020 The gRPC Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package grpc.lookup.v1;
option go_package = "google.golang.org/grpc/lookup/grpc_lookup_v1";
option java_multiple_files = true;
option java_package = "io.grpc.lookup.v1";
option java_outer_classname = "RlsProto";
message RouteLookupRequest {
// Target type allows the client to specify what kind of target format it
// would like from RLS to allow it to find the regional server, e.g. "grpc".
string target_type = 3;
// Possible reasons for making a request.
enum Reason {
REASON_UNKNOWN = 0; // Unused
REASON_MISS = 1; // No data available in local cache
REASON_STALE = 2; // Data in local cache is stale
}
// Reason for making this request.
Reason reason = 5;
// For REASON_STALE, the header_data from the stale response, if any.
string stale_header_data = 6;
// Map of key values extracted via key builders for the gRPC or HTTP request.
map<string, string> key_map = 4;
reserved 1, 2;
reserved "server", "path";
}
message RouteLookupResponse {
// Prioritized list (best one first) of addressable entities to use
// for routing, using syntax requested by the request target_type.
// The targets will be tried in order until a healthy one is found.
repeated string targets = 3;
// Optional header value to pass along to AFE in the X-Google-RLS-Data header.
// Cached with "target" and sent with all requests that match the request key.
// Allows the RLS to pass its work product to the eventual target.
string header_data = 2;
reserved 1;
reserved "target";
}
service RouteLookupService {
// Lookup returns a target for a single key.
rpc RouteLookup(RouteLookupRequest) returns (RouteLookupResponse) {}
}

@ -41,6 +41,7 @@ CORE_SOURCE_FILES = [
'src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc',
'src/core/ext/filters/client_channel/lb_policy/priority/priority.cc',
'src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc',
'src/core/ext/filters/client_channel/lb_policy/rls/rls.cc',
'src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc',
'src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc',
'src/core/ext/filters/client_channel/lb_policy/xds/cds.cc',
@ -213,6 +214,7 @@ CORE_SOURCE_FILES = [
'src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c',
'src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c',
'src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c',
'src/core/ext/upb-generated/src/proto/grpc/lookup/v1/rls.upb.c',
'src/core/ext/upb-generated/udpa/annotations/migrate.upb.c',
'src/core/ext/upb-generated/udpa/annotations/security.upb.c',
'src/core/ext/upb-generated/udpa/annotations/sensitive.upb.c',

@ -58,3 +58,16 @@ grpc_cc_test(
"//test/core/util:grpc_test_util",
],
)
grpc_cc_test(
name = "rls_lb_config_parser_test",
srcs = ["rls_lb_config_parser_test.cc"],
external_deps = [
"gtest",
],
language = "C++",
deps = [
"//:grpc",
"//test/core/util:grpc_test_util",
],
)

@ -0,0 +1,550 @@
//
// Copyright 2021 gRPC authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include <grpc/grpc.h>
#include "src/core/ext/service_config/service_config.h"
#include "src/core/lib/gpr/env.h"
#include "test/core/util/test_config.h"
// A regular expression to enter referenced or child errors.
#ifdef GRPC_ERROR_IS_ABSEIL_STATUS
#define CHILD_ERROR_TAG ".*children.*"
#else
#define CHILD_ERROR_TAG ".*referenced_errors.*"
#endif
namespace grpc_core {
namespace {
class RlsConfigParsingTest : public ::testing::Test {
public:
static void SetUpTestSuite() {
gpr_setenv("GRPC_EXPERIMENTAL_ENABLE_RLS_LB_POLICY", "true");
grpc_init();
}
static void TearDownTestSuite() {
grpc_shutdown_blocking();
gpr_unsetenv("GRPC_EXPERIMENTAL_ENABLE_RLS_LB_POLICY");
}
};
TEST_F(RlsConfigParsingTest, ValidConfig) {
const char* service_config_json =
"{\n"
" \"loadBalancingConfig\":[{\n"
" \"rls\":{\n"
" \"routeLookupConfig\":{\n"
" \"lookupService\":\"rls.example.com:80\",\n"
" \"cacheSizeBytes\":1,\n"
" \"grpcKeybuilders\":[\n"
" {\n"
" \"names\":[\n"
" {\"service\":\"foo\"}\n"
" ]\n"
" }\n"
" ]\n"
" },\n"
" \"childPolicy\":[\n"
" {\"unknown\":{}},\n" // Okay, since the next one exists.
" {\"grpclb\":{}}\n"
" ],\n"
" \"childPolicyConfigTargetFieldName\":\"target\"\n"
" }\n"
" }]\n"
"}\n";
grpc_error_handle error = GRPC_ERROR_NONE;
auto service_config = ServiceConfig::Create(
/*args=*/nullptr, service_config_json, &error);
EXPECT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
EXPECT_NE(service_config, nullptr);
}
//
// top-level fields
//
TEST_F(RlsConfigParsingTest, TopLevelRequiredFieldsMissing) {
const char* service_config_json =
"{\n"
" \"loadBalancingConfig\":[{\n"
" \"rls\":{\n"
" }\n"
" }]\n"
"}\n";
grpc_error_handle error = GRPC_ERROR_NONE;
auto service_config = ServiceConfig::Create(
/*args=*/nullptr, service_config_json, &error);
EXPECT_THAT(
grpc_error_std_string(error),
::testing::ContainsRegex(
"errors parsing RLS LB policy config" CHILD_ERROR_TAG
"field:routeLookupConfig error:does not exist.*"
"field:childPolicyConfigTargetFieldName error:does not exist.*"
"field:childPolicy error:does not exist"));
GRPC_ERROR_UNREF(error);
}
TEST_F(RlsConfigParsingTest, TopLevelFieldsWrongTypes) {
const char* service_config_json =
"{\n"
" \"loadBalancingConfig\":[{\n"
" \"rls\":{\n"
" \"routeLookupConfig\":1,\n"
" \"childPolicy\":1,\n"
" \"childPolicyConfigTargetFieldName\":1\n"
" }\n"
" }]\n"
"}\n";
grpc_error_handle error = GRPC_ERROR_NONE;
auto service_config = ServiceConfig::Create(
/*args=*/nullptr, service_config_json, &error);
EXPECT_THAT(
grpc_error_std_string(error),
::testing::ContainsRegex(
"errors parsing RLS LB policy config" CHILD_ERROR_TAG
"field:routeLookupConfig error:type should be OBJECT.*"
"field:childPolicyConfigTargetFieldName error:type should be STRING.*"
"field:childPolicy error:type should be ARRAY"));
GRPC_ERROR_UNREF(error);
}
TEST_F(RlsConfigParsingTest, TopLevelFieldsInvalidValues) {
const char* service_config_json =
"{\n"
" \"loadBalancingConfig\":[{\n"
" \"rls\":{\n"
" \"childPolicy\":[\n"
" {\"unknown\":{}}\n"
" ],\n"
" \"childPolicyConfigTargetFieldName\":\"\"\n"
" }\n"
" }]\n"
"}\n";
grpc_error_handle error = GRPC_ERROR_NONE;
auto service_config = ServiceConfig::Create(
/*args=*/nullptr, service_config_json, &error);
EXPECT_THAT(
grpc_error_std_string(error),
::testing::ContainsRegex(
"errors parsing RLS LB policy config" CHILD_ERROR_TAG
"field:childPolicyConfigTargetFieldName error:must be non-empty.*"
"field:childPolicy" CHILD_ERROR_TAG
"No known policies in list: unknown"));
GRPC_ERROR_UNREF(error);
}
TEST_F(RlsConfigParsingTest, InvalidChildPolicyConfig) {
const char* service_config_json =
"{\n"
" \"loadBalancingConfig\":[{\n"
" \"rls\":{\n"
" \"childPolicy\":[\n"
" {\"grpclb\":{\"childPolicy\":1}}\n"
" ],\n"
" \"childPolicyConfigTargetFieldName\":\"serviceName\"\n"
" }\n"
" }]\n"
"}\n";
grpc_error_handle error = GRPC_ERROR_NONE;
auto service_config = ServiceConfig::Create(
/*args=*/nullptr, service_config_json, &error);
EXPECT_THAT(
grpc_error_std_string(error),
::testing::ContainsRegex(
"errors parsing RLS LB policy config" CHILD_ERROR_TAG
"field:childPolicy" CHILD_ERROR_TAG "GrpcLb Parser" CHILD_ERROR_TAG
"field:childPolicy" CHILD_ERROR_TAG "type should be array"));
GRPC_ERROR_UNREF(error);
}
//
// routeLookupConfig fields
//
TEST_F(RlsConfigParsingTest, RouteLookupConfigRequiredFieldsMissing) {
const char* service_config_json =
"{\n"
" \"loadBalancingConfig\":[{\n"
" \"rls\":{\n"
" \"routeLookupConfig\":{\n"
" }\n"
" }\n"
" }]\n"
"}\n";
grpc_error_handle error = GRPC_ERROR_NONE;
auto service_config = ServiceConfig::Create(
/*args=*/nullptr, service_config_json, &error);
EXPECT_THAT(grpc_error_std_string(error),
::testing::ContainsRegex(
"errors parsing RLS LB policy config" CHILD_ERROR_TAG
"field:routeLookupConfig" CHILD_ERROR_TAG
"field:grpcKeybuilders error:does not exist.*"
"field:lookupService error:does not exist"));
GRPC_ERROR_UNREF(error);
}
TEST_F(RlsConfigParsingTest, RouteLookupConfigFieldsWrongTypes) {
const char* service_config_json =
"{\n"
" \"loadBalancingConfig\":[{\n"
" \"rls\":{\n"
" \"routeLookupConfig\":{\n"
" \"grpcKeybuilders\":1,\n"
" \"name\":1,\n"
" \"lookupService\":1,\n"
" \"lookupServiceTimeout\":{},\n"
" \"maxAge\":{},\n"
" \"staleAge\":{},\n"
" \"cacheSizeBytes\":\"xxx\",\n"
" \"defaultTarget\":1\n"
" }\n"
" }\n"
" }]\n"
"}\n";
grpc_error_handle error = GRPC_ERROR_NONE;
auto service_config = ServiceConfig::Create(
/*args=*/nullptr, service_config_json, &error);
EXPECT_THAT(grpc_error_std_string(error),
::testing::ContainsRegex(
"errors parsing RLS LB policy config" CHILD_ERROR_TAG
"field:routeLookupConfig" CHILD_ERROR_TAG
"field:grpcKeybuilders error:type should be ARRAY.*"
"field:lookupService error:type should be STRING.*"
"field:maxAge error:type should be STRING.*"
"field:staleAge error:type should be STRING.*"
"field:cacheSizeBytes error:type should be NUMBER.*"
"field:defaultTarget error:type should be STRING"));
GRPC_ERROR_UNREF(error);
}
TEST_F(RlsConfigParsingTest, RouteLookupConfigFieldsInvalidValues) {
const char* service_config_json =
"{\n"
" \"loadBalancingConfig\":[{\n"
" \"rls\":{\n"
" \"routeLookupConfig\":{\n"
" \"lookupService\":\"\",\n"
" \"cacheSizeBytes\":0\n"
" }\n"
" }\n"
" }]\n"
"}\n";
grpc_error_handle error = GRPC_ERROR_NONE;
auto service_config = ServiceConfig::Create(
/*args=*/nullptr, service_config_json, &error);
EXPECT_THAT(grpc_error_std_string(error),
::testing::ContainsRegex(
"errors parsing RLS LB policy config" CHILD_ERROR_TAG
"field:routeLookupConfig" CHILD_ERROR_TAG
"field:lookupService error:must be valid gRPC target URI.*"
"field:cacheSizeBytes error:must be greater than 0"));
GRPC_ERROR_UNREF(error);
}
//
// grpcKeybuilder fields
//
TEST_F(RlsConfigParsingTest, GrpcKeybuilderRequiredFieldsMissing) {
const char* service_config_json =
"{\n"
" \"loadBalancingConfig\":[{\n"
" \"rls\":{\n"
" \"routeLookupConfig\":{\n"
" \"grpcKeybuilders\":[\n"
" {\n"
" }\n"
" ]\n"
" }\n"
" }\n"
" }]\n"
"}\n";
grpc_error_handle error = GRPC_ERROR_NONE;
auto service_config = ServiceConfig::Create(
/*args=*/nullptr, service_config_json, &error);
EXPECT_THAT(
grpc_error_std_string(error),
::testing::ContainsRegex(
"errors parsing RLS LB policy config" CHILD_ERROR_TAG
"field:routeLookupConfig" CHILD_ERROR_TAG
"field:grpcKeybuilders" CHILD_ERROR_TAG "index:0" CHILD_ERROR_TAG
"field:names error:does not exist"));
GRPC_ERROR_UNREF(error);
}
TEST_F(RlsConfigParsingTest, GrpcKeybuilderWrongFieldTypes) {
const char* service_config_json =
"{\n"
" \"loadBalancingConfig\":[{\n"
" \"rls\":{\n"
" \"routeLookupConfig\":{\n"
" \"grpcKeybuilders\":[\n"
" {\n"
" \"names\":1,\n"
" \"headers\":1,\n"
" \"extraKeys\":1,\n"
" \"constantKeys\":1\n"
" }\n"
" ]\n"
" }\n"
" }\n"
" }]\n"
"}\n";
grpc_error_handle error = GRPC_ERROR_NONE;
auto service_config = ServiceConfig::Create(
/*args=*/nullptr, service_config_json, &error);
EXPECT_THAT(
grpc_error_std_string(error),
::testing::ContainsRegex(
"errors parsing RLS LB policy config" CHILD_ERROR_TAG
"field:routeLookupConfig" CHILD_ERROR_TAG
"field:grpcKeybuilders" CHILD_ERROR_TAG "index:0" CHILD_ERROR_TAG
"field:names error:type should be ARRAY.*"
"field:headers error:type should be ARRAY.*"
"field:extraKeys error:type should be OBJECT.*"
"field:constantKeys error:type should be OBJECT"));
GRPC_ERROR_UNREF(error);
}
TEST_F(RlsConfigParsingTest, GrpcKeybuilderInvalidValues) {
const char* service_config_json =
"{\n"
" \"loadBalancingConfig\":[{\n"
" \"rls\":{\n"
" \"routeLookupConfig\":{\n"
" \"grpcKeybuilders\":[\n"
" {\n"
" \"names\":[],\n"
" \"extraKeys\":{\n"
" \"host\":1,\n"
" \"service\":1,\n"
" \"method\":1\n"
" },\n"
" \"constantKeys\":{\n"
" \"key\":1\n"
" }\n"
" }\n"
" ]\n"
" }\n"
" }\n"
" }]\n"
"}\n";
grpc_error_handle error = GRPC_ERROR_NONE;
auto service_config = ServiceConfig::Create(
/*args=*/nullptr, service_config_json, &error);
EXPECT_THAT(grpc_error_std_string(error),
::testing::ContainsRegex(
"errors parsing RLS LB policy config" CHILD_ERROR_TAG
"field:routeLookupConfig" CHILD_ERROR_TAG
"field:grpcKeybuilders" CHILD_ERROR_TAG
"index:0" CHILD_ERROR_TAG "field:names error:list is empty.*"
"field:extraKeys" CHILD_ERROR_TAG
"field:host error:type should be STRING.*"
"field:service error:type should be STRING.*"
"field:method error:type should be STRING.*"
"field:constantKeys" CHILD_ERROR_TAG
"field:key error:type should be STRING"));
GRPC_ERROR_UNREF(error);
}
TEST_F(RlsConfigParsingTest, GrpcKeybuilderInvalidHeaders) {
const char* service_config_json =
"{\n"
" \"loadBalancingConfig\":[{\n"
" \"rls\":{\n"
" \"routeLookupConfig\":{\n"
" \"grpcKeybuilders\":[\n"
" {\n"
" \"headers\":[\n"
" 1,\n"
" {\n"
" \"key\":1,\n"
" \"names\":1\n"
" },\n"
" {\n"
" \"names\":[]\n"
" },\n"
" {\n"
" \"key\":\"\",\n"
" \"names\":[1, \"\"]\n"
" }\n"
" ],\n"
" \"extraKeys\":{\n"
" \"host\": \"\"\n"
" },\n"
" \"constantKeys\":{\n"
" \"\":\"foo\"\n"
" }\n"
" }\n"
" ]\n"
" }\n"
" }\n"
" }]\n"
"}\n";
grpc_error_handle error = GRPC_ERROR_NONE;
auto service_config = ServiceConfig::Create(
/*args=*/nullptr, service_config_json, &error);
EXPECT_THAT(
grpc_error_std_string(error),
::testing::ContainsRegex(
"errors parsing RLS LB policy config" CHILD_ERROR_TAG
"field:routeLookupConfig" CHILD_ERROR_TAG
"field:grpcKeybuilders" CHILD_ERROR_TAG "index:0" CHILD_ERROR_TAG
"field:headers index:0 error:type should be OBJECT.*"
"field:headers index:1" CHILD_ERROR_TAG
"field:key error:type should be STRING.*"
"field:names error:type should be ARRAY.*"
"field:headers index:2" CHILD_ERROR_TAG
"field:key error:does not exist.*"
"field:names error:list is empty.*"
"field:headers index:3" CHILD_ERROR_TAG
"field:key error:must be non-empty.*"
"field:names index:0 error:type should be STRING.*"
"field:names index:1 error:header name must be non-empty.*"
"field:extraKeys" CHILD_ERROR_TAG
"field:host error:must be non-empty.*"
"field:constantKeys" CHILD_ERROR_TAG "error:keys must be non-empty"));
GRPC_ERROR_UNREF(error);
}
TEST_F(RlsConfigParsingTest, GrpcKeybuilderNameWrongFieldTypes) {
const char* service_config_json =
"{\n"
" \"loadBalancingConfig\":[{\n"
" \"rls\":{\n"
" \"routeLookupConfig\":{\n"
" \"grpcKeybuilders\":[\n"
" {\n"
" \"names\":[\n"
" 1,\n"
" {\n"
" \"service\":1,\n"
" \"method\":1\n"
" }\n"
" ]\n"
" }\n"
" ]\n"
" }\n"
" }\n"
" }]\n"
"}\n";
grpc_error_handle error = GRPC_ERROR_NONE;
auto service_config = ServiceConfig::Create(
/*args=*/nullptr, service_config_json, &error);
EXPECT_THAT(
grpc_error_std_string(error),
::testing::ContainsRegex(
"errors parsing RLS LB policy config" CHILD_ERROR_TAG
"field:routeLookupConfig" CHILD_ERROR_TAG
"field:grpcKeybuilders" CHILD_ERROR_TAG "index:0" CHILD_ERROR_TAG
"field:names index:0 error:type should be OBJECT.*"
"field:names index:1" CHILD_ERROR_TAG
"field:service error:type should be STRING.*"
"field:method error:type should be STRING"));
GRPC_ERROR_UNREF(error);
}
TEST_F(RlsConfigParsingTest, DuplicateMethodNamesInSameKeyBuilder) {
const char* service_config_json =
"{\n"
" \"loadBalancingConfig\":[{\n"
" \"rls\":{\n"
" \"routeLookupConfig\":{\n"
" \"grpcKeybuilders\":[\n"
" {\n"
" \"names\":[\n"
" {\n"
" \"service\":\"foo\",\n"
" \"method\":\"bar\"\n"
" },\n"
" {\n"
" \"service\":\"foo\",\n"
" \"method\":\"bar\"\n"
" }\n"
" ]\n"
" }\n"
" ]\n"
" }\n"
" }\n"
" }]\n"
"}\n";
grpc_error_handle error = GRPC_ERROR_NONE;
auto service_config = ServiceConfig::Create(
/*args=*/nullptr, service_config_json, &error);
EXPECT_THAT(
grpc_error_std_string(error),
::testing::ContainsRegex(
"errors parsing RLS LB policy config" CHILD_ERROR_TAG
"field:routeLookupConfig" CHILD_ERROR_TAG
"field:grpcKeybuilders" CHILD_ERROR_TAG "index:0" CHILD_ERROR_TAG
"field:names error:duplicate entry for /foo/bar"));
GRPC_ERROR_UNREF(error);
}
TEST_F(RlsConfigParsingTest, DuplicateMethodNamesInDifferentKeyBuilders) {
const char* service_config_json =
"{\n"
" \"loadBalancingConfig\":[{\n"
" \"rls\":{\n"
" \"routeLookupConfig\":{\n"
" \"grpcKeybuilders\":[\n"
" {\n"
" \"names\":[\n"
" {\n"
" \"service\":\"foo\",\n"
" \"method\":\"bar\"\n"
" }\n"
" ]\n"
" },\n"
" {\n"
" \"names\":[\n"
" {\n"
" \"service\":\"foo\",\n"
" \"method\":\"bar\"\n"
" }\n"
" ]\n"
" }\n"
" ]\n"
" }\n"
" }\n"
" }]\n"
"}\n";
grpc_error_handle error = GRPC_ERROR_NONE;
auto service_config = ServiceConfig::Create(
/*args=*/nullptr, service_config_json, &error);
EXPECT_THAT(
grpc_error_std_string(error),
::testing::ContainsRegex(
"errors parsing RLS LB policy config" CHILD_ERROR_TAG
"field:routeLookupConfig" CHILD_ERROR_TAG
"field:grpcKeybuilders" CHILD_ERROR_TAG "index:1" CHILD_ERROR_TAG
"field:names error:duplicate entry for /foo/bar"));
GRPC_ERROR_UNREF(error);
}
} // namespace
} // namespace grpc_core
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
grpc::testing::TestEnvironment env(argc, argv);
return RUN_ALL_TESTS();
}

@ -22,6 +22,7 @@
#include "src/core/ext/filters/client_channel/lb_policy.h"
#include "src/core/ext/filters/client_channel/lb_policy_registry.h"
#include "src/core/lib/address_utils/parse_address.h"
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/channel/channelz.h"
#include "src/core/lib/debug/trace.h"
@ -33,6 +34,7 @@
#include "src/core/lib/iomgr/error.h"
#include "src/core/lib/iomgr/pollset_set.h"
#include "src/core/lib/json/json.h"
#include "src/core/lib/json/json_util.h"
#include "src/core/lib/transport/connectivity_state.h"
namespace grpc_core {
@ -413,6 +415,119 @@ class AddressTestFactory : public LoadBalancingPolicyFactory {
AddressTestCallback cb_;
};
//
// FixedAddressLoadBalancingPolicy
//
constexpr char kFixedAddressLbPolicyName[] = "fixed_address_lb";
class FixedAddressConfig : public LoadBalancingPolicy::Config {
public:
explicit FixedAddressConfig(std::string address)
: address_(std::move(address)) {}
const char* name() const override { return kFixedAddressLbPolicyName; }
const std::string& address() const { return address_; }
private:
std::string address_;
};
class FixedAddressLoadBalancingPolicy : public ForwardingLoadBalancingPolicy {
public:
explicit FixedAddressLoadBalancingPolicy(Args args)
: ForwardingLoadBalancingPolicy(
absl::make_unique<Helper>(
RefCountedPtr<FixedAddressLoadBalancingPolicy>(this)),
std::move(args),
/*delegate_policy_name=*/"pick_first",
/*initial_refcount=*/2) {}
~FixedAddressLoadBalancingPolicy() override = default;
const char* name() const override { return kFixedAddressLbPolicyName; }
void UpdateLocked(UpdateArgs args) override {
auto* config = static_cast<FixedAddressConfig*>(args.config.get());
gpr_log(GPR_INFO, "%s: update URI: %s", kFixedAddressLbPolicyName,
config->address().c_str());
auto uri = URI::Parse(config->address());
args.config.reset();
args.addresses.clear();
if (uri.ok()) {
grpc_resolved_address address;
GPR_ASSERT(grpc_parse_uri(*uri, &address));
args.addresses.emplace_back(address, /*args=*/nullptr);
} else {
gpr_log(GPR_ERROR,
"%s: could not parse URI (%s), using empty address list",
kFixedAddressLbPolicyName, uri.status().ToString().c_str());
}
ForwardingLoadBalancingPolicy::UpdateLocked(std::move(args));
}
private:
class Helper : public ChannelControlHelper {
public:
explicit Helper(RefCountedPtr<FixedAddressLoadBalancingPolicy> parent)
: parent_(std::move(parent)) {}
RefCountedPtr<SubchannelInterface> CreateSubchannel(
ServerAddress address, const grpc_channel_args& args) override {
return parent_->channel_control_helper()->CreateSubchannel(
std::move(address), args);
}
void UpdateState(grpc_connectivity_state state, const absl::Status& status,
std::unique_ptr<SubchannelPicker> picker) override {
parent_->channel_control_helper()->UpdateState(state, status,
std::move(picker));
}
void RequestReresolution() override {
parent_->channel_control_helper()->RequestReresolution();
}
absl::string_view GetAuthority() override {
return parent_->channel_control_helper()->GetAuthority();
}
void AddTraceEvent(TraceSeverity severity,
absl::string_view message) override {
parent_->channel_control_helper()->AddTraceEvent(severity, message);
}
private:
RefCountedPtr<FixedAddressLoadBalancingPolicy> parent_;
};
};
class FixedAddressFactory : public LoadBalancingPolicyFactory {
public:
FixedAddressFactory() = default;
OrphanablePtr<LoadBalancingPolicy> CreateLoadBalancingPolicy(
LoadBalancingPolicy::Args args) const override {
return MakeOrphanable<FixedAddressLoadBalancingPolicy>(std::move(args));
}
const char* name() const override { return kFixedAddressLbPolicyName; }
RefCountedPtr<LoadBalancingPolicy::Config> ParseLoadBalancingConfig(
const Json& json, grpc_error_handle* error) const override {
std::vector<grpc_error_handle> error_list;
std::string address;
ParseJsonObjectField(json.object_value(), "address", &address, &error_list);
if (!error_list.empty()) {
*error = GRPC_ERROR_CREATE_FROM_VECTOR(
"errors parsing fixed_address_lb config", &error_list);
return nullptr;
}
return MakeRefCounted<FixedAddressConfig>(std::move(address));
}
};
} // namespace
void RegisterTestPickArgsLoadBalancingPolicy(TestPickArgsCallback cb,
@ -433,4 +548,9 @@ void RegisterAddressTestLoadBalancingPolicy(AddressTestCallback cb) {
absl::make_unique<AddressTestFactory>(std::move(cb)));
}
void RegisterFixedAddressLoadBalancingPolicy() {
LoadBalancingPolicyRegistry::Builder::RegisterLoadBalancingPolicyFactory(
absl::make_unique<FixedAddressFactory>());
}
} // namespace grpc_core

@ -54,6 +54,10 @@ using AddressTestCallback = std::function<void(const ServerAddress&)>;
// address used to create a subchannel.
void RegisterAddressTestLoadBalancingPolicy(AddressTestCallback cb);
// Registers an LB policy called "fixed_address_lb" that provides a
// single subchannel whose address is in its configuration.
void RegisterFixedAddressLoadBalancingPolicy();
} // namespace grpc_core
#endif // GRPC_TEST_CORE_UTIL_TEST_LB_POLICIES_H

@ -477,6 +477,30 @@ grpc_cc_test(
],
)
grpc_cc_test(
name = "rls_end2end_test",
srcs = ["rls_end2end_test.cc"],
external_deps = [
"gtest",
"absl/types:optional",
],
deps = [
":counted_service",
":test_service_impl",
"//:gpr",
"//:grpc",
"//:grpc++",
"//src/proto/grpc/lookup/v1:rls_proto",
"//src/proto/grpc/testing:echo_messages_proto",
"//src/proto/grpc/testing:echo_proto",
"//src/proto/grpc/testing/duplicate:echo_duplicate_proto",
"//test/core/util:grpc_test_util",
"//test/core/util:test_lb_policies",
"//test/cpp/util:test_config",
"//test/cpp/util:test_util",
],
)
grpc_cc_test(
name = "service_config_end2end_test",
srcs = ["service_config_end2end_test.cc"],

File diff suppressed because it is too large Load Diff

@ -133,6 +133,7 @@ proto_files=( \
"src/proto/grpc/gcp/transport_security_common.proto" \
"src/proto/grpc/health/v1/health.proto" \
"src/proto/grpc/lb/v1/load_balancer.proto" \
"src/proto/grpc/lookup/v1/rls.proto" \
"third_party/istio/security/proto/providers/google/meshca.proto" \
"udpa/annotations/migrate.proto" \
"udpa/annotations/security.proto" \

@ -1094,6 +1094,7 @@ src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc \
src/core/ext/filters/client_channel/lb_policy/priority/priority.cc \
src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc \
src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.h \
src/core/ext/filters/client_channel/lb_policy/rls/rls.cc \
src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc \
src/core/ext/filters/client_channel/lb_policy/subchannel_list.h \
src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc \
@ -1420,6 +1421,8 @@ src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c \
src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h \
src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c \
src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h \
src/core/ext/upb-generated/src/proto/grpc/lookup/v1/rls.upb.c \
src/core/ext/upb-generated/src/proto/grpc/lookup/v1/rls.upb.h \
src/core/ext/upb-generated/udpa/annotations/migrate.upb.c \
src/core/ext/upb-generated/udpa/annotations/migrate.upb.h \
src/core/ext/upb-generated/udpa/annotations/security.upb.c \

@ -918,6 +918,7 @@ src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc \
src/core/ext/filters/client_channel/lb_policy/priority/priority.cc \
src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc \
src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.h \
src/core/ext/filters/client_channel/lb_policy/rls/rls.cc \
src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc \
src/core/ext/filters/client_channel/lb_policy/subchannel_list.h \
src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc \
@ -1255,6 +1256,8 @@ src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c \
src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h \
src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c \
src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h \
src/core/ext/upb-generated/src/proto/grpc/lookup/v1/rls.upb.c \
src/core/ext/upb-generated/src/proto/grpc/lookup/v1/rls.upb.h \
src/core/ext/upb-generated/udpa/annotations/migrate.upb.c \
src/core/ext/upb-generated/udpa/annotations/migrate.upb.h \
src/core/ext/upb-generated/udpa/annotations/security.upb.c \

@ -6057,6 +6057,54 @@
],
"uses_polling": false
},
{
"args": [],
"benchmark": false,
"ci_platforms": [
"linux",
"mac",
"posix",
"windows"
],
"cpu_cost": 1.0,
"exclude_configs": [],
"exclude_iomgrs": [],
"flaky": false,
"gtest": true,
"language": "c++",
"name": "rls_end2end_test",
"platforms": [
"linux",
"mac",
"posix",
"windows"
],
"uses_polling": true
},
{
"args": [],
"benchmark": false,
"ci_platforms": [
"linux",
"mac",
"posix",
"windows"
],
"cpu_cost": 1.0,
"exclude_configs": [],
"exclude_iomgrs": [],
"flaky": false,
"gtest": true,
"language": "c++",
"name": "rls_lb_config_parser_test",
"platforms": [
"linux",
"mac",
"posix",
"windows"
],
"uses_polling": true
},
{
"args": [],
"benchmark": false,

Loading…
Cancel
Save