fix: auto detect upstream protocol#6792
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6792 +/- ##
==========================================
+ Coverage 71.02% 71.05% +0.02%
==========================================
Files 227 227
Lines 40331 40350 +19
==========================================
+ Hits 28645 28670 +25
+ Misses 9992 9987 -5
+ Partials 1694 1693 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
04c3d7c to
51bf619
Compare
|
hey @zirain can you also update the doc string in gateway/api/v1alpha1/tls_types.go Line 83 in 5ebc004 and add a breaking changes note in the release notes |
| MaxVersion: ptr.To(egv1a1.TLSv13), | ||
| MinVersion: ptr.To(egv1a1.TLSv13), | ||
| MaxVersion: ptr.To(egv1a1.TLSv13), | ||
| ALPNProtocols: []egv1a1.ALPNProtocol{"http/1.1"}, |
There was a problem hiding this comment.
can we verify, http/1.1 is being used here ?
There was a problem hiding this comment.
%UPSTREAM_PROTOCOL% will help here, need more work.
There was a problem hiding this comment.
it's tested here:
internal/xds/translator/cluster.go
Outdated
| for i, ds := range args.settings { | ||
| if ds.TLS != nil { | ||
| if !requiresAutoHTTPConfig && len(ds.TLS.ALPNProtocols) == 0 { |
There was a problem hiding this comment.
this means, if ALPN is set to h2, it won't actually connect over h2 (without setting applicationProtocol in the backend), is that right ?
There was a problem hiding this comment.
if alpnProtocols = [h2], requiresAutoHTTPConfig is false, it should be same as the old logic which means use h2.
what I missed?
There was a problem hiding this comment.
imo we should use this for the default case when tls is non nil
There was a problem hiding this comment.
Priority
- Use Client Protocol
- Force H2 using Backend App Protocol or GRPCRoute ( isHTTP2)
- TLS != nil (AutoTLS)
- Default ( H1)
| }, | ||
| }, | ||
| } | ||
| case requiresAutoHTTPConfig: |
There was a problem hiding this comment.
should this be above requiresHTTP1Options ?
There was a problem hiding this comment.
Also above http2 options, if that's the case, right?
There was a problem hiding this comment.
I don't think it should be above http2 options because of the priority is as following:
Priority
- Use Client Protocol
- Force H2 using Backend App Protocol or GRPCRoute ( isHTTP2)
- TLS != nil (AutoTLS)
- Default ( H1)
@arkodg previous priority didn't point out the case of explicit http1 settings.
requiresHTTP1Options := args.http1Settings != nil &&
(args.http1Settings.EnableTrailers || args.http1Settings.PreserveHeaderCase || args.http1Settings.HTTP10 != nil)
There was a problem hiding this comment.
yeah, I think this field should be renamed to hasHTTP1Options , and Auto tls should take precedence over it (it will also consume those http1 values)
There was a problem hiding this comment.
this PR won't be backported, let's discuss it in an seperated PR?
There was a problem hiding this comment.
right now if a user sets http1options and http2options in BTP for all routes, they cannot use auto TLS to decide the right proto to use per backend, which is why im recommending moving case requiresAutoHTTPConfig above case requiresHTTP1Options
There was a problem hiding this comment.
In that case, we might need more work about merge those options into auto.
That's why I proposal to do it in another PR, and also discuss guydc's comment.
| }, | ||
| }, | ||
| } | ||
| case requiresAutoHTTPConfig: |
There was a problem hiding this comment.
Also above http2 options, if that's the case, right?
Signed-off-by: zirain <zirain2009@gmail.com>
Signed-off-by: zirain <zirain2009@gmail.com>
Signed-off-by: zirain <zirain2009@gmail.com>
Signed-off-by: zirain <zirain2009@gmail.com>
Signed-off-by: zirain <zirain2009@gmail.com>
|
In another issue, we should clarify how this field works. For example, what happens when:
I don't think that we can perform any sort of validation in this case to stop users from configuring bad values, since this value has meaning in the context of a specific backend, e.g. proxy has backends that grpc while others require auto and others preservation. |
This PR changed the default behavior when you enabled tls on EnvoyProxy but without alpn.
Before:
typedExtensionProtocolOptionsunset, which means http1.After:
AutoHttpConfigenabled, which means: