xds: change clusterimpl to add SNI to handshake info#9016
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #9016 +/- ##
==========================================
+ Coverage 83.01% 83.05% +0.03%
==========================================
Files 413 413
Lines 33054 33269 +215
==========================================
+ Hits 27441 27630 +189
- Misses 4205 4219 +14
- Partials 1408 1420 +12
🚀 New features to boost your workflow:
|
|
The release note seems to be too long. How about:
|
Changed. |
easwars
left a comment
There was a problem hiding this comment.
LGTM, modulo minor comments and nits
| // ClientSideTLSConfig constructs a tls.Config to be used in a client-side | ||
| // handshake based on the contents of the HandshakeInfo. | ||
| func (hi *HandshakeInfo) ClientSideTLSConfig(ctx context.Context) (*tls.Config, error) { | ||
| func (hi *HandshakeInfo) ClientSideTLSConfig(ctx context.Context, hostname string) (*tls.Config, error) { |
There was a problem hiding this comment.
Please comment on why hostname is passed as a parameter here instead of it being part of the HandshakeInfo.
|
|
||
| } | ||
|
|
||
| type mockProvider struct { |
There was a problem hiding this comment.
There is no mocking happening here.
There was a problem hiding this comment.
Changed the name to testProviderWithRoots
| } | ||
| // Store hostname in the address attributes, so that it can be used in | ||
| // the client handshake. | ||
| newAddrs[i] = xds.SetEndpointHostname(newAddrs[i], hostname) |
There was a problem hiding this comment.
This function name is and can be quite confusing, because it takes a resolver.Address, but contains the term Endpoint in it. Can you think of a better name?
There was a problem hiding this comment.
changed it to SetAddressHostname
| // Create test backends for two clusters | ||
| // backend1 configured with TLS creds, represents cluster1 (valid SNI) | ||
| // backend2 configured with TLS creds, represents cluster2 (invalid SNI) |
There was a problem hiding this comment.
Nit:
| // Create test backends for two clusters | |
| // backend1 configured with TLS creds, represents cluster1 (valid SNI) | |
| // backend2 configured with TLS creds, represents cluster2 (invalid SNI) | |
| // Create test backends for two clusters: | |
| // - backend1 configured with TLS creds, represents cluster1 (valid SNI) | |
| // - backend2 configured with TLS creds, represents cluster2 (invalid SNI) |
| // Create test backends | ||
| serverCreds := testutils.CreateServerTLSCredentials(t, tls.RequireAndVerifyClientCert) | ||
| server1 := stubserver.StartTestService(t, nil, grpc.Creds(serverCreds)) | ||
| defer server1.Stop() | ||
|
|
||
| server2 := stubserver.StartTestService(t, nil, grpc.Creds(serverCreds)) | ||
| defer server2.Stop() |
There was a problem hiding this comment.
Nit: here and elsewhere
| // Create test backends | |
| serverCreds := testutils.CreateServerTLSCredentials(t, tls.RequireAndVerifyClientCert) | |
| server1 := stubserver.StartTestService(t, nil, grpc.Creds(serverCreds)) | |
| defer server1.Stop() | |
| server2 := stubserver.StartTestService(t, nil, grpc.Creds(serverCreds)) | |
| defer server2.Stop() | |
| // Create test backends. | |
| serverCreds := testutils.CreateServerTLSCredentials(t, tls.RequireAndVerifyClientCert) | |
| server1 := stubserver.StartTestService(t, nil, grpc.Creds(serverCreds)) | |
| defer server1.Stop() | |
| server2 := stubserver.StartTestService(t, nil, grpc.Creds(serverCreds)) | |
| defer server2.Stop() |
This PR is the final PR for implementation of gRFC A101
This PR does the following :
AutoHostSniis set , or the SNI received from control plane. This is done because each endpoint can have a different hostname. It is not a config that can be used across all endpoints of the cluster , so it cannot be set in handshake info.AutoHostSnifiled to the handshake info.Note: We will turn the environment variable to true only after inter-op tests pass.
RELEASE NOTES: