Skip to content

Commit

Permalink
fix(transport): skip s2a for now if service has direct path enabled (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
xmenxk committed Jan 30, 2024
1 parent 03042ec commit 54c764a
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
2 changes: 1 addition & 1 deletion internal/cba.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ func shouldUseS2A(clientCertSource cert.Source, settings *DialSettings) bool {
if settings.HTTPClient != nil {
return false
}
return true
return !settings.EnableDirectPath && !settings.EnableDirectPathXds
}

func isGoogleS2AEnabled() bool {
Expand Down
42 changes: 42 additions & 0 deletions internal/cba_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,26 @@ func TestGetGRPCTransportConfigAndEndpoint(t *testing.T) {
validConfigResp,
testMTLSEndpoint,
},
{
"no client cert, S2A address not empty, EnableDirectPath == true",
&DialSettings{
DefaultMTLSEndpoint: testMTLSEndpoint,
DefaultEndpoint: testRegularEndpoint,
EnableDirectPath: true,
},
validConfigResp,
testRegularEndpoint,
},
{
"no client cert, S2A address not empty, EnableDirectPathXds == true",
&DialSettings{
DefaultMTLSEndpoint: testMTLSEndpoint,
DefaultEndpoint: testRegularEndpoint,
EnableDirectPathXds: true,
},
validConfigResp,
testRegularEndpoint,
},
{
"no client cert, S2A address empty",
&DialSettings{
Expand Down Expand Up @@ -244,6 +264,28 @@ func TestGetHTTPTransportConfigAndEndpoint_s2a(t *testing.T) {
testMTLSEndpoint,
false,
},
{
"no client cert, S2A address not empty, EnableDirectPath == true",
&DialSettings{
DefaultMTLSEndpoint: testMTLSEndpoint,
DefaultEndpoint: testRegularEndpoint,
EnableDirectPath: true,
},
validConfigResp,
testRegularEndpoint,
true,
},
{
"no client cert, S2A address not empty, EnableDirectPathXds == true",
&DialSettings{
DefaultMTLSEndpoint: testMTLSEndpoint,
DefaultEndpoint: testRegularEndpoint,
EnableDirectPathXds: true,
},
validConfigResp,
testRegularEndpoint,
true,
},
{
"no client cert, S2A address empty",
&DialSettings{
Expand Down

0 comments on commit 54c764a

Please sign in to comment.