Skip to content

Commit

Permalink
Changed Outlier Detection Env Var to default true
Browse files Browse the repository at this point in the history
  • Loading branch information
zasweq committed Sep 28, 2022
1 parent 36e4810 commit 39ae0b2
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 36 deletions.
6 changes: 3 additions & 3 deletions internal/envconfig/xds.go
Expand Up @@ -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")

Expand Down
15 changes: 2 additions & 13 deletions test/xds/xds_client_outlier_detection_test.go
Expand Up @@ -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"
Expand All @@ -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()
Expand Down Expand Up @@ -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()
Expand Down
4 changes: 0 additions & 4 deletions xds/internal/balancer/cdsbalancer/cdsbalancer_test.go
Expand Up @@ -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"
Expand Down Expand Up @@ -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()
}()
Expand Down
6 changes: 0 additions & 6 deletions xds/internal/balancer/clusterresolver/clusterresolver_test.go
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Expand Down
7 changes: 0 additions & 7 deletions xds/internal/balancer/clusterresolver/configbuilder_test.go
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions xds/internal/xdsclient/xdsresource/unmarshal_cds_test.go
Expand Up @@ -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.
Expand Down

0 comments on commit 39ae0b2

Please sign in to comment.