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

Conversation

zasweq
Copy link
Contributor

@zasweq zasweq commented Nov 2, 2021

This PR NACKs a missing route specifier server side, as it is required in Envoy. https://github.com/envoyproxy/envoy/blob/56e8c45b1b340c4a4f8f02ec2488354c31806d59/api/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.proto#L317. A nil route specifier actually caused a bug, as my RBAC HTTP Filter addition didn't have the correct logic when Route Specifier was nil (see #4924). Luckily, this situation is gatekeeped by the requirement that RouteSpecifier be present.

cc: @ejona86, @lidizheng

RELEASE NOTES: None

@zasweq zasweq requested a review from menghanl November 2, 2021 22:33
@zasweq zasweq added this to the 1.43 release milestone Nov 2, 2021
@@ -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.

@menghanl menghanl assigned zasweq and unassigned menghanl Nov 2, 2021
Copy link
Contributor Author

@zasweq zasweq left a comment

Choose a reason for hiding this comment

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

Thanks for the comments sir :D!

@@ -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 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.

@zasweq zasweq assigned menghanl and unassigned zasweq Nov 3, 2021
@zasweq zasweq merged commit c105005 into grpc:master Nov 3, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants