Skip to content

Commit 3b1137d

Browse files
committed
xds: Remove temporary environment variable for least request.
Fixes #8228.
1 parent 718c4d8 commit 3b1137d

File tree

7 files changed

+2
-52
lines changed

7 files changed

+2
-52
lines changed

internal/envconfig/envconfig.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,6 @@ var (
3333
// "GRPC_RING_HASH_CAP". This does not override the default bounds
3434
// checking which NACKs configs specifying ring sizes > 8*1024*1024 (~8M).
3535
RingHashCap = uint64FromEnv("GRPC_RING_HASH_CAP", 4096, 1, 8*1024*1024)
36-
// LeastRequestLB is set if we should support the least_request_experimental
37-
// LB policy, which can be enabled by setting the environment variable
38-
// "GRPC_EXPERIMENTAL_ENABLE_LEAST_REQUEST" to "true".
39-
LeastRequestLB = boolFromEnv("GRPC_EXPERIMENTAL_ENABLE_LEAST_REQUEST", true)
4036
// ALTSMaxConcurrentHandshakes is the maximum number of concurrent ALTS
4137
// handshakes that can be performed.
4238
ALTSMaxConcurrentHandshakes = uint64FromEnv("GRPC_ALTS_MAX_CONCURRENT_HANDSHAKES", 100, 1, 100)

test/xds/xds_client_custom_lb_test.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import (
2828
_ "google.golang.org/grpc/balancer/leastrequest" // To register least_request
2929
_ "google.golang.org/grpc/balancer/weightedroundrobin" // To register weighted_round_robin
3030
"google.golang.org/grpc/credentials/insecure"
31-
"google.golang.org/grpc/internal/envconfig"
3231
"google.golang.org/grpc/internal/stubserver"
3332
"google.golang.org/grpc/internal/testutils"
3433
"google.golang.org/grpc/internal/testutils/roundrobin"
@@ -94,12 +93,6 @@ func clusterWithLBConfiguration(t *testing.T, clusterName, edsServiceName string
9493
// first) child load balancing policy, and asserts the correct distribution
9594
// based on the locality weights and the endpoint picking policy specified.
9695
func (s) TestWrrLocality(t *testing.T) {
97-
oldLeastRequestLBSupport := envconfig.LeastRequestLB
98-
envconfig.LeastRequestLB = true
99-
defer func() {
100-
envconfig.LeastRequestLB = oldLeastRequestLBSupport
101-
}()
102-
10396
backend1 := stubserver.StartTestService(t, nil)
10497
port1 := testutils.ParsePort(t, backend1.Address)
10598
defer backend1.Stop()

xds/internal/xdsclient/xdslbregistry/converter/converter.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ import (
3232
"google.golang.org/grpc/balancer/pickfirst"
3333
"google.golang.org/grpc/balancer/roundrobin"
3434
"google.golang.org/grpc/balancer/weightedroundrobin"
35-
"google.golang.org/grpc/internal/envconfig"
3635
internalserviceconfig "google.golang.org/grpc/internal/serviceconfig"
3736
"google.golang.org/grpc/xds/internal/balancer/ringhash"
3837
"google.golang.org/grpc/xds/internal/balancer/wrrlocality"
@@ -176,9 +175,6 @@ func convertWeightedRoundRobinProtoToServiceConfig(rawProto []byte, _ int) (json
176175
}
177176

178177
func convertLeastRequestProtoToServiceConfig(rawProto []byte, _ int) (json.RawMessage, error) {
179-
if !envconfig.LeastRequestLB {
180-
return nil, nil
181-
}
182178
lrProto := &v3leastrequestpb.LeastRequest{}
183179
if err := proto.Unmarshal(rawProto, lrProto); err != nil {
184180
return nil, fmt.Errorf("failed to unmarshal resource: %v", err)

xds/internal/xdsclient/xdslbregistry/xdslbregistry_test.go

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import (
2727
"github.com/google/go-cmp/cmp"
2828
_ "google.golang.org/grpc/balancer/roundrobin"
2929
"google.golang.org/grpc/internal/balancer/stub"
30-
"google.golang.org/grpc/internal/envconfig"
3130
"google.golang.org/grpc/internal/grpctest"
3231
"google.golang.org/grpc/internal/pretty"
3332
internalserviceconfig "google.golang.org/grpc/internal/serviceconfig"
@@ -70,9 +69,6 @@ func wrrLocalityBalancerConfig(childPolicy *internalserviceconfig.BalancerConfig
7069
}
7170

7271
func (s) TestConvertToServiceConfigSuccess(t *testing.T) {
73-
defer func(old bool) { envconfig.LeastRequestLB = old }(envconfig.LeastRequestLB)
74-
envconfig.LeastRequestLB = false
75-
7672
const customLBPolicyName = "myorg.MyCustomLeastRequestPolicy"
7773
stub.Register(customLBPolicyName, stub.BalancerFuncs{})
7874

@@ -198,26 +194,6 @@ func (s) TestConvertToServiceConfigSuccess(t *testing.T) {
198194
},
199195
wantConfig: `[{"pick_first": { "shuffleAddressList": true }}]`,
200196
},
201-
{
202-
name: "least_request_disabled_pf_rr_use_first_supported",
203-
policy: &v3clusterpb.LoadBalancingPolicy{
204-
Policies: []*v3clusterpb.LoadBalancingPolicy_Policy{
205-
{
206-
TypedExtensionConfig: &v3corepb.TypedExtensionConfig{
207-
TypedConfig: testutils.MarshalAny(t, &v3leastrequestpb.LeastRequest{
208-
ChoiceCount: wrapperspb.UInt32(32),
209-
}),
210-
},
211-
},
212-
{
213-
TypedExtensionConfig: &v3corepb.TypedExtensionConfig{
214-
TypedConfig: testutils.MarshalAny(t, &v3roundrobinpb.RoundRobin{}),
215-
},
216-
},
217-
},
218-
},
219-
wantConfig: `[{"round_robin": {}}]`,
220-
},
221197
{
222198
name: "custom_lb_type_v3_struct",
223199
policy: &v3clusterpb.LoadBalancingPolicy{
@@ -308,10 +284,6 @@ func (s) TestConvertToServiceConfigSuccess(t *testing.T) {
308284

309285
for _, test := range tests {
310286
t.Run(test.name, func(t *testing.T) {
311-
if test.lrEnabled {
312-
defer func(old bool) { envconfig.LeastRequestLB = old }(envconfig.LeastRequestLB)
313-
envconfig.LeastRequestLB = true
314-
}
315287
rawJSON, err := xdslbregistry.ConvertToServiceConfig(test.policy, 0)
316288
if err != nil {
317289
t.Fatalf("ConvertToServiceConfig(%s) failed: %v", pretty.ToJSON(test.policy), err)
@@ -382,7 +354,7 @@ func (s) TestConvertToServiceConfigFailure(t *testing.T) {
382354
},
383355
{
384356
TypedExtensionConfig: &v3corepb.TypedExtensionConfig{
385-
// Not supported by gRPC-Go.
357+
// Maglev is not yet supported by gRPC.
386358
TypedConfig: testutils.MarshalAny(t, &v3maglevpb.Maglev{}),
387359
},
388360
},

xds/internal/xdsclient/xdsresource/tests/unmarshal_cds_test.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import (
2727
"github.com/google/go-cmp/cmp/cmpopts"
2828
"google.golang.org/grpc/balancer/leastrequest"
2929
"google.golang.org/grpc/internal/balancer/stub"
30-
"google.golang.org/grpc/internal/envconfig"
3130
"google.golang.org/grpc/internal/grpctest"
3231
iserviceconfig "google.golang.org/grpc/internal/serviceconfig"
3332
"google.golang.org/grpc/internal/testutils"
@@ -105,8 +104,6 @@ func (s) TestValidateCluster_Success(t *testing.T) {
105104
t.Fatalf("Failed to create server config for testing: %v", err)
106105
}
107106

108-
defer func(old bool) { envconfig.LeastRequestLB = old }(envconfig.LeastRequestLB)
109-
envconfig.LeastRequestLB = true
110107
tests := []struct {
111108
name string
112109
cluster *v3clusterpb.Cluster

xds/internal/xdsclient/xdsresource/unmarshal_cds.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,6 @@ func validateClusterAndConstructClusterUpdate(cluster *v3clusterpb.Cluster, serv
133133
rhLBCfg := []byte(fmt.Sprintf("{\"minRingSize\": %d, \"maxRingSize\": %d}", minSize, maxSize))
134134
lbPolicy = []byte(fmt.Sprintf(`[{"ring_hash_experimental": %s}]`, rhLBCfg))
135135
case v3clusterpb.Cluster_LEAST_REQUEST:
136-
if !envconfig.LeastRequestLB {
137-
return ClusterUpdate{}, fmt.Errorf("unexpected lbPolicy %v in response: %+v", cluster.GetLbPolicy(), cluster)
138-
}
139-
140136
// "The configuration for the Least Request LB policy is the
141137
// least_request_lb_config field. The field is optional; if not present,
142138
// defaults will be assumed for all of its values." - A48

xds/internal/xdsclient/xdsresource/unmarshal_cds_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ func (s) TestValidateCluster_Failure(t *testing.T) {
107107
wantErr: true,
108108
},
109109
{
110-
name: "not-supported-lb-policy",
110+
name: "unsupported-lb-policy",
111111
cluster: &v3clusterpb.Cluster{
112112
ClusterDiscoveryType: &v3clusterpb.Cluster_Type{Type: v3clusterpb.Cluster_EDS},
113113
EdsClusterConfig: &v3clusterpb.Cluster_EdsClusterConfig{

0 commit comments

Comments
 (0)