Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions internal/envconfig/envconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 0 additions & 6 deletions internal/xds/bootstrap/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
75 changes: 0 additions & 75 deletions internal/xds/bootstrap/bootstrap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
}