-
Notifications
You must be signed in to change notification settings - Fork 480
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 ResponseHeaderModifier
to HTTPRouteFilter
#1373
Conversation
Hi @aryan9600. 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. |
/ok-to-test |
f9f739d
to
ba36f07
Compare
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 as long as well are all fine with moving this straight to beta (I vote yes to that).
apis/v1beta1/httproute_types.go
Outdated
@@ -571,8 +571,8 @@ type HTTPRouteFilter struct { | |||
// Reason of `UnsupportedValue`. | |||
// | |||
// +unionDiscriminator | |||
// +kubebuilder:validation:Enum=RequestHeaderModifier;RequestMirror;RequestRedirect;ExtensionRef | |||
// <gateway:experimental:validation:Enum=RequestHeaderModifier;RequestMirror;RequestRedirect;URLRewrite;ExtensionRef> | |||
// +kubebuilder:validation:Enum=RequestHeaderModifier;ResponseHeaderModifier;RequestMirror;RequestRedirect;ExtensionRef |
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.
Hmm, this line moves this feature straight into beta. It feels like it's probably okay to me, especially with the included conformance tests, but we should probably just be sure we all agree.
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.
Thanks @aryan9600! Mostly LGTM, just want to be sure that this is added as an experimental feature.
Moved this feature to experimental for now. |
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.
Thanks @aryan9600! This looks really close, just a few more comments.
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 think this looks solid, and I think it's an interesting addition: it will be interesting to see the usage reporting for this.
I'm approving, but I'll leave the LGTM to @robscott who was previously reviewing.
Thanks @aryan9600! /lgtm |
I'm trying to fix the issues causing CI to fail. It looks like #1390 modifies v1alpha2 to use v1beta1 definitions as aliases. Thus, running gateway-api/apis/v1alpha2/httproute_types.go Line 239 in 544d916
I could manually remove it but then this would need to be done every time someone runs |
Hey @aryan9600, this was a tricky one. From what I can tell, it requires a rebase on the main branch + the following changes: --- a/apis/v1alpha2/grpcroute_types.go
+++ b/apis/v1alpha2/grpcroute_types.go
@@ -427,7 +427,7 @@ type GRPCRouteFilter struct {
// Support: Core
//
// +optional
- RequestHeaderModifier *HTTPRequestHeaderFilter `json:"requestHeaderModifier,omitempty"`
+ RequestHeaderModifier *HTTPHeaderFilter `json:"requestHeaderModifier,omitempty"`
// RequestMirror defines a schema for a filter that mirrors requests.
// Requests are sent to the specified destination, but responses from
diff --git a/apis/v1alpha2/httproute_types.go b/apis/v1alpha2/httproute_types.go
index dfbabce..62ff375 100644
--- a/apis/v1alpha2/httproute_types.go
+++ b/apis/v1alpha2/httproute_types.go
@@ -292,10 +292,10 @@ const (
// +k8s:deepcopy-gen=false
type HTTPHeader = v1beta1.HTTPHeader
-// HTTPRequestHeaderFilter defines configuration for the RequestHeaderModifier
-// filter.
+// HTTPHeaderFilter defines a filter that modifies the headers of an HTTP request
+// or response.
// +k8s:deepcopy-gen=false
-type HTTPRequestHeaderFilter = v1beta1.HTTPRequestHeaderFilter
+type HTTPHeaderFilter = v1beta1.HTTPHeaderFilter After these changes, code generation appeared to work well for me locally. |
@robscott i don't think that'll work, since the problem arises due to gateway-api/apis/v1alpha2/httproute_types.go Line 240 in 544d916
since |
@aryan9600 I get the confusion now. That's actually exactly what we want to happen. It's not well documented, but standard practice with k8s APIs is to add all new fields to all supported API versions. In upstream Kubernetes, new fields are hidden with feature gates and are opt in. Since Gateway API is using CRDs, we came up with the parallel concept of an "experimental" release channel that gets new fields first. With that said, whether you're using CRDs from the experimental or standard release channel, both of the API versions contained within them should have an identical set of fields. |
@robscott got it, i was under the impression that we want the new field in the latest API version only. thanks for clarifying :) |
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
Thanks @aryan9600! /lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: aryan9600, robscott, shaneutt 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 |
What type of PR is this?
/kind feature
/kind api-change
What this PR does / why we need it:
This PR implements GEP-1323. It renames
HTTPRequestHeaderFilter
toHTTPHeaderFilter
and introduces a new fieldResponseHeaderModifier
inHTTPRouteFilter
. It also adds conformance tests for the same.Which issue(s) this PR fixes:
Relates to #1323
Does this PR introduce a user-facing change?: