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

ext_proc: revise service api for attributes #32176

Merged
merged 14 commits into from
Feb 13, 2024

Conversation

jbohanon
Copy link
Contributor

@jbohanon jbohanon commented Feb 2, 2024

Commit Message: Revise service API to reflect changes discussed in #32125
Additional Description:
Risk Level: Low - feature merged very recently and has not been released
Testing:
Docs Changes:
Release Notes:
Platform Specific Features:
[Optional Runtime guard:]
[Optional Fixes #Issue]
[Optional Fixes commit #PR or SHA]
[Optional Deprecated:]
[Optional API Considerations:]

Copy link

CC @envoyproxy/api-shepherds: Your approval is needed for changes made to (api/envoy/|docs/root/api-docs/).
envoyproxy/api-shepherds assignee is @wbpcode
CC @envoyproxy/api-watchers: FYI only for changes made to (api/envoy/|docs/root/api-docs/).

🐱

Caused by: #32176 was opened by jbohanon.

see: more, trace.

@jbohanon
Copy link
Contributor Author

jbohanon commented Feb 2, 2024

cc @htuch @rshriram

@wbpcode
Copy link
Member

wbpcode commented Feb 5, 2024

#30747 #31090

Copy link
Member

@wbpcode wbpcode 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 you contribution. I taken a look to the dicussion and you previous PR. (But it's a little complex so I am not sure I get it correctly, feel free to point it out if I am wrong.)

I think if you want to revert (or partly revert)previous implementation, you should add the [#not-implemented-hide:] back to the request_attributes and response_attributes because you may want to change the behavior in the implementation.

Actually, if we haven't figured out a final solution or API, we should just revert previous two implementation commits directly. It would be more clean. cc @htuch

@rshriram
Copy link
Member

rshriram commented Feb 5, 2024

@wbpcode I dont think we need to revert any changes from previous PRs. If we agree on just moving the attributes outside the HttpHeaders message, then this API change becomes much simpler and the implementation should require only minor changes (populate ProcessingRequest.attributes instead of ProcessingRequest.request|response_headers.attributes) on top of the code in #31090.

@@ -110,8 +110,19 @@ message ProcessingRequest {
HttpTrailers response_trailers = 7;
}

// [#not-implemented-hide:]
// TODO(jbohanon) reserve field as part of rework detailed in https://github.com/envoyproxy/envoy/issues/32125
Copy link
Member

Choose a reason for hiding this comment

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

@htuch , per discussion in the issue thread, shall we just keep this field as it is, maintaining a clear separation between attributes derived from the connection/request/resp vs those pushed through config or internal state?

@wbpcode
Copy link
Member

wbpcode commented Feb 5, 2024

@wbpcode I dont think we need to revert any changes from previous PRs. If we agree on just moving the attributes outside the HttpHeaders message, then this API change becomes much simpler and the implementation should require only minor changes (populate ProcessingRequest.attributes instead of ProcessingRequest.request|response_headers.attributes) on top of the code in #31090.

Yeah. But the premise is we can agree on with all the API changes (attributes and metadata context) and complete the code and test updates in the windows. (Today may the last day?)

And from my perspective, this PR seems more like a partly reverting rather than refactoring, for now.

Considering the time windows, I still suggest you revert the previous commits and we can merge the reverting directly. Then you can create a new PR for these features immediately.

Or we must act very quickly.

@wbpcode
Copy link
Member

wbpcode commented Feb 5, 2024

/assign @htuch

@wbpcode
Copy link
Member

wbpcode commented Feb 5, 2024

Another solution is defer the metadata_contexr related changes to another PR, because it was merged at one week ago and still has one week time to update it.

Then this PR could only update the attributes implementation (like the @rshriram 's suggestion) and API which would LGTM to me.

@jbohanon
Copy link
Contributor Author

jbohanon commented Feb 5, 2024

I have updated this to be more tightly-scoped to the attributes fields. I agree that reverting the committed code is not necessary. The discussion around the field metadata_context is still ongoing in the issue thread, but moving attributes up to be a first-class field in the ProcessingRequest message is not controversial.

Signed-off-by: Jacob Bohanon <[email protected]>
@wbpcode
Copy link
Member

wbpcode commented Feb 6, 2024

/retest

@wbpcode
Copy link
Member

wbpcode commented Feb 6, 2024

@jbohanon LGTM to the API, and please update the implementation.

Here is the timeline:

2024/01/24: merged the feature of the request_attributes and response_attributes. This attributes will be add to the attributes in the headers field.

Now, if you want to move the attributes to the ProcessingRequest, you should complete all refactoring (include API and implementation) before 2024/02/07.

@jbohanon
Copy link
Contributor Author

jbohanon commented Feb 6, 2024

Now, if you want to move the attributes to the ProcessingRequest, you should complete all refactoring (include API and implementation) before 2024/02/07.

Sounds good. For my education, where is the two-week contract specified?

…ath, not just with headers messages

Signed-off-by: Jacob Bohanon <[email protected]>
@jbohanon
Copy link
Contributor Author

jbohanon commented Feb 6, 2024

Possible implementation put up here: jbohanon#1

I can pull those changes into this PR if desired, but I still need to work on the tests

@wbpcode
Copy link
Member

wbpcode commented Feb 6, 2024

Now, if you want to move the attributes to the ProcessingRequest, you should complete all refactoring (include API and implementation) before 2024/02/07.

Sounds good. For my education, where is the two-week contract specified?

https://github.com/envoyproxy/envoy/blob/main/api%2FAPI_VERSIONING.md

From this API guiding, we can only do a break change to exist API in two weeks after it is merged or it's marked as WIP.

Now you want to abort the attributes in the header message directly, IMO, it is like a break change. 🤔 So the two weeks windows should be adaptive to this case.

@wbpcode
Copy link
Member

wbpcode commented Feb 6, 2024

I also noticed that the attributes is existing for a long time and still be marked as not-implement-hide. (But in fact it is be used in your previous PR.)
So, I am not sure if we can treat this as special case. 🤔

@rshriram
Copy link
Member

rshriram commented Feb 6, 2024

@wbpcode that is precisely the reason we are doing this change now and trying to remove the HttpHeaders.attributes because that field was never implemented till now. So we have the ability to make this breaking change.

Copy link
Member

@rshriram rshriram left a comment

Choose a reason for hiding this comment

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

LGTM
Thank you so much for acting quickly.

Signed-off-by: Jacob Bohanon <[email protected]>
htuch
htuch previously approved these changes Feb 7, 2024
Copy link
Member

@htuch htuch left a comment

Choose a reason for hiding this comment

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

LGTM. To be clear, the headers attributes field was never marked not [#not-implemented-hide:] (it's unchanged on line 206 above). So, from a stable API perspective it was never a stable field :)

@repokitteh-read-only repokitteh-read-only bot removed the api label Feb 7, 2024
@jbohanon
Copy link
Contributor Author

jbohanon commented Feb 7, 2024

Thanks @htuch. I am working through the integration test updates now and will ping again once everything is green on CI.

There was an outstanding question on jbohanon#1 re: simply reserving this field that was never marked as stable/implemented. What do you think of that?

Copy link
Member

@wbpcode wbpcode left a comment

Choose a reason for hiding this comment

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

LGTM to the code. Could you check the integration tests? Seems that the error may is related to this PR.

Signed-off-by: Jacob Bohanon <[email protected]>
@jbohanon
Copy link
Contributor Author

jbohanon commented Feb 8, 2024

@htuch @wbpcode Thanks for the reviews. I have fixed up the integration test and am ready for another 👀

wbpcode
wbpcode previously approved these changes Feb 9, 2024
Copy link
Member

@wbpcode wbpcode left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks.

@repokitteh-read-only repokitteh-read-only bot removed the api label Feb 9, 2024
@rshriram
Copy link
Member

rshriram commented Feb 9, 2024

@jbohanon one question. Our API says request_attributes and response_attributes. What about the connection.* attributes documented here (https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/advanced/attributes) ? Does the code reject those?

@rshriram
Copy link
Member

rshriram commented Feb 9, 2024

Put another way, should we just have a generic attributes repeated field in ext_proc filter instead of request and response attributes that does not seem to add any real value, as the wire proto has all attributes in one bag.

@jbohanon
Copy link
Contributor Author

jbohanon commented Feb 9, 2024

@jbohanon one question. Our API says request_attributes and response_attributes. What about the connection.* attributes documented here (https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/advanced/attributes) ? Does the code reject those?

@rshriram the qualifier in front of _attributes specifies when that list is sent, not what attribute prefixes are accepted. It is the case that connection.* attributes are available on the request path, but it is not the case that response.* attributes are available on the request path. Keeping them separated allows users to list sensible attributes, and just those which they need, for the different request and response processing requests.

@rshriram
Copy link
Member

rshriram commented Feb 9, 2024

so if I set BOTH request_attributes and response attributes in ext_proc filter to the following,
request.host, source.address, response.code

what happens during request headers/body events and response headers/body events?

Can I assume that there will be exactly ONe copy of request.host, source.address in ProcessingRequest.attributes for request headers/body calls and exactly ONE copy of request.host, source.address, response.code in ProcessingRequest.attributes for response headers/body calls?

@jbohanon
Copy link
Contributor Author

jbohanon commented Feb 9, 2024

so if I set BOTH request_attributes and response attributes in ext_proc filter to the following, request.host, source.address, response.code

what happens during request headers/body events and response headers/body events?

Can I assume that there will be exactly ONe copy of request.host, source.address in ProcessingRequest.attributes for request headers/body calls and exactly ONE copy of request.host, source.address, response.code in ProcessingRequest.attributes for response headers/body calls?

Correct, given:

ExternalProcessor:
  request_attributes:
    - request.host
    - source.address
    - response.code
  response_attributes:
    - request.host
    - source.address
    - response.code

There will be exactly ONE copy of request.host and source.address, and exactly ZERO copies of response.code in the ProcessingRequest.attributes for request headers/body/trailers processing calls. There will be exactly ONE copy of request.host and source.address, and response.code in the ProcessingRequest.attributes for response headers/body/trailers processing calls.

I added a test to validate that the unavailable attribute is not included.

@yanavlasov yanavlasov self-assigned this Feb 12, 2024
@yanavlasov yanavlasov merged commit 32dd294 into envoyproxy:main Feb 13, 2024
53 of 54 checks passed
jbohanon added a commit to solo-io/envoy-fork that referenced this pull request Feb 28, 2024
jbohanon added a commit to solo-io/envoy-fork that referenced this pull request Mar 1, 2024
jbohanon added a commit to solo-io/envoy-fork that referenced this pull request Mar 12, 2024
* ext_proc: send attributes (envoyproxy#31090)

Introduce the ability to send attributes in the External Processing Request

---------

Signed-off-by: Jacob Bohanon <[email protected]>

* ext_proc: send and receive dynamic metadata (envoyproxy#30747)

Introduce the ability to send dynamic metadata in the External Processing Request. Also implements the API for returning dynamic metadata as part of the External Processing Response.

---------

Signed-off-by: Jacob Bohanon <[email protected]>

* ext_proc: revise service api for attributes (envoyproxy#32176)


---------

Signed-off-by: Jacob Bohanon <[email protected]>

---------

Signed-off-by: Jacob Bohanon <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants