Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: grpc/grpc-go
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.42.0
Choose a base ref
...
head repository: grpc/grpc-go
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.43.0
Choose a head ref

Commits on Oct 29, 2021

  1. Copy the full SHA
    bb655a9 View commit details
  2. Copy the full SHA
    d6aca73 View commit details

Commits on Nov 1, 2021

  1. Copy the full SHA
    6d465fe View commit details
  2. Copy the full SHA
    467630f View commit details
  3. Copy the full SHA
    1163cfa View commit details

Commits on Nov 2, 2021

  1. Copy the full SHA
    29deb6b View commit details
  2. Copy the full SHA
    670c133 View commit details

Commits on Nov 3, 2021

  1. xds: NACK missing route specifier server side (#4925)

    * xds: NACK missing route specifier server side
    zasweq authored Nov 3, 2021
    Copy the full SHA
    c105005 View commit details
  2. Copy the full SHA
    3b94303 View commit details

Commits on Nov 5, 2021

  1. Copy the full SHA
    5841c8c View commit details
  2. kokoro: Enable xds authz_test (#4954)

    * kokoro: Enable xds authz_test
    ejona86 authored Nov 5, 2021
    Copy the full SHA
    878cea2 View commit details

Commits on Nov 8, 2021

  1. Copy the full SHA
    3fa1988 View commit details
  2. Copy the full SHA
    79e9c95 View commit details
  3. Copy the full SHA
    c53203c View commit details
  4. Copy the full SHA
    82c2825 View commit details
  5. Copy the full SHA
    bac0a7e View commit details

Commits on Nov 9, 2021

  1. Copy the full SHA
    59e024e View commit details
  2. Copy the full SHA
    14ebd91 View commit details
  3. Copy the full SHA
    714ba8d View commit details
  4. Copy the full SHA
    c25a52b View commit details
  5. Copy the full SHA
    dd76741 View commit details

Commits on Nov 10, 2021

  1. xds: Add Cluster Specifier Plugin to xdsclient (#4967)

    * xds: Add Cluster Specifier Plugin to xdsclient
    zasweq authored Nov 10, 2021
    Copy the full SHA
    d57363a View commit details
  2. xds: Added validation and construction of RBAC matcher engine to Pars…

    …eConfig (#4964)
    
    * xds: Added validation and construction of RBAC matcher engine to ParseConfig
    zasweq authored Nov 10, 2021
    Copy the full SHA
    6603e73 View commit details
  3. Copy the full SHA
    52d9416 View commit details

Commits on Nov 11, 2021

  1. Copy the full SHA
    6a896a3 View commit details
  2. Copy the full SHA
    d61c7ae View commit details
  3. Copy the full SHA
    ea068ed View commit details
  4. Copy the full SHA
    82d8af8 View commit details

Commits on Nov 12, 2021

  1. xdsclient: add Cluster Specifier Name to Route (#4972)

    * xdsclient: add Cluster Specifier Name to Route
    zasweq authored Nov 12, 2021
    Copy the full SHA
    6e79bc8 View commit details
  2. Copy the full SHA
    cf8b64e View commit details

Commits on Nov 15, 2021

  1. Copy the full SHA
    b2317c7 View commit details

Commits on Nov 16, 2021

  1. Copy the full SHA
    bdf8336 View commit details
  2. Copy the full SHA
    23becb7 View commit details

Commits on Nov 17, 2021

  1. Copy the full SHA
    295d7e6 View commit details

Commits on Nov 19, 2021

  1. Copy the full SHA
    f45e617 View commit details
  2. Copy the full SHA
    d542bfc View commit details

Commits on Nov 29, 2021

  1. rls: double import rls protos (#5003)

    Use `rlspb` for messages and `rlsgrpc` for services
    easwars authored Nov 29, 2021
    Copy the full SHA
    6f8796b View commit details
  2. balancergroup: add method to exitIdle a sub-balancer (#4994)

    This is required for the RLS LB policy. At pick time, if the RLS picker
    finds one of its child policies in IDLE, it needs to be able to ask it
    to exit idle.
    easwars authored Nov 29, 2021
    Copy the full SHA
    58beff1 View commit details

Commits on Nov 30, 2021

  1. Copy the full SHA
    872a6f1 View commit details
  2. Copy the full SHA
    c2bccd0 View commit details

Commits on Dec 1, 2021

  1. Copy the full SHA
    46935b9 View commit details

Commits on Dec 2, 2021

  1. Copy the full SHA
    f3bbd12 View commit details

Commits on Dec 3, 2021

  1. rls: support extra_keys and constant_keys (#4995)

    * rls: support extra_keys and constant_keys
    
    * review comments
    
    * use the constant_keys map from the proto
    easwars authored Dec 3, 2021
    Copy the full SHA
    512e894 View commit details

Commits on Dec 6, 2021

  1. xds/resolver: Add support for cluster specifier plugins (#4987)

    * xds/resolver: Add support for cluster specifier plugins
    zasweq authored Dec 6, 2021
    Copy the full SHA
    3786ae1 View commit details

Commits on Dec 8, 2021

  1. Copy the full SHA
    46e883a View commit details

Commits on Dec 14, 2021

  1. Copy the full SHA
    e15d978 View commit details
  2. Copy the full SHA
    296afc2 View commit details
  3. Copy the full SHA
    ae29ac3 View commit details
  4. Copy the full SHA
    14c1138 View commit details
Showing with 10,629 additions and 7,875 deletions.
  1. +5 −9 authz/rbac_translator.go
  2. +18 −11 balancer/balancer.go
  3. +6 −6 balancer/grpclb/grpclb_test.go
  4. +0 −86 balancer/grpclb/grpclb_test_util_test.go
  5. +1 −1 balancer/rls/internal/adaptive/adaptive_test.go
  6. +5 −4 balancer/rls/internal/client.go
  7. +5 −8 balancer/rls/internal/client_test.go
  8. +1 −2 balancer/rls/internal/config.go
  9. +76 −47 balancer/rls/internal/keys/builder.go
  10. +200 −78 balancer/rls/internal/keys/builder_test.go
  11. +6 −8 balancer/rls/internal/picker.go
  12. +1 −1 balancer/rls/internal/picker_test.go
  13. +2 −2 balancer/rls/internal/testutils/fakeserver/fakeserver.go
  14. 0 {xds/internal → }/balancer/weightedtarget/logging.go
  15. 0 {xds/internal → }/balancer/weightedtarget/weightedaggregator/aggregator.go
  16. +5 −8 {xds/internal → }/balancer/weightedtarget/weightedtarget.go
  17. 0 {xds/internal → }/balancer/weightedtarget/weightedtarget_config.go
  18. +21 −19 {xds/internal → }/balancer/weightedtarget/weightedtarget_config_test.go
  19. +1,220 −0 balancer/weightedtarget/weightedtarget_test.go
  20. +2 −2 benchmark/benchmain/main.go
  21. +1 −1 benchmark/latency/latency_test.go
  22. +5 −8 binarylog/binarylog_end2end_test.go
  23. +1 −1 channelz/grpc_channelz_v1/channelz.pb.go
  24. +25 −18 clientconn.go
  25. +33 −10 clientconn_test.go
  26. +10 −0 credentials/credentials.go
  27. +3 −0 credentials/insecure/insecure.go
  28. +12 −12 dialoptions.go
  29. +43 −5 examples/examples_test.sh
  30. +0 −1 examples/features/authentication/client/main.go
  31. +1 −1 examples/features/compression/client/main.go
  32. +1 −1 examples/features/deadline/client/main.go
  33. +9 −7 examples/features/debugging/client/main.go
  34. +1 −1 examples/features/encryption/ALTS/client/main.go
  35. +1 −1 examples/features/encryption/TLS/client/main.go
  36. +1 −1 examples/features/errors/client/main.go
  37. +1 −1 examples/features/interceptor/client/main.go
  38. +0 −2 examples/features/load_balancing/client/main.go
  39. +1 −1 examples/features/metadata/client/main.go
  40. +1 −1 examples/features/multiplex/client/main.go
  41. +0 −2 examples/features/name_resolving/client/main.go
  42. +14 −8 examples/features/unix_abstract/client/main.go
  43. +11 −4 examples/features/unix_abstract/server/main.go
  44. +9 −8 examples/helloworld/greeter_client/main.go
  45. +6 −3 examples/helloworld/greeter_server/main.go
  46. +1 −2 examples/route_guide/client/client.go
  47. +1 −1 examples/route_guide/server/server.go
  48. +11 −64 {xds/internal/balancer → internal}/balancergroup/balancergroup.go
  49. +537 −0 internal/balancergroup/balancergroup_test.go
  50. 0 {xds/internal/balancer → internal}/balancergroup/balancerstateaggregator.go
  51. +10 −10 internal/channelz/funcs.go
  52. +0 −6 internal/envconfig/envconfig.go
  53. +27 −34 internal/{xds/env/env.go → envconfig/xds.go}
  54. +6 −2 internal/grpctest/grpctest.go
  55. +1 −1 internal/profiling/buffer/buffer.go
  56. 0 {balancer/rls → }/internal/proto/grpc_lookup_v1/rls.pb.go
  57. +106 −35 {balancer/rls → }/internal/proto/grpc_lookup_v1/rls_config.pb.go
  58. 0 {balancer/rls → }/internal/proto/grpc_lookup_v1/rls_grpc.pb.go
  59. +3 −3 internal/serviceconfig/serviceconfig_test.go
  60. +0 −13 {xds → }/internal/testutils/balancer.go
  61. 0 {xds → }/internal/testutils/local_listener.go
  62. +99 −0 internal/testutils/restartable_listener.go
  63. 0 {xds → }/internal/testutils/wrr.go
  64. +1 −3 internal/transport/flowcontrol.go
  65. +8 −7 internal/transport/http2_client.go
  66. +23 −13 internal/transport/http2_server.go
  67. +2 −2 internal/transport/proxy.go
  68. +1 −4 internal/transport/proxy_test.go
  69. +41 −4 internal/transport/transport_test.go
  70. +4 −4 internal/xds/bootstrap.go
  71. +3 −3 internal/xds/rbac/rbac_engine.go
  72. +1 −1 pickfirst.go
  73. +2 −2 regenerate.sh
  74. +5 −7 rpc_util.go
  75. +4 −4 stats/stats_test.go
  76. +10 −9 status/status.go
  77. +2 −0 status/status_test.go
  78. +127 −4 test/balancer_test.go
  79. +2 −1 test/creds_test.go
  80. +54 −52 test/insecure_creds_test.go
  81. +2 −2 test/kokoro/{xds_k8s.cfg → psm-security.cfg}
  82. +1 −0 test/kokoro/{xds_k8s.sh → psm-security.sh}
  83. +7 −1 test/kokoro/xds.sh
  84. +0 −11 test/retry_test.go
  85. +1 −1 version.go
  86. +12 −11 xds/csds/csds.go
  87. +9 −9 xds/csds/csds_test.go
  88. +16 −14 xds/googledirectpath/googlec2p.go
  89. +17 −12 xds/googledirectpath/googlec2p_test.go
  90. +1 −1 xds/internal/balancer/balancer.go
  91. +0 −1,008 xds/internal/balancer/balancergroup/balancergroup_test.go
  92. +6 −5 xds/internal/balancer/cdsbalancer/cdsbalancer.go
  93. +15 −16 xds/internal/balancer/cdsbalancer/cdsbalancer_security_test.go
  94. +22 −22 xds/internal/balancer/cdsbalancer/cdsbalancer_test.go
  95. +11 −10 xds/internal/balancer/cdsbalancer/cluster_handler.go
  96. +68 −68 xds/internal/balancer/cdsbalancer/cluster_handler_test.go
  97. +1 −1 xds/internal/balancer/clusterimpl/balancer_test.go
  98. +1 −1 xds/internal/balancer/clusterimpl/config_test.go
  99. +2 −2 xds/internal/balancer/clustermanager/clustermanager.go
  100. +9 −7 xds/internal/balancer/clustermanager/clustermanager_test.go
  101. +1 −1 xds/internal/balancer/clustermanager/config_test.go
  102. +2 −1 xds/internal/balancer/clusterresolver/clusterresolver.go
  103. +13 −12 xds/internal/balancer/clusterresolver/clusterresolver_test.go
  104. +11 −11 xds/internal/balancer/clusterresolver/configbuilder.go
  105. +93 −93 xds/internal/balancer/clusterresolver/configbuilder_test.go
  106. +24 −22 xds/internal/balancer/clusterresolver/eds_impl_test.go
  107. +26 −25 xds/internal/balancer/clusterresolver/priority_test.go
  108. +4 −3 xds/internal/balancer/clusterresolver/resource_resolver.go
  109. +4 −4 xds/internal/balancer/clusterresolver/resource_resolver_test.go
  110. +14 −14 xds/internal/balancer/clusterresolver/testutil_test.go
  111. +2 −2 xds/internal/balancer/priority/balancer.go
  112. +2 −2 xds/internal/balancer/priority/balancer_test.go
  113. +2 −3 xds/internal/balancer/priority/ignore_resolve_now_test.go
  114. +1 −1 xds/internal/balancer/ringhash/picker_test.go
  115. +1 −1 xds/internal/balancer/ringhash/ringhash_test.go
  116. +0 −326 xds/internal/balancer/weightedtarget/weightedtarget_test.go
  117. +67 −0 xds/internal/clusterspecifier/cluster_specifier.go
  118. +5 −6 xds/internal/httpfilter/fault/fault_test.go
  119. +51 −51 xds/internal/httpfilter/rbac/rbac.go
  120. +368 −0 xds/internal/resolver/cluster_specifier_plugin_test.go
  121. +55 −33 xds/internal/resolver/serviceconfig.go
  122. +8 −8 xds/internal/resolver/serviceconfig_test.go
  123. +15 −9 xds/internal/resolver/watch_service.go
  124. +69 −69 xds/internal/resolver/watch_service_test.go
  125. +49 −9 xds/internal/resolver/xds_resolver.go
  126. +268 −174 xds/internal/resolver/xds_resolver_test.go
  127. +4 −4 xds/internal/server/conn_wrapper.go
  128. +15 −15 xds/internal/server/listener_wrapper.go
  129. +18 −18 xds/internal/server/listener_wrapper_test.go
  130. +6 −6 xds/internal/server/rds_handler.go
  131. +15 −15 xds/internal/server/rds_handler_test.go
  132. +1 −1 xds/internal/test/e2e/controlplane.go
  133. +4 −10 xds/internal/test/e2e/e2e.go
  134. +1 −1 xds/internal/test/e2e/e2e_test.go
  135. +8 −7 xds/internal/test/xds_client_affinity_test.go
  136. +1 −7 xds/internal/test/xds_client_integration_test.go
  137. +16 −17 xds/internal/test/xds_server_integration_test.go
  138. +7 −6 xds/internal/test/xds_server_serving_mode_test.go
  139. +17 −4 xds/internal/testutils/balancer_test.go
  140. +19 −17 xds/internal/testutils/fakeclient/client.go
  141. +0 −14 xds/internal/testutils/fakeserver/server.go
  142. +3 −17 xds/internal/{balancer/balancergroup/testutils_test.go → testutils/testutils.go}
  143. +9 −8 xds/internal/xdsclient/attributes.go
  144. +259 −114 xds/internal/xdsclient/bootstrap/bootstrap.go
  145. +300 −86 xds/internal/xdsclient/bootstrap/bootstrap_test.go
  146. +47 −0 xds/internal/xdsclient/bootstrap/template.go
  147. +97 −0 xds/internal/xdsclient/bootstrap/template_test.go
  148. +10 −280 xds/internal/xdsclient/callback.go
  149. +36 −753 xds/internal/xdsclient/client.go
  150. +64 −68 xds/internal/xdsclient/client_test.go
  151. +38 −0 xds/internal/xdsclient/controller.go
  152. +168 −0 xds/internal/xdsclient/controller/controller.go
  153. +144 −0 xds/internal/xdsclient/controller/loadreport.go
  154. +73 −153 xds/internal/xdsclient/{transport_helper.go → controller/transport.go}
  155. +75 −76 xds/internal/xdsclient/{v2/ack_test.go → controller/v2_ack_test.go}
  156. +23 −48 xds/internal/xdsclient/{v2/cds_test.go → controller/v2_cds_test.go}
  157. +212 −0 xds/internal/xdsclient/controller/v2_client_test.go
  158. +31 −31 xds/internal/xdsclient/{v2/eds_test.go → controller/v2_eds_test.go}
  159. +41 −42 xds/internal/xdsclient/{v2/lds_test.go → controller/v2_lds_test.go}
  160. +45 −46 xds/internal/xdsclient/{v2/rds_test.go → controller/v2_rds_test.go}
  161. +51 −252 xds/internal/xdsclient/{v2/client_test.go → controller/v2_testutils_test.go}
  162. +155 −0 xds/internal/xdsclient/controller/version/v2/client.go
  163. 0 xds/internal/xdsclient/{ → controller/version}/v2/loadreport.go
  164. +157 −0 xds/internal/xdsclient/controller/version/v3/client.go
  165. 0 xds/internal/xdsclient/{ → controller/version}/v3/loadreport.go
  166. +123 −0 xds/internal/xdsclient/controller/version/version.go
  167. +11 −91 xds/internal/xdsclient/dump.go
  168. +129 −122 xds/internal/xdsclient/dump_test.go
  169. +2 −108 xds/internal/xdsclient/loadreport.go
  170. +10 −11 xds/internal/xdsclient/loadreport_test.go
  171. +87 −0 xds/internal/xdsclient/pubsub/dump.go
  172. +39 −0 xds/internal/xdsclient/pubsub/interface.go
  173. +182 −0 xds/internal/xdsclient/pubsub/pubsub.go
  174. +318 −0 xds/internal/xdsclient/pubsub/update.go
  175. +232 −0 xds/internal/xdsclient/pubsub/watch.go
  176. +0 −238 xds/internal/xdsclient/v2/client.go
  177. +0 −238 xds/internal/xdsclient/v3/client.go
  178. +37 −252 xds/internal/xdsclient/watchers.go
  179. +94 −93 xds/internal/xdsclient/watchers_cluster_test.go
  180. +71 −70 xds/internal/xdsclient/watchers_endpoints_test.go
  181. +101 −94 xds/internal/xdsclient/watchers_listener_test.go
  182. +73 −72 xds/internal/xdsclient/watchers_route_test.go
  183. +0 −1,345 xds/internal/xdsclient/xds.go
  184. +26 −15 xds/internal/xdsclient/xdsclient_test.go
  185. +1 −1 xds/internal/xdsclient/{ → xdsresource}/errors.go
  186. +38 −18 xds/internal/xdsclient/{ → xdsresource}/filter_chain.go
  187. +84 −51 xds/internal/xdsclient/{ → xdsresource}/filter_chain_test.go
  188. +1 −2 xds/internal/xdsclient/{ → xdsresource}/matcher.go
  189. +1 −2 xds/internal/xdsclient/{ → xdsresource}/matcher_path.go
  190. +4 −5 xds/internal/xdsclient/{ → xdsresource}/matcher_path_test.go
  191. +3 −4 xds/internal/xdsclient/{ → xdsresource}/matcher_test.go
  192. +52 −0 xds/internal/xdsclient/xdsresource/test_utils_test.go
  193. +150 −0 xds/internal/xdsclient/xdsresource/type.go
  194. +87 −0 xds/internal/xdsclient/xdsresource/type_cds.go
  195. +80 −0 xds/internal/xdsclient/xdsresource/type_eds.go
  196. +87 −0 xds/internal/xdsclient/xdsresource/type_lds.go
  197. +255 −0 xds/internal/xdsclient/xdsresource/type_rds.go
  198. +174 −0 xds/internal/xdsclient/xdsresource/unmarshal.go
  199. +456 −0 xds/internal/xdsclient/xdsresource/unmarshal_cds.go
  200. +25 −25 xds/internal/xdsclient/{cds_test.go → xdsresource/unmarshal_cds_test.go}
  201. +131 −0 xds/internal/xdsclient/xdsresource/unmarshal_eds.go
  202. +3 −4 xds/internal/xdsclient/{eds_test.go → xdsresource/unmarshal_eds_test.go}
  203. +297 −0 xds/internal/xdsclient/xdsresource/unmarshal_lds.go
  204. +81 −10 xds/internal/xdsclient/{lds_test.go → xdsresource/unmarshal_lds_test.go}
  205. +433 −0 xds/internal/xdsclient/xdsresource/unmarshal_rds.go
  206. +198 −62 xds/internal/xdsclient/{rds_test.go → xdsresource/unmarshal_rds_test.go}
  207. 0 xds/internal/{ → xdsclient/xdsresource}/version/version.go
  208. +10 −12 xds/server.go
  209. +53 −43 xds/server_test.go
  210. +8 −8 xds/xds.go
14 changes: 5 additions & 9 deletions authz/rbac_translator.go
Original file line number Diff line number Diff line change
@@ -154,21 +154,21 @@ func parsePrincipalNames(principalNames []string) []*v3rbacpb.Principal {
return ps
}

func parsePeer(source peer) (*v3rbacpb.Principal, error) {
func parsePeer(source peer) *v3rbacpb.Principal {
if source.Principals == nil {
return &v3rbacpb.Principal{
Identifier: &v3rbacpb.Principal_Any{
Any: true,
},
}, nil
}
}
if len(source.Principals) == 0 {
return &v3rbacpb.Principal{
Identifier: &v3rbacpb.Principal_Authenticated_{
Authenticated: &v3rbacpb.Principal_Authenticated{},
}}, nil
}}
}
return principalOr(parsePrincipalNames(source.Principals)), nil
return principalOr(parsePrincipalNames(source.Principals))
}

func parsePaths(paths []string) []*v3rbacpb.Permission {
@@ -257,17 +257,13 @@ func parseRules(rules []rule, prefixName string) (map[string]*v3rbacpb.Policy, e
if rule.Name == "" {
return policies, fmt.Errorf(`%d: "name" is not present`, i)
}
principal, err := parsePeer(rule.Source)
if err != nil {
return nil, fmt.Errorf("%d: %v", i, err)
}
permission, err := parseRequest(rule.Request)
if err != nil {
return nil, fmt.Errorf("%d: %v", i, err)
}
policyName := prefixName + "_" + rule.Name
policies[policyName] = &v3rbacpb.Policy{
Principals: []*v3rbacpb.Principal{principal},
Principals: []*v3rbacpb.Principal{parsePeer(rule.Source)},
Permissions: []*v3rbacpb.Permission{permission},
}
}
29 changes: 18 additions & 11 deletions balancer/balancer.go
Original file line number Diff line number Diff line change
@@ -174,25 +174,32 @@ type ClientConn interface {

// BuildOptions contains additional information for Build.
type BuildOptions struct {
// DialCreds is the transport credential the Balancer implementation can
// use to dial to a remote load balancer server. The Balancer implementations
// can ignore this if it does not need to talk to another party securely.
// DialCreds is the transport credentials to use when communicating with a
// remote load balancer server. Balancer implementations which do not
// communicate with a remote load balancer server can ignore this field.
DialCreds credentials.TransportCredentials
// CredsBundle is the credentials bundle that the Balancer can use.
// CredsBundle is the credentials bundle to use when communicating with a
// remote load balancer server. Balancer implementations which do not
// communicate with a remote load balancer server can ignore this field.
CredsBundle credentials.Bundle
// Dialer is the custom dialer the Balancer implementation can use to dial
// to a remote load balancer server. The Balancer implementations
// can ignore this if it doesn't need to talk to remote balancer.
// Dialer is the custom dialer to use when communicating with a remote load
// balancer server. Balancer implementations which do not communicate with a
// remote load balancer server can ignore this field.
Dialer func(context.Context, string) (net.Conn, error)
// ChannelzParentID is the entity parent's channelz unique identification number.
// Authority is the server name to use as part of the authentication
// handshake when communicating with a remote load balancer server. Balancer
// implementations which do not communicate with a remote load balancer
// server can ignore this field.
Authority string
// ChannelzParentID is the parent ClientConn's channelz ID.
ChannelzParentID int64
// CustomUserAgent is the custom user agent set on the parent ClientConn.
// The balancer should set the same custom user agent if it creates a
// ClientConn.
CustomUserAgent string
// Target contains the parsed address info of the dial target. It is the same resolver.Target as
// passed to the resolver.
// See the documentation for the resolver.Target type for details about what it contains.
// Target contains the parsed address info of the dial target. It is the
// same resolver.Target as passed to the resolver. See the documentation for
// the resolver.Target type for details about what it contains.
Target resolver.Target
}

12 changes: 6 additions & 6 deletions balancer/grpclb/grpclb_test.go
Original file line number Diff line number Diff line change
@@ -369,7 +369,7 @@ func startBackendsAndRemoteLoadBalancer(numberOfBackends int, customUserAgent st
beIPs = append(beIPs, beLis.Addr().(*net.TCPAddr).IP)
bePorts = append(bePorts, beLis.Addr().(*net.TCPAddr).Port)

beListeners = append(beListeners, newRestartableListener(beLis))
beListeners = append(beListeners, testutils.NewRestartableListener(beLis))
}
backends := startBackends(beServerName, false, beListeners...)

@@ -379,7 +379,7 @@ func startBackendsAndRemoteLoadBalancer(numberOfBackends int, customUserAgent st
err = fmt.Errorf("failed to create the listener for the load balancer %v", err)
return
}
lbLis = newRestartableListener(lbLis)
lbLis = testutils.NewRestartableListener(lbLis)
lbCreds := &serverNameCheckCreds{
sn: lbServerName,
}
@@ -846,8 +846,8 @@ func (s) TestFallback(t *testing.T) {
}

// Close backend and remote balancer connections, should use fallback.
tss.beListeners[0].(*restartableListener).stopPreviousConns()
tss.lbListener.(*restartableListener).stopPreviousConns()
tss.beListeners[0].(*testutils.RestartableListener).Stop()
tss.lbListener.(*testutils.RestartableListener).Stop()

var fallbackUsed bool
for i := 0; i < 2000; i++ {
@@ -871,8 +871,8 @@ func (s) TestFallback(t *testing.T) {
}

// Restart backend and remote balancer, should not use fallback backend.
tss.beListeners[0].(*restartableListener).restart()
tss.lbListener.(*restartableListener).restart()
tss.beListeners[0].(*testutils.RestartableListener).Restart()
tss.lbListener.(*testutils.RestartableListener).Restart()
tss.ls.sls <- sl

var backendUsed2 bool
86 changes: 0 additions & 86 deletions balancer/grpclb/grpclb_test_util_test.go

This file was deleted.

2 changes: 1 addition & 1 deletion balancer/rls/internal/adaptive/adaptive_test.go
Original file line number Diff line number Diff line change
@@ -156,7 +156,7 @@ func TestShouldThrottleOptions(t *testing.T) {
for _, test := range testcases {
t.Run(test.desc, func(t *testing.T) {
m.SetNanos(0)
th := newWithArgs(time.Duration(time.Nanosecond), 1, test.ratioForAccepts, test.requestsPadding)
th := newWithArgs(time.Nanosecond, 1, test.ratioForAccepts, test.requestsPadding)
for i, response := range responses {
if response != E {
th.RegisterBackendResponse(response == T)
9 changes: 5 additions & 4 deletions balancer/rls/internal/client.go
Original file line number Diff line number Diff line change
@@ -23,7 +23,8 @@ import (
"time"

"google.golang.org/grpc"
rlspb "google.golang.org/grpc/balancer/rls/internal/proto/grpc_lookup_v1"
rlsgrpc "google.golang.org/grpc/internal/proto/grpc_lookup_v1"
rlspb "google.golang.org/grpc/internal/proto/grpc_lookup_v1"
)

// For gRPC services using RLS, the value of target_type in the
@@ -43,7 +44,7 @@ const grpcTargetType = "grpc"
// throttling and asks this client to make an RPC call only after checking with
// the throttler.
type rlsClient struct {
stub rlspb.RouteLookupServiceClient
stub rlsgrpc.RouteLookupServiceClient
// origDialTarget is the original dial target of the user and sent in each
// RouteLookup RPC made to the RLS server.
origDialTarget string
@@ -54,7 +55,7 @@ type rlsClient struct {

func newRLSClient(cc *grpc.ClientConn, dialTarget string, rpcTimeout time.Duration) *rlsClient {
return &rlsClient{
stub: rlspb.NewRouteLookupServiceClient(cc),
stub: rlsgrpc.NewRouteLookupServiceClient(cc),
origDialTarget: dialTarget,
rpcTimeout: rpcTimeout,
}
@@ -64,7 +65,7 @@ type lookupCallback func(targets []string, headerData string, err error)

// lookup starts a RouteLookup RPC in a separate goroutine and returns the
// results (and error, if any) in the provided callback.
func (c *rlsClient) lookup(path string, keyMap map[string]string, cb lookupCallback) {
func (c *rlsClient) lookup(keyMap map[string]string, cb lookupCallback) {
go func() {
ctx, cancel := context.WithTimeout(context.Background(), c.rpcTimeout)
resp, err := c.stub.RouteLookup(ctx, &rlspb.RouteLookupRequest{
13 changes: 5 additions & 8 deletions balancer/rls/internal/client_test.go
Original file line number Diff line number Diff line change
@@ -28,9 +28,9 @@ import (
"github.com/golang/protobuf/proto"
"github.com/google/go-cmp/cmp"
"google.golang.org/grpc"
rlspb "google.golang.org/grpc/balancer/rls/internal/proto/grpc_lookup_v1"
"google.golang.org/grpc/balancer/rls/internal/testutils/fakeserver"
"google.golang.org/grpc/codes"
rlspb "google.golang.org/grpc/internal/proto/grpc_lookup_v1"
"google.golang.org/grpc/internal/testutils"
"google.golang.org/grpc/status"
)
@@ -71,7 +71,7 @@ func (s) TestLookupFailure(t *testing.T) {
rlsClient := newRLSClient(cc, defaultDialTarget, defaultRPCTimeout)

errCh := testutils.NewChannel()
rlsClient.lookup("", nil, func(targets []string, headerData string, err error) {
rlsClient.lookup(nil, func(targets []string, headerData string, err error) {
if err == nil {
errCh.Send(errors.New("rlsClient.lookup() succeeded, should have failed"))
return
@@ -101,7 +101,7 @@ func (s) TestLookupDeadlineExceeded(t *testing.T) {
rlsClient := newRLSClient(cc, defaultDialTarget, 100*time.Millisecond)

errCh := testutils.NewChannel()
rlsClient.lookup("", nil, func(_ []string, _ string, err error) {
rlsClient.lookup(nil, func(_ []string, _ string, err error) {
if st, ok := status.FromError(err); !ok || st.Code() != codes.DeadlineExceeded {
errCh.Send(fmt.Errorf("rlsClient.lookup() returned error: %v, want %v", err, codes.DeadlineExceeded))
return
@@ -121,10 +121,7 @@ func (s) TestLookupSuccess(t *testing.T) {
server, cc, cleanup := setup(t)
defer cleanup()

const (
rlsReqPath = "/service/method"
wantHeaderData = "headerData"
)
const wantHeaderData = "headerData"

rlsReqKeyMap := map[string]string{
"k1": "v1",
@@ -141,7 +138,7 @@ func (s) TestLookupSuccess(t *testing.T) {
rlsClient := newRLSClient(cc, defaultDialTarget, defaultRPCTimeout)

errCh := testutils.NewChannel()
rlsClient.lookup(rlsReqPath, rlsReqKeyMap, func(targets []string, hd string, err error) {
rlsClient.lookup(rlsReqKeyMap, func(targets []string, hd string, err error) {
if err != nil {
errCh.Send(fmt.Errorf("rlsClient.Lookup() failed: %v", err))
return
3 changes: 1 addition & 2 deletions balancer/rls/internal/config.go
Original file line number Diff line number Diff line change
@@ -28,10 +28,9 @@ import (
"github.com/golang/protobuf/jsonpb"
"github.com/golang/protobuf/ptypes"
durationpb "github.com/golang/protobuf/ptypes/duration"

"google.golang.org/grpc/balancer"
"google.golang.org/grpc/balancer/rls/internal/keys"
rlspb "google.golang.org/grpc/balancer/rls/internal/proto/grpc_lookup_v1"
rlspb "google.golang.org/grpc/internal/proto/grpc_lookup_v1"
"google.golang.org/grpc/resolver"
"google.golang.org/grpc/serviceconfig"
)
Loading