Skip to content

Commit

Permalink
Review comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
easwars committed Oct 6, 2020
1 parent 8bcbe48 commit 608af3c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 15 deletions.
2 changes: 1 addition & 1 deletion xds/internal/client/client.go
Expand Up @@ -222,7 +222,7 @@ type ClusterUpdate struct {
// EnableLRS indicates whether or not load should be reported through LRS.
EnableLRS bool
// SecurityCfg contains security configuration sent by the xDS server.
SecurityCfg SecurityConfig
SecurityCfg *SecurityConfig
}

// OverloadDropConfig contains the config to drop overloads.
Expand Down
6 changes: 3 additions & 3 deletions xds/internal/client/client_cds_test.go
Expand Up @@ -322,7 +322,7 @@ func (s) TestValidateClusterWithSecurityConfig(t *testing.T) {
wantUpdate: ClusterUpdate{
ServiceName: serviceName,
EnableLRS: false,
SecurityCfg: SecurityConfig{
SecurityCfg: &SecurityConfig{
RootInstanceName: rootPluginInstance,
RootCertName: rootCertName,
},
Expand Down Expand Up @@ -370,7 +370,7 @@ func (s) TestValidateClusterWithSecurityConfig(t *testing.T) {
wantUpdate: ClusterUpdate{
ServiceName: serviceName,
EnableLRS: false,
SecurityCfg: SecurityConfig{
SecurityCfg: &SecurityConfig{
RootInstanceName: rootPluginInstance,
RootCertName: rootCertName,
IdentityInstanceName: identityPluginInstance,
Expand Down Expand Up @@ -428,7 +428,7 @@ func (s) TestValidateClusterWithSecurityConfig(t *testing.T) {
wantUpdate: ClusterUpdate{
ServiceName: serviceName,
EnableLRS: false,
SecurityCfg: SecurityConfig{
SecurityCfg: &SecurityConfig{
RootInstanceName: rootPluginInstance,
RootCertName: rootCertName,
IdentityInstanceName: identityPluginInstance,
Expand Down
15 changes: 5 additions & 10 deletions xds/internal/client/client_xds.go
Expand Up @@ -407,20 +407,15 @@ func validateCluster(cluster *v3clusterpb.Cluster) (ClusterUpdate, error) {
return emptyUpdate, fmt.Errorf("xds: unexpected lbPolicy %v in response: %+v", cluster.GetLbPolicy(), cluster)
}

cu := ClusterUpdate{
ServiceName: cluster.GetEdsClusterConfig().GetServiceName(),
EnableLRS: cluster.GetLrsServer().GetSelf() != nil,
}
sc, err := securityConfigFromCluster(cluster)
if err != nil {
return emptyUpdate, err
}
if sc != nil {
// A valid Cluster resource could contain no security configuration
// (transport_socket field is nil). Hence we need a nil check here.
cu.SecurityCfg = *sc
}
return cu, nil
return ClusterUpdate{
ServiceName: cluster.GetEdsClusterConfig().GetServiceName(),
EnableLRS: cluster.GetLrsServer().GetSelf() != nil,
SecurityCfg: sc,
}, nil
}

// securityConfigFromCluster extracts the relevant security configuration from
Expand Down
2 changes: 1 addition & 1 deletion xds/internal/version/version.go
Expand Up @@ -45,6 +45,6 @@ const (
V3RouteConfigURL = "type.googleapis.com/envoy.config.route.v3.RouteConfiguration"
V3ClusterURL = "type.googleapis.com/envoy.config.cluster.v3.Cluster"
V3EndpointsURL = "type.googleapis.com/envoy.config.endpoint.v3.ClusterLoadAssignment"
V3HTTPConnManagerURL = "type.googleapis.com/envoy.config.filter.network.http_connection_manager.v2.HttpConnectionManager"
V3HTTPConnManagerURL = "type.googleapis.com/envoy.config.filter.network.http_connection_manager.v3.HttpConnectionManager"
V3UpstreamTLSContextURL = "type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.UpstreamTlsContext"
)

0 comments on commit 608af3c

Please sign in to comment.