-
Notifications
You must be signed in to change notification settings - Fork 5
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
Refactor entire filter flow #161
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: Adam Cattermole <[email protected]> Signed-off-by: Alex Snaps <[email protected]>
Signed-off-by: Adam Cattermole <[email protected]>
Signed-off-by: Adam Cattermole <[email protected]>
Signed-off-by: Adam Cattermole <[email protected]>
fb8ac40
to
1698f79
Compare
Signed-off-by: Adam Cattermole <[email protected]>
Signed-off-by: Adam Cattermole <[email protected]>
Signed-off-by: Adam Cattermole <[email protected]>
Signed-off-by: Adam Cattermole <[email protected]>
Signed-off-by: Adam Cattermole <[email protected]>
Signed-off-by: Adam Cattermole <[email protected]>
Digest generates a Vec of operations we iterate over Signed-off-by: Adam Cattermole <[email protected]>
Signed-off-by: Adam Cattermole <[email protected]>
Signed-off-by: Adam Cattermole <[email protected]>
Signed-off-by: Adam Cattermole <[email protected]>
Signed-off-by: Adam Cattermole <[email protected]>
Signed-off-by: Adam Cattermole <[email protected]>
Signed-off-by: Adam Cattermole <[email protected]>
Signed-off-by: Adam Cattermole <[email protected]>
Signed-off-by: Adam Cattermole <[email protected]>
Signed-off-by: Adam Cattermole <[email protected]>
76c7e59
to
8a76515
Compare
Signed-off-by: Adam Cattermole <[email protected]>
I feel I'm not the right person to review this, as I've been kept in the loop all along. So needless to say its a 👍 from me. What might be useful is for people to use to PR to record and track (in issues?) what the agreed upon next steps would be? If this is an acceptable starting points for others too obviously. |
Changes
In this PR I've refactored the existing approach which had become somewhat unwieldy. I have tried to clean up the commits here, but it's worth noting this was an iterative process, and so some of the changes in the initial commits are changed/reverted in subsequent ones.
The main principle is as follows - I have aimed to reduce the leaking of the wasm/envoy hostcalls across every layer and instead delegate this to the filter. The filter has knowledge of the different 'phases' (
on_http_request.. on_grpc_call_response..
), and simply just performsOperations
based on it's current state and what it is being asked to do. The configuration itself remains unchanged, and the concerns of building and consuming of the specialised message types is delegated to the owner (auth_action/rl_action
). The filter has no knowledge of the individualactions
but instead uses theRuntimeActionSet
to initiate the flow, and from then on theOperations
to determine what to do next.Each of the operations tell the filter it must do something (that the layers below should not and do not know about):
SendGrpcRequest
: This informs the filter it needs to make a GRPC call and contains all of the the information it requires to make the request - the filter does not need to know which action/service this relates toAwaitGrpcResponse
: This tells the filter that there is nothing left to do within the current method and it must pause to await a GRPC responseAddHeaders
: This tells the filter it must add headers to the response in the required phaseDie
: This informs the filter that it is finished due to an error and must send a response before it finishes - this may not be an "error" due to a failure, but is also used for the case where we must return an error code to the caller (i.e. 401 Forbidden, 429 Too Many Requests..)Done
: This informs the filter that it has successfully finished operating and the request may be resumedThe specialised actions currently handle both the building of messages to the transfer type, and conversion to the message they expect. I have also made some decisions on how these actions return information to the layers above, based on the different operations the filter may have to perform.
Outstanding
There are several outstanding things to address (in follow up work):
set/get_property
calls, this would ideally be replaced with some kind of resolver layer with memoizationKuadrantFilter
,Operations
, andRuntimeActions
there was a need to retain the index of the current activeRuntimeAction
within someOperations
(to progress the flow). I would like to investigate eliminating this, potentially by building the chain ofOperations
up front (where each contains self + next). Another alternative might be implementing the iterator trait so we can just call.next()
to go through each