Repository navigation
Add shared type HeaderName and use it for GRPCHeaderName, HTTPHeaderName and QueryParamMatchName - #1796
Conversation
|
@shaneutt Can you review it? Thanks. |
| // | ||
| // +kubebuilder:validation:MinLength=1 | ||
| // +kubebuilder:validation:MaxLength=256 | ||
| // +kubebuilder:validation:Pattern=`^[A-Za-z0-9!#$%&'*+\-.^_\x60|~]+$` |
There was a problem hiding this comment.
Was this pattern specifically pulled from a reference somewhere?
There was a problem hiding this comment.
Yes, I pulled this pattern from other names properties likes:
https://github.com/kubernetes-sigs/gateway-api/blob/main/apis/v1alpha2/httproute_types.go#L117
https://github.com/kubernetes-sigs/gateway-api/blob/main/apis/v1beta1/httproute_types.go#L350
https://github.com/kubernetes-sigs/gateway-api/blob/main/apis/v1alpha2/grpcroute_types.go#L414
There was a problem hiding this comment.
Can we use HTTPHeaderName as the type here instead of copying the regex? Would make this easier to maintain going forward.
robscott
left a comment
There was a problem hiding this comment.
Thanks @gyohuangxin! One tiny nit but otherwise LGTM.
| // | ||
| // +kubebuilder:validation:MinLength=1 | ||
| // +kubebuilder:validation:MaxLength=256 | ||
| // +kubebuilder:validation:Pattern=`^[A-Za-z0-9!#$%&'*+\-.^_\x60|~]+$` |
There was a problem hiding this comment.
Can we use HTTPHeaderName as the type here instead of copying the regex? Would make this easier to maintain going forward.
sunjayBhatia
left a comment
There was a problem hiding this comment.
generally seems right, but agree with @robscott's idea to not have to repeat the same regex pattern many places, i don't know if adding another layer of type aliasing would be what we want to do/even work as we intend but that might be an idea to explore (e.g GRPCHeaderName, HTTPHeaderName and query param match name all use the same underlying more neutrally-named type)
|
Thanks for your comments. Agreed with @sunjayBhatia , the better solution is to introduce a shared type like |
Yep sgtm, setting to draft to sort that out so this doesn't accidentally get merged 👍 |
Signed-off-by: Huang Xin <xin1.huang@intel.com>
…ame and QueryParamMatchName Signed-off-by: Xin Huang <xin1.huang@intel.com>
abafab3 to
d1202af
Compare
HeaderName and use it for GRPCHeaderName, HTTPHeaderName and QueryParamMatchName
Signed-off-by: Huang Xin <xin1.huang@intel.com>
|
@robscott Could you review this? Thanks |
shaneutt
left a comment
There was a problem hiding this comment.
Rob approved previously just with the caveat of the common type, we're all set thank you @gyohuangxin!!! 🥳
/lgtm
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: gyohuangxin, shaneutt, sunjayBhatia The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this?
/kind bug
What this PR does / why we need it:
Add pattern for query param name in HTTPQueryParamMatch like other items' names to avoid illegal names.
Which issue(s) this PR fixes:
Fixes #1729
Does this PR introduce a user-facing change?: