http: making http upstreams pluggable#11327
Conversation
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
mattklein123
left a comment
There was a problem hiding this comment.
At a high level this looks great. I left some comments. I would suggest we flesh out some config before going further? wdyt?
/wait
| // Called to cancel a call to newStream. Returns true if a newStream request | ||
| // was canceled, false otherwise. | ||
| virtual bool cancelAnyPendingRequest() PURE; |
There was a problem hiding this comment.
From an API perspective I would recommend having newStream() return a handle which can be cancelled? I think that would be cleaner and more future proof.
There was a problem hiding this comment.
I think if you're OK with it I'll do one PR just moving the APIs out and cleaning them up, then a follow-up doing factory and moving code around. I think if we do both in the same PR it's hard to see what's changing.
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
|
@htuch @mattklein123 just for the cluster config file @mattklein123 I think this is what we agreed on for a strawman on slack - lmk if I didn't understaodn |
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
| return Http::FilterHeadersStatus::StopIteration; | ||
| } | ||
|
|
||
| // TODO(alyssawilk) create from cluster config. |
There was a problem hiding this comment.
How could a Router::GenericConnPool created from cluster config?
The cluster doesn't even know if a filter requires Router::GenericConnPool, TcpProxy::GenericConnPool, or a WeirdConnPool.
My understanding the GenericConnPool is generic to the impl of ConnPool, but there is no such a generic conn pool interface for HttpConnManager, TcpProxy and Redis. Each above protocol has its individual GenericConnPool.
It might be more straighforward if you rename GenericConnPool to RouterGenericConnPool in below line
There was a problem hiding this comment.
Did the factory todo - take a look and let me know if you have further questions
There was a problem hiding this comment.
I think I was confused when I assume Router::GenericConnPool is going to replace the GenericConnPool in tcp proxy(the network filter, not the bool flag).
When I get rid of the assumption the code is clear. Thanks!
mattklein123
left a comment
There was a problem hiding this comment.
At a high level this LGTM, though I think we need more comments and docs. Do you mind doing that first just to make sure we agree on the end user config/docs? Thank you!
/wait
| // Required. The name of the upstream type | ||
| string name = 1; |
There was a problem hiding this comment.
You can use TypedExtensionConfig for this message and probably just remove UpstreamType
| // Optional customization and configuration of upstream type. | ||
| // By default, Envoy will create an upstream of type envoy.filters.upstreams.http.default | ||
| // The default upstream will create a envoy.filters.upstreams.http.tcp upstream | ||
| // if the request is a CONNECT request and connect termination is configured. | ||
| // Otherwise it will be envoy.filters.upstreams.http.http, with the protocol | ||
| // based on `http2_protocol_options`. |
There was a problem hiding this comment.
I think this is still going to confuse people, so I think it might be worth spelling this out even more, especially the last part about being based on http2_protocol_options. This is already a point of huge confusion.
| // if the request is a CONNECT request and connect termination is configured. | ||
| // Otherwise it will be envoy.filters.upstreams.http.http, with the protocol | ||
| // based on `http2_protocol_options`. | ||
| UpstreamType upstream_type = 48; |
There was a problem hiding this comment.
In terms of field name, I'm torn between being more specific here versus keeping this generic because I think ultimately we would want to use that for tcp_proxy also? Should the docs be more clear about which filters this applies to currently? This is what I was talking about re: cluster.proto being a mess. There are a huge amount of concepts convolved into one place and it's very confusing trying to understand what fields are used by what. I'm not saying we can fix this without a major version bump / major deprecation spree, but I think we probably need a lot more docs for this type of thing.
There was a problem hiding this comment.
I think we can reuse the proto for tcp proxy, but we'd have to use the different type if that's allowable. Basically for tcp proxy, it'd have to be a envoy.filters.upstreams.tcp since the interfaces are all different.
I'll comment that for today, this only works for http upstreams but is designed to be extended to custom tcp upstreams as well. SG?
There was a problem hiding this comment.
Right I agree that is how it would have to work, we just need to make sure it's super clearly documented, both here and probably also in the filter docs.
There was a problem hiding this comment.
So the plan is
UpstreamTypecould be reused by tcp_proxy, and- Another
UpstreamTypetyped field, e.g.tcp_proxy_upstream_type = 49can be added.
That make perfect sense to me and my other questions are resolved.
And UpstreamType or the updated TypedExtensionConfig works for tcp proxy case wrt proto api. Thanks!
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
mattklein123
left a comment
There was a problem hiding this comment.
Thanks this config LGTM at a high level. Do you want to finish up the change and then we can review further?
/wait
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
|
I suspect I need some more unit tests on this, but I think it's ready for another pass - will check out coverage build and work on that in parallel. |
Part 3 of envoyproxy#11327, using the new configuration to create the upstream connection pool. Risk Level: Medium (router refactor, intended as no-op) Testing: new unit tests Docs Changes: n/a Release Notes: pending final PR Signed-off-by: Alyssa Wilk <alyssar@chromium.org> Signed-off-by: yashwant121 <yadavyashwant36@gmail.com>
…11554) split out from envoyproxy#11327 There's a bit of transitive ugliness: declaring the extensions requires security posture, requires stub build files, requires codeowners before the code move, but it'll be pretty short lived. Risk Level: Low (mostly only APIs) Testing: n/a Docs Changes: some of the new docs Release Notes: n/a Signed-off-by: Alyssa Wilk <alyssar@chromium.org> Signed-off-by: yashwant121 <yadavyashwant36@gmail.com>
Moving the Generic class definitions into the include file, in preparation for pluggable upstreams split out from envoyproxy#11327 Risk Level: Low (mostly only header changes) Testing: n/a Docs Changes: n/a Release Notes: n/a Signed-off-by: Alyssa Wilk <alyssar@chromium.org> Signed-off-by: yashwant121 <yadavyashwant36@gmail.com>
Part 3 of envoyproxy#11327, using the new configuration to create the upstream connection pool. Risk Level: Medium (router refactor, intended as no-op) Testing: new unit tests Docs Changes: n/a Release Notes: pending final PR Signed-off-by: Alyssa Wilk <alyssar@chromium.org> Signed-off-by: yashwant121 <yadavyashwant36@gmail.com>
…11554) split out from envoyproxy#11327 There's a bit of transitive ugliness: declaring the extensions requires security posture, requires stub build files, requires codeowners before the code move, but it'll be pretty short lived. Risk Level: Low (mostly only APIs) Testing: n/a Docs Changes: some of the new docs Release Notes: n/a Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Moving the Generic class definitions into the include file, in preparation for pluggable upstreams split out from envoyproxy#11327 Risk Level: Low (mostly only header changes) Testing: n/a Docs Changes: n/a Release Notes: n/a Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Part 3 of envoyproxy#11327, using the new configuration to create the upstream connection pool. Risk Level: Medium (router refactor, intended as no-op) Testing: new unit tests Docs Changes: n/a Release Notes: pending final PR Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
This includes enhancing the script failures to leave breadcrumbs for devs who miss the new docs. Risk Level: n/a (tooling / docs) Testing: manual testing removing files from envoyproxy#11327 Docs Changes: yes Release Notes: no Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Mainly moving code, but finishes up the series of pluggable upstream PRs. Additional Description: This unhides the configurable extension point to the cluster for selecting a connection pool and creating an upstream, which can be used for custom business logic in upstream creation. Risk Level: medium (router refactor) Testing: with prior PRs Docs Changes: inline with APIs Release Notes: added Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
…11554) split out from envoyproxy#11327 There's a bit of transitive ugliness: declaring the extensions requires security posture, requires stub build files, requires codeowners before the code move, but it'll be pretty short lived. Risk Level: Low (mostly only APIs) Testing: n/a Docs Changes: some of the new docs Release Notes: n/a Signed-off-by: Alyssa Wilk <alyssar@chromium.org> Signed-off-by: yashwant121 <yadavyashwant36@gmail.com>
Moving the Generic class definitions into the include file, in preparation for pluggable upstreams split out from envoyproxy#11327 Risk Level: Low (mostly only header changes) Testing: n/a Docs Changes: n/a Release Notes: n/a Signed-off-by: Alyssa Wilk <alyssar@chromium.org> Signed-off-by: yashwant121 <yadavyashwant36@gmail.com>
Mainly moving code, but finishes up the series of pluggable upstream PRs.
Additional Description: This unhides the configurable extension point to the cluster for selecting a connection pool and creating an upstream, which can be used for custom business logic in upstream creation.
Risk Level: medium (router refactor)
Testing: with prior PRs
Docs Changes: inline with APIs
Release Notes: added