-
Notifications
You must be signed in to change notification settings - Fork 472
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
Implementing GEP 724: Refresh Route-Gateway Binding #754
Implementing GEP 724: Refresh Route-Gateway Binding #754
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: 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 |
9dbb75c
to
0366715
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
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.
first pass, looking good
apis/v1alpha2/tcproute_types.go
Outdated
@@ -41,17 +41,29 @@ type TCPRoute struct { | |||
|
|||
// TCPRouteSpec defines the desired state of TCPRoute | |||
type TCPRouteSpec struct { | |||
// ParentRefs references the resources that can attach to this Route. The |
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.
// ParentRefs references the resources that can attach to this Route. The
Instead of resources, just use Gateway for now. Optimize for the vast majority.
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.
Rewrote a good chunk of this, hopefully it's clearer now.
0366715
to
1e7538a
Compare
1e7538a
to
052bf1f
Compare
1edfec1
to
5a758ad
Compare
// | ||
// +kubebuilder:validation:MinLength=1 | ||
// +kubebuilder:validation:MaxLength=253 | ||
Kind string `json:"kind"` |
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.
Is there a status that should be set if the Kind is invalid or something?
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.
That's a great question, but unfortunately I don't have a good answer. This is one of the many situations where it would be unclear which controller was responsible for communicating that status. Of course every controller only knows the resources it supports, not what other implementations may support. I think the best indication of this for now would just be if this resource was missing from the RouteParents
status altogether since no controller would have added it.
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.
// Kind MUST correspond to kinds of Routes that are compatible with the // application protocol specified in the Listener's Protocol field. If an // implementation does not support or recognize this resource type, it // SHOULD set the "ResolvedRefs" condition to false for this listener with // the "InvalidRoutesRef" reason.
ListenerRoutes
says this case should raise a status condition (on the gateway).
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.
Oh woops, I misinterpreted this as a question about an invalid ref from a Route to a Gateway. The answer from @jpeach is completely correct for what was actually being asked here.
5a758ad
to
2a686f0
Compare
Thanks for the great feedback on this @stevesloka @hbagdi and @howardjohn! I think I've responded to everything now, PTAL. I'm planning on covering docs and additional examples in a follow up PR so this one doesn't become too massive. |
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 overall
apis/v1alpha2/gateway_types.go
Outdated
// +optional | ||
Hostname *Hostname `json:"hostname,omitempty"` | ||
SupportedKinds []RouteGroupKind `json:"supportedKinds,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.
So if this field is not optional, does it mean minItem=1 is automatically imposed? Probably not.
What is the reason for not adding minItem=1 here?
// | ||
// +optional | ||
Hostname *Hostname `json:"hostname,omitempty"` | ||
// +kubebuilder:validation:MaxItems=8 |
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.
// +kubebuilder:validation:MaxItems=8 | |
// +kubebuilder:validation:MaxItems=16 |
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.
At present we only have 4 valid Route kinds, and it's unlikely/impossible that they'd all be valid for a given listener. We can always increase this limit in the future if needed, but I'd be hesitant to start too high here.
// | ||
// Support: Core | ||
Kind string `json:"kind"` | ||
// +kubebuilder:validation:MaxItems=8 |
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.
// +kubebuilder:validation:MaxItems=8 | |
// +kubebuilder:validation:MaxItems=16 |
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 as above.
SupportedKinds []RouteGroupKind `json:"supportedKinds,omitempty"` | ||
|
||
// AttachedRoutes represents the total number of Routes that have been | ||
// successfully attached to this Listener. |
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.
// successfully attached to this Listener. | |
// successfully attached to this Listener. | |
// | |
// +kubebuilder:validation:Minimum=1 |
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.
Isn't it valid for this to be 0? No guarantee that a Route will be attached to a Listener.
Looks great, just a few nits to tidy up 👍 |
// Support: Core | ||
// | ||
// +kubebuilder:validation:MaxLength=253 | ||
Name string `json:"name"` |
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.
You might want to restrict the name a little more, for example with +kubebuilder:validation:Pattern=`^[0-9A-Za-z_-]+$`
.
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.
TIL, I didn't know this was even possible.
Out of scope of this PR, should we use this in most 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.
Yeah I've been thinking this would be a good time to introduce some standard regex validation for these fields as part of v1alpha2.
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.
Added #767
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 completely agree that we should do this, but want to leave this for a follow up PR so we can establish consistent regexes for different types of fields. #767 is in the v1alpha2 milestone so we can make sure it gets in.
apis/v1alpha2/shared_types.go
Outdated
// ParentRef is a reference to the parent resource that the route wants to | ||
// be attached to. |
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 status—it should report actual state, not desired state.
// ParentRef is a reference to the parent resource that the route wants to | |
// be attached to. | |
// ParentRef is a reference to the parent resource that the route is attached to. |
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 was actually an intentional distinction. We want status to include entries for each parent the Route wants to be attached to so there is a way to explain when an attachment is not allowed and/or being prevented for some reason.
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.
// ParentRef is a reference to the parent resource that the route wants to | |
// be attached to. | |
// ParentRef is a reference to the parent resource to which the route's spec | |
// requests to be attached. |
Maybe this? Reads a little awkward, I think.
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.
Agree it was confusing. I took another shot at this, let me know what you think
// Otherwise, if an alternative API group is desired, specify the desired | ||
// group: | ||
|
||
// Kinds specifies the groups and kinds of Routes that are allowed to bind |
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.
// Kinds specifies the groups and kinds of Routes that are allowed to bind | |
// Kinds specifies the groups and kinds of Routes that are allowed to attach |
for consistency and to save me from wondering whether "bind" and "attach" mean different things... which they don't, right?
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.
Not intended to mean anything different, just ended up having more attach
terminology in the godocs this time around because the field started with an attachTo
name.
3843d86
to
90ebdde
Compare
90ebdde
to
bad1af9
Compare
Thanks for the great feedback on this PR! I think I've addressed everything now, PTAL. |
Only a few small nits from me, LGTM otherwise. |
Thanks for the feedback @youngnick! PTAL. |
/lgtm |
What type of PR is this?
/kind feature
What this PR does / why we need it:
Implements GEP #724
Which issue(s) this PR fixes:
Fixes #724
Does this PR introduce a user-facing change?:
Note: This PR does not include any docs yet. I will follow up with that either in this PR or a follow up.