-
Notifications
You must be signed in to change notification settings - Fork 689
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
add per-httpproxy http-version support #5802
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Adds HTTPVersions field to HTTPProxy spec. The field is used to specify ALPNProtocols on the corresponding tls context. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -502,7 +502,11 @@ func (c *ListenerCache) OnChange(root *dag.DAG) { | |
|
||
filters = envoy_v3.Filters(cm) | ||
|
||
alpnProtos = envoy_v3.ProtoNamesForVersions(cfg.DefaultHTTPVersions...) | ||
if len(vh.HTTPVersions) != 0 { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we need to make sure to have unit tests for this precedence behavior, i.e. when http versions are set in the virtualhost, they override the default |
||
alpnProtos = vh.HTTPVersions | ||
} else { | ||
alpnProtos = envoy_v3.ProtoNamesForVersions(cfg.DefaultHTTPVersions...) | ||
} | ||
} else { | ||
filters = envoy_v3.Filters(envoy_v3.TCPProxy(listener.Name, vh.TCPProxy, cfg.newSecureAccessLog())) | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we already have these constants defined in the ContourConfiguration struct (in v1alpha1) and the Contour config file, let's use the same values for them here for consistency:
Yes, this will then require a translation to the Envoy-accepted values, but we already have code for this in
cmd/contour/parseDefaultHTTPVersions
andinternal/envoy/v3/ProtoNamesForVersions
that we should be able to reuse, possibly with some refactoring required.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
parseDefaultHTTPVersions
converts from["HTTP/1.1", "HTTP/2"]
toHTTPVersionType
.The
ProtoNamesForVersions
function converts fromHTTPVersionType
to["http/1.1", "h2"]
.Note that the desired format for Envoy configuration is ["http/1.1", "h2"]. So, why use the ["HTTP/1.1", "HTTP/2"] format at all instead of directly using ["http/1.1", "h2"]? 😅
Additionally, those functions cannot be easily imported since they're private, or importing them leads to import cycles unless we move them into a util-like package.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment already answers my question. So thanks. I'll refactor.