Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xdsclient: ignore routes with cluster_specifier_plugin when GRPC_EXPERIMENTAL_XDS_RLS_LB is off #5670

Merged
merged 1 commit into from Sep 23, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 15 additions & 1 deletion xds/internal/xdsclient/xdsresource/unmarshal_rds.go
Expand Up @@ -361,8 +361,22 @@ func routesProtoToSlice(routes []*v3routepb.Route, csps map[string]clusterspecif
return nil, nil, fmt.Errorf("route %+v, action %+v, has no valid cluster in WeightedCluster action", r, a)
}
case *v3routepb.RouteAction_ClusterSpecifierPlugin:
// gRFC A28 was updated to say the following:
//
// The route’s action field must be route, and its
// cluster_specifier:
// - Can be Cluster
// - Can be Weighted_clusters
// - The sum of weights must add up to the total_weight.
// - Can be unset or an unsupported field. The route containing
// this action will be ignored.
//
// This means that if this env var is not set, we should treat
// it as if it we didn't know about the cluster_specifier_plugin
// at all.
if !envconfig.XDSRLS {
return nil, nil, fmt.Errorf("route %+v, has an unknown ClusterSpecifier: %+v", r, a)
logger.Infof("route %+v contains route_action with unsupported field: cluster_specifier_plugin, the route will be ignored", r)
continue
}
if _, ok := csps[a.ClusterSpecifierPlugin]; !ok {
// "When processing RouteActions, if any action includes a
Expand Down
6 changes: 3 additions & 3 deletions xds/internal/xdsclient/xdsresource/unmarshal_rds_test.go
Expand Up @@ -738,7 +738,7 @@ func (s) TestRDSGenerateRDSUpdateFromRouteConfiguration(t *testing.T) {
rlsEnabled: true,
},
{
name: "ignore-error-in-cluster-specifier-plugin",
name: "ignore-error-in-cluster-specifier-plugin-env-var-off",
rc: goodRouteConfigWithClusterSpecifierPlugins([]*v3routepb.ClusterSpecifierPlugin{
clusterSpecifierPlugin("cspA", configOfClusterSpecifierDoesntExist, false),
}, []string{}),
Expand All @@ -749,7 +749,7 @@ func (s) TestRDSGenerateRDSUpdateFromRouteConfiguration(t *testing.T) {
rc: goodRouteConfigWithClusterSpecifierPlugins([]*v3routepb.ClusterSpecifierPlugin{
clusterSpecifierPlugin("cspA", mockClusterSpecifierConfig, false),
}, []string{"cspA"}),
wantError: true,
wantUpdate: goodUpdate,
},
// This tests a scenario where a cluster specifier plugin is not found
// and is optional. Any routes referencing that not found optional
Expand Down Expand Up @@ -1545,7 +1545,7 @@ func (s) TestRoutesProtoToSlice(t *testing.T) {
ClusterSpecifier: &v3routepb.RouteAction_ClusterSpecifierPlugin{}}},
},
},
wantErr: true,
wantRoutes: []*Route{},
},
{
name: "default totalWeight is 100 in weighted clusters action",
Expand Down