-
Notifications
You must be signed in to change notification settings - Fork 658
v0.7.0 API Review #1923
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
v0.7.0 API Review #1923
Conversation
|
Skipping CI for Draft Pull Request. |
| // +kubebuilder:validation:Pattern=`^[A-Za-z0-9!#$%&'*+\-.^_\x60|~]+$` | ||
| // +k8s:deepcopy-gen=false | ||
| type HTTPHeaderName = v1beta1.HTTPHeaderName | ||
| type HTTPHeaderName = v1beta1.HeaderName |
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.
Why did we drop HTTP from this?
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.
Looks like because of the above change to make the GRPC variant type GRPCHeaderName v1beta1.HeaderName instead of its own string alias?
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.
Yep, this was trying to ensure that our types and validation were consistent since by definition a GRPC Header name is going to have the same validation and constraints as HTTP.
| // +kubebuilder:validation:Pattern=`^[A-Za-z0-9!#$%&'*+\-.^_\x60|~]+$` | ||
| type HTTPHeaderName string | ||
| // - "/invalid" - "/ " is an invalid character | ||
| type HTTPHeaderName HeaderName |
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.
Curious about this indirection?
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 part a larger effort to ensure that our types and validation are consistent across GRPC and HTTP Routes. Leaving the "HTTPHeaderName" in place for backwards compat.
khenidak
left a comment
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.
Minor comments, otherwise this looks fine.
| // | ||
| // Support: Core for Kubernetes Service | ||
| // | ||
| // Support: Extended for Kubernetes ServiceImport |
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.
Nit: While we all understand what ServiceImport is, a new reader may not. So better to call out that these are objects.
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.
Same comment applies in a lot of places.
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.
To clarify, are you saying that "Extended for Kubernetes ServiceImport" should be replaced with "Extended for Kubernetes ServiceImport Objects", would the same be true for "Core for Kubernetes Service Objects"? I'm not that familiar with the proper terminology here, but would "Resource(s)" work as well?
| for i, m := range matches { | ||
| if m.Method != nil && m.Method.Service == nil && m.Method.Method == nil { | ||
| errs = append(errs, field.Required(path.Index(i).Child("method"), "one or both of `service` or `method` must be specified")) | ||
| if m.Method != nil { |
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 m.Method == nil if so, is it a valid object?
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.
Yep, it's optional, but there is defaulting involved so it seems unlikely/impossible that this would ever be empty.
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.
We often add the else ... field.Required() to these - it has helped prevent tests that passed whjen they shouldn't.
| // Implementations SHOULD NOT add the port number in the 'Location' | ||
| // header in the following cases: | ||
| // | ||
| // * A Location header that will use HTTP (whether that is determined via |
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 _and_ construct will not work as expected this file will be viewed by code editors which generally don't do Markdown.
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.
Maybe you meant to comment on a different line, I can't find an _and_ here. In general we're trying to ensure https://gateway-api.sigs.k8s.io/references/spec/ is readable, and in that case basic markdown formatting is effective.
| protocol := listener.Protocol | ||
| port := listener.Port | ||
| hostnameProtocolPort := fmt.Sprintf("%s:%s:%d", *hostname, protocol, port) | ||
| if hostnameProtocolPortSets.Has(hostnameProtocolPort) { |
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.
a map[string]struct{}{} will be better here.
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 the k8s set util that we're using here is roughly doing the same thing but has a nicer interface to work with (https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apimachinery/pkg/util/sets/set.go#L24). Anything I'm missing?
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 found some places still use map instead of k8s set, such as https://github.com/kubernetes-sigs/gateway-api/blob/main/apis/v1beta1/validation/gateway.go#L129, https://github.com/kubernetes-sigs/gateway-api/blob/main/apis/v1beta1/validation/httproute.go#L110. I think we can unify them.
|
/approve Thanks for this. |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: khenidak, robscott 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 |
thockin
left a comment
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, just a few minor nits on re-scan
thockin
left a comment
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, just a few minor nits on re-scan
|
/lgtm to make it real |
|
Thanks everyone for the reviews! v0.7.0 has been released, closing this out. |
What type of PR is this?
/kind feature
What this PR does / why we need it:
This PR is for the purpose of reviewing the v0.7.0 release. It compares the
/apisdir from themainbranch to the/apisdir on the release-0.6 branch. This is to avoid distracting the PR with all the docs, GEP, and test changes that have also occurred in the same time. This PR is not intended to merge, instead is meant purely to facilitate API review./cc @bowei @shaneutt @youngnick
/assign @khenidak @thockin