-
Notifications
You must be signed in to change notification settings - Fork 490
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 Set field to HTTPRequestHeaderFilter #475
Conversation
Hi @nak3. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
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.
LGTM
// | ||
// Support: Extended | ||
// +optional | ||
Set map[string]string `json:"set,omitempty"` |
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.
+1 to this change.
One concern. Can most implementations differentiate between addition and override?
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.
From what I can tell, adding headers is pretty widely supported among other implementations, but setting/overwriting headers is certainly trickier. HAProxy has a very clear differentiation that would match this config closely (add-header and set-header). The distinction is less clear with nginx (add_header and proxy_set_header but defined in different modules), but fairly straightforward with envoy. and I think you might need a custom filter to overwrite a header with envoy.
With all that said, I think this is a good addition for the implementations that can support it, and the extended
support level feels appropriate.
/ok-to-test |
Thanks for this addition @nak3! We're still trying to figure out what we'd like to include in updates to the v1alpha1 API vs new work on the v1alpha2 API. We should be able to discuss this more at our community meeting next week. Until then, I'd like to hold this change to ensure we're not adding more than we want to to v1alpha1. /hold |
Envoy can do this easily, see `append` flag:
https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/core/v3/base.proto.html?highlight=headervalueoption#config-core-v3-headervalueoption
FWIW its part of Istio API as well.
…On Tue, Nov 24, 2020 at 10:02 AM Rob Scott ***@***.***> wrote:
Thanks for this addition @nak3 <https://github.com/nak3>! We're still
trying to figure out what we'd like to include in updates to the v1alpha1
API vs new work on the v1alpha2 API. We should be able to discuss this more
at our community meeting next week. Until then, I'd like to hold this
change to ensure we're not adding more than we want to to v1alpha1.
/hold
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#475 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAEYGXJFOCFHFLPOT7WSGFTSRPYLNANCNFSM4UA4AZTQ>
.
|
We discussed this a bit further yesterday and this seemed like a reasonable change. We also got #492 merged in yesterday which clarifies that we can make additive changes to an existing API. With that I think this is mostly good to go. /hold cancel |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: nak3, robscott The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
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 is very close. I've a couple of small documentation improvements.
apis/v1alpha1/httproute_types.go
Outdated
// | ||
// Input: | ||
// GET /foo HTTP/1.1 | ||
// My-Header: ABC |
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.
Can we lower case this?
Header field names are case-insensitive but keeping this example consistent throughout the documentation would be ideal.
// Support: Extended | ||
// +optional | ||
Set map[string]string `json:"set,omitempty"` | ||
|
||
// Add adds the given header (name, value) to the request |
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 now we have Add
and Set
, we should clarify here what happens when a header already exists in the Add
case.
@@ -456,16 +476,16 @@ type HTTPRequestHeaderFilter struct { | |||
// | |||
// Input: | |||
// GET /foo HTTP/1.1 | |||
// My-Header1: ABC | |||
// My-Header2: DEF | |||
// My-Header2: GHI |
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.
I believe this is a typo. Fixed by s/My-Header2/My-Heade3
in this PR.
apis/v1alpha1/httproute_types.go
Outdated
// | ||
// Output: | ||
// GET /foo HTTP/1.1 | ||
// my-header: foo bar |
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 seems incorrect. Header values are allowed to contain whitespaces.
The usual textual representation for multiple headers is:
// GET /foo HTTP/1.1
// my-header: foo
// my-header: bar
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.
Thank you! Updated.
/lgtm @jpeach How does #475 (comment) sound to you? We had discussed in the office hours to track the ordering bug separately. There is another minor thing where if the PR was based on the latest master then the PR description could add release notes. This is minor enough that we can ignore. |
@jpeach Friendly ping. Could you please check above comment? |
/hold cancel |
This patch adds
Set
field toHTTPRequestHeaderFilter
.Currently
Add
(append) andRemove
are available inHTTPRequestHeaderFilter. But it is not possible to overwrite a
header.