Skip to content

Commit

Permalink
envconfig: enable xDS client fallback by default (#7949)
Browse files Browse the repository at this point in the history
  • Loading branch information
easwars authored Dec 20, 2024
1 parent e957825 commit f32168c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 24 deletions.
2 changes: 1 addition & 1 deletion internal/envconfig/envconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ var (
// XDSFallbackSupport is the env variable that controls whether support for
// xDS fallback is turned on. If this is unset or is false, only the first
// xDS server in the list of server configs will be used.
XDSFallbackSupport = boolFromEnv("GRPC_EXPERIMENTAL_XDS_FALLBACK", false)
XDSFallbackSupport = boolFromEnv("GRPC_EXPERIMENTAL_XDS_FALLBACK", true)
// NewPickFirstEnabled is set if the new pickfirst leaf policy is to be used
// instead of the exiting pickfirst implementation. This can be enabled by
// setting the environment variable "GRPC_EXPERIMENTAL_ENABLE_NEW_PICK_FIRST"
Expand Down
10 changes: 3 additions & 7 deletions internal/xds/bootstrap/bootstrap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -429,10 +429,6 @@ func (s) TestGetConfiguration_Success(t *testing.T) {

for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
origFallbackEnv := envconfig.XDSFallbackSupport
envconfig.XDSFallbackSupport = true
defer func() { envconfig.XDSFallbackSupport = origFallbackEnv }()

testGetConfigurationWithFileNameEnv(t, test.name, false, test.wantConfig)
testGetConfigurationWithFileContentEnv(t, test.name, false, test.wantConfig)
})
Expand Down Expand Up @@ -1202,9 +1198,9 @@ func (s) TestNode_ToProto(t *testing.T) {
// Tests the case where the xDS fallback env var is set to false, and verifies
// that only the first server from the list of server configurations is used.
func (s) TestGetConfiguration_FallbackDisabled(t *testing.T) {
// TODO(easwars): Default value of "GRPC_EXPERIMENTAL_XDS_FALLBACK"
// env var is currently false. When the default is changed to true,
// explicitly set it to false here.
origFallbackEnv := envconfig.XDSFallbackSupport
envconfig.XDSFallbackSupport = false
defer func() { envconfig.XDSFallbackSupport = origFallbackEnv }()

cancel := setupBootstrapOverride(map[string]string{
"multipleXDSServers": `
Expand Down
16 changes: 0 additions & 16 deletions xds/internal/xdsclient/tests/fallback_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import (
"google.golang.org/grpc/codes"
"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"
"google.golang.org/grpc/internal/testutils/xds/e2e"
Expand Down Expand Up @@ -79,11 +78,6 @@ func waitForRPCsToReachBackend(ctx context.Context, client testgrpc.TestServiceC
// to it. The test also verifies that when all requested resources are cached
// from the primary, fallback is not triggered when the connection goes down.
func (s) TestFallback_OnStartup(t *testing.T) {
// Enable fallback env var.
origFallbackEnv := envconfig.XDSFallbackSupport
envconfig.XDSFallbackSupport = true
defer func() { envconfig.XDSFallbackSupport = origFallbackEnv }()

ctx, cancel := context.WithTimeout(context.Background(), defaultFallbackTestTimeout)
defer cancel()

Expand Down Expand Up @@ -248,11 +242,6 @@ func (s) TestFallback_OnStartup(t *testing.T) {

// Tests fallback when the primary management server fails during an update.
func (s) TestFallback_MidUpdate(t *testing.T) {
// Enable fallback env var.
origFallbackEnv := envconfig.XDSFallbackSupport
envconfig.XDSFallbackSupport = true
defer func() { envconfig.XDSFallbackSupport = origFallbackEnv }()

ctx, cancel := context.WithTimeout(context.Background(), defaultFallbackTestTimeout)
defer cancel()

Expand Down Expand Up @@ -454,11 +443,6 @@ func (s) TestFallback_MidUpdate(t *testing.T) {

// Tests fallback when the primary management server fails during startup.
func (s) TestFallback_MidStartup(t *testing.T) {
// Enable fallback env var.
origFallbackEnv := envconfig.XDSFallbackSupport
envconfig.XDSFallbackSupport = true
defer func() { envconfig.XDSFallbackSupport = origFallbackEnv }()

ctx, cancel := context.WithTimeout(context.Background(), defaultFallbackTestTimeout)
defer cancel()

Expand Down

0 comments on commit f32168c

Please sign in to comment.