Skip to content

Commit 8458251

Browse files
authored
xdsclient: ignore routes with cluster_specifier_plugin when GRPC_EXPERIMENTAL_XDS_RLS_LB is off (#5670)
1 parent a238ceb commit 8458251

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

xds/internal/xdsclient/xdsresource/unmarshal_rds.go

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,8 +361,22 @@ func routesProtoToSlice(routes []*v3routepb.Route, csps map[string]clusterspecif
361361
return nil, nil, fmt.Errorf("route %+v, action %+v, has no valid cluster in WeightedCluster action", r, a)
362362
}
363363
case *v3routepb.RouteAction_ClusterSpecifierPlugin:
364+
// gRFC A28 was updated to say the following:
365+
//
366+
// The route’s action field must be route, and its
367+
// cluster_specifier:
368+
// - Can be Cluster
369+
// - Can be Weighted_clusters
370+
// - The sum of weights must add up to the total_weight.
371+
// - Can be unset or an unsupported field. The route containing
372+
// this action will be ignored.
373+
//
374+
// This means that if this env var is not set, we should treat
375+
// it as if it we didn't know about the cluster_specifier_plugin
376+
// at all.
364377
if !envconfig.XDSRLS {
365-
return nil, nil, fmt.Errorf("route %+v, has an unknown ClusterSpecifier: %+v", r, a)
378+
logger.Infof("route %+v contains route_action with unsupported field: cluster_specifier_plugin, the route will be ignored", r)
379+
continue
366380
}
367381
if _, ok := csps[a.ClusterSpecifierPlugin]; !ok {
368382
// "When processing RouteActions, if any action includes a

xds/internal/xdsclient/xdsresource/unmarshal_rds_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,7 @@ func (s) TestRDSGenerateRDSUpdateFromRouteConfiguration(t *testing.T) {
738738
rlsEnabled: true,
739739
},
740740
{
741-
name: "ignore-error-in-cluster-specifier-plugin",
741+
name: "ignore-error-in-cluster-specifier-plugin-env-var-off",
742742
rc: goodRouteConfigWithClusterSpecifierPlugins([]*v3routepb.ClusterSpecifierPlugin{
743743
clusterSpecifierPlugin("cspA", configOfClusterSpecifierDoesntExist, false),
744744
}, []string{}),
@@ -749,7 +749,7 @@ func (s) TestRDSGenerateRDSUpdateFromRouteConfiguration(t *testing.T) {
749749
rc: goodRouteConfigWithClusterSpecifierPlugins([]*v3routepb.ClusterSpecifierPlugin{
750750
clusterSpecifierPlugin("cspA", mockClusterSpecifierConfig, false),
751751
}, []string{"cspA"}),
752-
wantError: true,
752+
wantUpdate: goodUpdate,
753753
},
754754
// This tests a scenario where a cluster specifier plugin is not found
755755
// and is optional. Any routes referencing that not found optional
@@ -1545,7 +1545,7 @@ func (s) TestRoutesProtoToSlice(t *testing.T) {
15451545
ClusterSpecifier: &v3routepb.RouteAction_ClusterSpecifierPlugin{}}},
15461546
},
15471547
},
1548-
wantErr: true,
1548+
wantRoutes: []*Route{},
15491549
},
15501550
{
15511551
name: "default totalWeight is 100 in weighted clusters action",

0 commit comments

Comments
 (0)