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

xds: NACK missing route specifier server side #4925

Merged
merged 2 commits into from
Nov 3, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions xds/internal/xdsclient/filter_chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -637,8 +637,7 @@ func processNetworkFilters(filters []*v3listenerpb.Filter) (*FilterChain, error)
}
filterChain.InlineRouteConfig = &routeU
case nil:
// No-op, as no route specifier is a valid configuration on
// the server side.
return nil, fmt.Errorf("no RouteSpecifier: %+v", hcm)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this specified anywhere? In the gRFC or somewhere else?
I'm wondering why we thought it's OK to be nil.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And it would be OK to delete this case? The default below would then handle nil.

Copy link
Contributor

@menghanl menghanl Nov 2, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, we should probably keep that. The client side returns a special error for nil

case nil:
return nil, fmt.Errorf("no RouteSpecifier: %+v", apiLis)

Change the comment of these two fields to exactly one of RouteConfigName and InlineRouteConfig is set?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the processing of the Route Configuration was added due to RBAC A36 has language on validations once Route Configuration is processed server side. However, there was no explicit language on a nil RouteSpecifier/a missing Route Configuration (usually when RDS fails, which after talking with Eric we have the right behavior which is to ACK resource, but RPC's fail (no calling goodupdate.Fire()). However, all my RBAC code didn't handle the case of a nil RouteSpecifier, which lead to issue #4924. Luckily, Eric pointed to the fact that the RouteSpecifier is in fact required in the Envoy proto: https://github.com/envoyproxy/envoy/blob/56e8c45b1b340c4a4f8f02ec2488354c31806d59/api/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.proto#L317, so this fix fixes the bug in RBAC implementation as well. Changed comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One thing I mentioned in the issue thread I think is important to bring up, is that I think that NACKing a missing RouteSpecifier is fair for users since the addition of RBAC added the addition of a valid route configuration (matching vh + route) for RPC's to proceed normally, and this will communicate to them the delta they need to make in their control plane resources. Especially if we enable RBAC by default.

default:
return nil, fmt.Errorf("unsupported type %T for RouteSpecifier", hcm.RouteSpecifier)
}
Expand Down
34 changes: 34 additions & 0 deletions xds/internal/xdsclient/filter_chain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -770,6 +770,40 @@ func TestNewFilterChainImpl_Failure_BadRouteUpdate(t *testing.T) {
lis *v3listenerpb.Listener
wantErr string
}{
{
name: "missing-route-specifier",
lis: &v3listenerpb.Listener{
FilterChains: []*v3listenerpb.FilterChain{
{
Name: "filter-chain-1",
Filters: []*v3listenerpb.Filter{
{
Name: "hcm",
ConfigType: &v3listenerpb.Filter_TypedConfig{

TypedConfig: testutils.MarshalAny(&v3httppb.HttpConnectionManager{
HttpFilters: []*v3httppb.HttpFilter{emptyRouterFilter},
}),
},
},
},
},
},
DefaultFilterChain: &v3listenerpb.FilterChain{
Filters: []*v3listenerpb.Filter{
{
Name: "hcm",
ConfigType: &v3listenerpb.Filter_TypedConfig{
TypedConfig: testutils.MarshalAny(&v3httppb.HttpConnectionManager{
HttpFilters: []*v3httppb.HttpFilter{emptyRouterFilter},
}),
},
},
},
},
},
wantErr: "no RouteSpecifier",
},
{
name: "not-ads",
lis: &v3listenerpb.Listener{
Expand Down