Skip to content

Commit e526a29

Browse files
authored
xds: Remove v3Support environment variable (#4174)
1 parent 7bb497f commit e526a29

File tree

4 files changed

+10
-65
lines changed

4 files changed

+10
-65
lines changed

xds/internal/client/bootstrap/bootstrap.go

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -258,14 +258,10 @@ func NewConfig() (*Config, error) {
258258
return nil, fmt.Errorf("xds: Required field %q doesn't contain valid value in bootstrap %s", "xds_servers.channel_creds", jsonData["xds_servers"])
259259
}
260260

261-
// We end up using v3 transport protocol version only if the following
262-
// conditions are met:
263-
// 1. Server supports v3, indicated by the presence of "xds_v3" in
264-
// server_features.
265-
// 2. Environment variable "GRPC_XDS_EXPERIMENTAL_V3_SUPPORT" is set to
266-
// true.
267-
// The default value of the enum type "version.TransportAPI" is v2.
268-
if env.V3Support && serverSupportsV3 {
261+
// We end up using v3 transport protocol version only if the server supports
262+
// v3, indicated by the presence of "xds_v3" in server_features. The default
263+
// value of the enum type "version.TransportAPI" is v2.
264+
if serverSupportsV3 {
269265
config.TransportAPI = version.TransportV3
270266
}
271267

xds/internal/client/bootstrap/bootstrap_test.go

Lines changed: 6 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -430,43 +430,10 @@ func TestNewConfigV2ProtoSuccess(t *testing.T) {
430430
}
431431
}
432432

433-
// TestNewConfigV3SupportNotEnabledOnClient verifies bootstrap functionality
434-
// when the GRPC_XDS_EXPERIMENTAL_V3_SUPPORT environment variable is not enabled
435-
// on the client. In this case, whether the server supports v3 or not, the
436-
// client will end up using v2.
437-
func TestNewConfigV3SupportNotEnabledOnClient(t *testing.T) {
438-
origV3Support := env.V3Support
439-
env.V3Support = false
440-
defer func() { env.V3Support = origV3Support }()
441-
442-
cancel := setupBootstrapOverride(v3BootstrapFileMap)
443-
defer cancel()
444-
445-
tests := []struct {
446-
name string
447-
wantConfig *Config
448-
}{
449-
{"serverDoesNotSupportsV3", nonNilCredsConfigV2},
450-
{"serverSupportsV3", nonNilCredsConfigV2},
451-
}
452-
453-
for _, test := range tests {
454-
t.Run(test.name, func(t *testing.T) {
455-
testNewConfigWithFileNameEnv(t, test.name, false, test.wantConfig)
456-
testNewConfigWithFileContentEnv(t, test.name, false, test.wantConfig)
457-
})
458-
}
459-
}
460-
461-
// TestNewConfigV3SupportEnabledOnClient verifies bootstrap functionality when
462-
// the GRPC_XDS_EXPERIMENTAL_V3_SUPPORT environment variable is enabled on the
463-
// client. Here the client ends up using v2 or v3 based on what the server
464-
// supports.
465-
func TestNewConfigV3SupportEnabledOnClient(t *testing.T) {
466-
origV3Support := env.V3Support
467-
env.V3Support = true
468-
defer func() { env.V3Support = origV3Support }()
469-
433+
// TestNewConfigV3Support verifies bootstrap functionality involving support for
434+
// the xDS v3 transport protocol. Here the client ends up using v2 or v3 based
435+
// on what the server supports.
436+
func TestNewConfigV3Support(t *testing.T) {
470437
cancel := setupBootstrapOverride(v3BootstrapFileMap)
471438
defer cancel()
472439

@@ -486,15 +453,12 @@ func TestNewConfigV3SupportEnabledOnClient(t *testing.T) {
486453
}
487454
}
488455

489-
// TestNewConfigBootstrapEnvPriority tests that the two env variables are read in correct priority
456+
// TestNewConfigBootstrapEnvPriority tests that the two env variables are read
457+
// in correct priority.
490458
//
491459
// the case where the bootstrap file
492460
// environment variable is not set.
493461
func TestNewConfigBootstrapEnvPriority(t *testing.T) {
494-
origV3Support := env.V3Support
495-
env.V3Support = true
496-
defer func() { env.V3Support = origV3Support }()
497-
498462
oldFileReadFunc := bootstrapFileReadFunc
499463
bootstrapFileReadFunc = func(filename string) ([]byte, error) {
500464
return fileReadFromFileMap(v2BootstrapFileMap, filename)
@@ -702,10 +666,6 @@ func TestNewConfigWithCertificateProviders(t *testing.T) {
702666
t.Fatalf("config parsing for plugin %q failed: %v", fakeCertProviderName, err)
703667
}
704668

705-
origV3Support := env.V3Support
706-
env.V3Support = true
707-
defer func() { env.V3Support = origV3Support }()
708-
709669
cancel := setupBootstrapOverride(bootstrapFileMap)
710670
defer cancel()
711671

xds/internal/env/env.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ const (
3838
//
3939
// When both bootstrap FileName and FileContent are set, FileName is used.
4040
BootstrapFileContentEnv = "GRPC_XDS_BOOTSTRAP_CONFIG"
41-
xdsV3SupportEnv = "GRPC_XDS_EXPERIMENTAL_V3_SUPPORT"
4241
circuitBreakingSupportEnv = "GRPC_XDS_EXPERIMENTAL_CIRCUIT_BREAKING"
4342
timeoutSupportEnv = "GRPC_XDS_EXPERIMENTAL_ENABLE_TIMEOUT"
4443
)
@@ -56,10 +55,6 @@ var (
5655
//
5756
// When both bootstrap FileName and FileContent are set, FileName is used.
5857
BootstrapFileContent = os.Getenv(BootstrapFileContentEnv)
59-
// V3Support indicates whether xDS v3 API support is enabled, which can be
60-
// done by setting the environment variable
61-
// "GRPC_XDS_EXPERIMENTAL_V3_SUPPORT" to "true".
62-
V3Support = strings.EqualFold(os.Getenv(xdsV3SupportEnv), "true")
6358
// CircuitBreakingSupport indicates whether circuit breaking support is
6459
// enabled, which can be done by setting the environment variable
6560
// "GRPC_XDS_EXPERIMENTAL_CIRCUIT_BREAKING" to "true".

xds/internal/test/xds_server_integration_test.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ import (
5050
testpb "google.golang.org/grpc/test/grpc_testing"
5151
"google.golang.org/grpc/testdata"
5252
"google.golang.org/grpc/xds"
53-
"google.golang.org/grpc/xds/internal/env"
5453
"google.golang.org/grpc/xds/internal/testutils"
5554
"google.golang.org/grpc/xds/internal/testutils/e2e"
5655
"google.golang.org/grpc/xds/internal/version"
@@ -136,10 +135,6 @@ func createClientTLSCredentials(t *testing.T) credentials.TransportCredentials {
136135
func commonSetup(t *testing.T) (*e2e.ManagementServer, string, net.Listener, func()) {
137136
t.Helper()
138137

139-
// Turn on xDS V3 support.
140-
origV3Support := env.V3Support
141-
env.V3Support = true
142-
143138
// Spin up a xDS management server on a local port.
144139
nodeID := uuid.New().String()
145140
fs, err := e2e.StartManagementServer()
@@ -189,7 +184,6 @@ func commonSetup(t *testing.T) (*e2e.ManagementServer, string, net.Listener, fun
189184
}()
190185

191186
return fs, nodeID, lis, func() {
192-
env.V3Support = origV3Support
193187
fs.Stop()
194188
bootstrapCleanup()
195189
server.Stop()

0 commit comments

Comments
 (0)