diff --git a/internal/envconfig/xds.go b/internal/envconfig/xds.go index 55aaeea8b455..af09711a3e88 100644 --- a/internal/envconfig/xds.go +++ b/internal/envconfig/xds.go @@ -84,9 +84,9 @@ var ( // "GRPC_XDS_EXPERIMENTAL_RBAC" to "false". XDSRBAC = !strings.EqualFold(os.Getenv(rbacSupportEnv), "false") // XDSOutlierDetection indicates whether outlier detection support is - // enabled, which can be enabled by setting the environment variable - // "GRPC_EXPERIMENTAL_ENABLE_OUTLIER_DETECTION" to "true". - XDSOutlierDetection = strings.EqualFold(os.Getenv(outlierDetectionSupportEnv), "true") + // enabled, which can be disabled by setting the environment variable + // "GRPC_EXPERIMENTAL_ENABLE_OUTLIER_DETECTION" to "false". + XDSOutlierDetection = !strings.EqualFold(os.Getenv(outlierDetectionSupportEnv), "false") // XDSFederation indicates whether federation support is enabled. XDSFederation = strings.EqualFold(os.Getenv(federationEnv), "true") diff --git a/test/xds/xds_client_outlier_detection_test.go b/test/xds/xds_client_outlier_detection_test.go index b53439cf66ce..b9868876e42a 100644 --- a/test/xds/xds_client_outlier_detection_test.go +++ b/test/xds/xds_client_outlier_detection_test.go @@ -33,7 +33,6 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/internal" - "google.golang.org/grpc/internal/envconfig" "google.golang.org/grpc/internal/stubserver" "google.golang.org/grpc/internal/testutils/xds/e2e" testgrpc "google.golang.org/grpc/test/grpc_testing" @@ -49,13 +48,8 @@ import ( // Detection balancer. This test verifies that an RPC is able to proceed // normally with this configuration. func (s) TestOutlierDetection_NoopConfig(t *testing.T) { - oldOD := envconfig.XDSOutlierDetection - envconfig.XDSOutlierDetection = true internal.RegisterOutlierDetectionBalancerForTesting() - defer func() { - envconfig.XDSOutlierDetection = oldOD - internal.UnregisterOutlierDetectionBalancerForTesting() - }() + defer internal.UnregisterOutlierDetectionBalancerForTesting() managementServer, nodeID, _, resolver, cleanup1 := e2e.SetupManagementServer(t, nil) defer cleanup1() @@ -129,13 +123,8 @@ func clusterWithOutlierDetection(clusterName, edsServiceName string, secLevel e2 // Detection Balancer should eject the connection to the backend which // constantly errors, and thus RPC's should mainly go to backend 1 and 2. func (s) TestOutlierDetectionWithOutlier(t *testing.T) { - oldOD := envconfig.XDSOutlierDetection - envconfig.XDSOutlierDetection = true internal.RegisterOutlierDetectionBalancerForTesting() - defer func() { - envconfig.XDSOutlierDetection = oldOD - internal.UnregisterOutlierDetectionBalancerForTesting() - }() + defer internal.UnregisterOutlierDetectionBalancerForTesting() managementServer, nodeID, _, resolver, cleanup := e2e.SetupManagementServer(t, nil) defer cleanup() diff --git a/xds/internal/balancer/cdsbalancer/cdsbalancer_test.go b/xds/internal/balancer/cdsbalancer/cdsbalancer_test.go index dfa47913ae29..18d20e28f246 100644 --- a/xds/internal/balancer/cdsbalancer/cdsbalancer_test.go +++ b/xds/internal/balancer/cdsbalancer/cdsbalancer_test.go @@ -29,7 +29,6 @@ import ( "google.golang.org/grpc/balancer" "google.golang.org/grpc/connectivity" "google.golang.org/grpc/internal" - "google.golang.org/grpc/internal/envconfig" "google.golang.org/grpc/internal/grpctest" internalserviceconfig "google.golang.org/grpc/internal/serviceconfig" "google.golang.org/grpc/internal/testutils" @@ -366,14 +365,11 @@ func (s) TestUpdateClientConnStateWithSameState(t *testing.T) { // different updates and verifies that the expect ClientConnState is propagated // to the edsBalancer. func (s) TestHandleClusterUpdate(t *testing.T) { - oldOutlierDetection := envconfig.XDSOutlierDetection - envconfig.XDSOutlierDetection = true xdsC, cdsB, edsB, _, cancel := setupWithWatch(t) xdsC.SetBootstrapConfig(&bootstrap.Config{ XDSServer: defaultTestAuthorityServerConfig, }) defer func() { - envconfig.XDSOutlierDetection = oldOutlierDetection cancel() cdsB.Close() }() diff --git a/xds/internal/balancer/clusterresolver/clusterresolver_test.go b/xds/internal/balancer/clusterresolver/clusterresolver_test.go index f6f6249d9e89..db3ab78f1232 100644 --- a/xds/internal/balancer/clusterresolver/clusterresolver_test.go +++ b/xds/internal/balancer/clusterresolver/clusterresolver_test.go @@ -31,7 +31,6 @@ import ( "google.golang.org/grpc/balancer/weightedtarget" "google.golang.org/grpc/connectivity" "google.golang.org/grpc/internal" - "google.golang.org/grpc/internal/envconfig" "google.golang.org/grpc/internal/grpctest" internalserviceconfig "google.golang.org/grpc/internal/serviceconfig" "google.golang.org/grpc/internal/testutils" @@ -533,12 +532,7 @@ func newLBConfigWithOneEDSAndOutlierDetection(edsServiceName string, odCfg outli // Configuration sent downward should have a top level Outlier Detection Policy // for each priority. func (s) TestOutlierDetection(t *testing.T) { - oldOutlierDetection := envconfig.XDSOutlierDetection - envconfig.XDSOutlierDetection = true internal.RegisterOutlierDetectionBalancerForTesting() - defer func() { - envconfig.XDSOutlierDetection = oldOutlierDetection - }() edsLBCh := testutils.NewChannel() xdsC, cleanup := setup(edsLBCh) diff --git a/xds/internal/balancer/clusterresolver/configbuilder_test.go b/xds/internal/balancer/clusterresolver/configbuilder_test.go index d050df11b02a..b53514bef86c 100644 --- a/xds/internal/balancer/clusterresolver/configbuilder_test.go +++ b/xds/internal/balancer/clusterresolver/configbuilder_test.go @@ -31,7 +31,6 @@ import ( "google.golang.org/grpc/balancer/roundrobin" "google.golang.org/grpc/balancer/weightedroundrobin" "google.golang.org/grpc/balancer/weightedtarget" - "google.golang.org/grpc/internal/envconfig" "google.golang.org/grpc/internal/hierarchy" internalserviceconfig "google.golang.org/grpc/internal/serviceconfig" "google.golang.org/grpc/resolver" @@ -323,12 +322,6 @@ func TestBuildPriorityConfig(t *testing.T) { // priority should be an Outlier Detection balancer, with a Cluster Impl // Balancer as a child. func TestBuildPriorityConfigWithOutlierDetection(t *testing.T) { - oldOutlierDetection := envconfig.XDSOutlierDetection - envconfig.XDSOutlierDetection = true - defer func() { - envconfig.XDSOutlierDetection = oldOutlierDetection - }() - gotConfig, _, _ := buildPriorityConfig([]priorityConfig{ { // EDS - OD config should be the top level for both of the EDS diff --git a/xds/internal/xdsclient/xdsresource/unmarshal_cds_test.go b/xds/internal/xdsclient/xdsresource/unmarshal_cds_test.go index 67e057a6c400..fa8f4d4bbcc8 100644 --- a/xds/internal/xdsclient/xdsresource/unmarshal_cds_test.go +++ b/xds/internal/xdsclient/xdsresource/unmarshal_cds_test.go @@ -1690,9 +1690,6 @@ func (s) TestUnmarshalCluster(t *testing.T) { } func (s) TestValidateClusterWithOutlierDetection(t *testing.T) { - oldOutlierDetectionSupportEnv := envconfig.XDSOutlierDetection - envconfig.XDSOutlierDetection = true - defer func() { envconfig.XDSOutlierDetection = oldOutlierDetectionSupportEnv }() odToClusterProto := func(od *v3clusterpb.OutlierDetection) *v3clusterpb.Cluster { // Cluster parsing doesn't fail with respect to fields orthogonal to // outlier detection.