diff --git a/internal/envconfig/envconfig.go b/internal/envconfig/envconfig.go index 65fde7dc2116..7e060f5ed132 100644 --- a/internal/envconfig/envconfig.go +++ b/internal/envconfig/envconfig.go @@ -52,11 +52,6 @@ var ( // or "false". EnforceALPNEnabled = boolFromEnv("GRPC_ENFORCE_ALPN_ENABLED", true) - // 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", true) - // NewPickFirstEnabled is set if the new pickfirst leaf policy is to be used // instead of the exiting pickfirst implementation. This can be disabled by // setting the environment variable "GRPC_EXPERIMENTAL_ENABLE_NEW_PICK_FIRST" diff --git a/internal/xds/bootstrap/bootstrap.go b/internal/xds/bootstrap/bootstrap.go index 6c7b2332facc..4278702ec0c7 100644 --- a/internal/xds/bootstrap/bootstrap.go +++ b/internal/xds/bootstrap/bootstrap.go @@ -106,12 +106,6 @@ func (scs *ServerConfigs) UnmarshalJSON(data []byte) error { if err := json.Unmarshal(data, &servers); err != nil { return fmt.Errorf("xds: failed to JSON unmarshal server configurations during bootstrap: %v, config:\n%s", err, string(data)) } - // Only use the first server config if fallback support is disabled. - if !envconfig.XDSFallbackSupport { - if len(servers) > 1 { - servers = servers[:1] - } - } *scs = servers return nil } diff --git a/internal/xds/bootstrap/bootstrap_test.go b/internal/xds/bootstrap/bootstrap_test.go index 88f27a4a770e..5d5ed90f03de 100644 --- a/internal/xds/bootstrap/bootstrap_test.go +++ b/internal/xds/bootstrap/bootstrap_test.go @@ -1201,78 +1201,3 @@ 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) { - origFallbackEnv := envconfig.XDSFallbackSupport - envconfig.XDSFallbackSupport = false - defer func() { envconfig.XDSFallbackSupport = origFallbackEnv }() - - cancel := setupBootstrapOverride(map[string]string{ - "multipleXDSServers": ` - { - "node": { - "id": "ENVOY_NODE_ID", - "metadata": { - "TRAFFICDIRECTOR_GRPC_HOSTNAME": "trafficdirector" - } - }, - "xds_servers" : [ - { - "server_uri": "trafficdirector.googleapis.com:443", - "channel_creds": [{ "type": "google_default" }], - "server_features": ["xds_v3"] - }, - { - "server_uri": "backup.never.use.com:1234", - "channel_creds": [{ "type": "google_default" }] - } - ], - "authorities": { - "xds.td.com": { - "xds_servers": [ - { - "server_uri": "td.com", - "channel_creds": [ { "type": "google_default" } ], - "server_features" : ["xds_v3"] - }, - { - "server_uri": "backup.never.use.com:1234", - "channel_creds": [{ "type": "google_default" }] - } - ] - } - } - }`, - }) - defer cancel() - - wantConfig := &Config{ - xDSServers: []*ServerConfig{{ - serverURI: "trafficdirector.googleapis.com:443", - channelCreds: []ChannelCreds{{Type: "google_default"}}, - serverFeatures: []string{"xds_v3"}, - selectedCreds: ChannelCreds{Type: "google_default"}, - }}, - node: v3Node, - clientDefaultListenerResourceNameTemplate: "%s", - authorities: map[string]*Authority{ - "xds.td.com": { - ClientListenerResourceNameTemplate: "xdstp://xds.td.com/envoy.config.listener.v3.Listener/%s", - XDSServers: []*ServerConfig{{ - serverURI: "td.com", - channelCreds: []ChannelCreds{{Type: "google_default"}}, - serverFeatures: []string{"xds_v3"}, - selectedCreds: ChannelCreds{Type: "google_default"}, - }}, - }, - }, - } - t.Run("bootstrap_file_name", func(t *testing.T) { - testGetConfigurationWithFileNameEnv(t, "multipleXDSServers", false, wantConfig) - }) - t.Run("bootstrap_file_contents", func(t *testing.T) { - testGetConfigurationWithFileContentEnv(t, "multipleXDSServers", false, wantConfig) - }) -}