-
Notifications
You must be signed in to change notification settings - Fork 145
v1.0 InferencePool API Review #1173
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
base: release-0.5
Are you sure you want to change the base?
v1.0 InferencePool API Review #1173
Conversation
Hi @capri-xiyue. 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-sigs/prow repository. |
/hold |
✅ Deploy Preview for gateway-api-inference-extension ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
5317094
to
4ffb5f6
Compare
/hold, this should not get merged |
77371fe
to
4ffb5f6
Compare
Note: This PR is NOT intended to merge, it is entirely for the purpose of API review. |
apix/v1/inferencepool_types.go
Outdated
// associated with the InferencePool, and the status of the InferencePool with respect to | ||
// each parent. | ||
// | ||
// A maximum of 32 Gateways will be represented in this list. When the list contains |
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 do not understand the comment about "kind: Status, name: default" -- where are those fields? They are not in PoolStatus
.
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 also don't understand why you need a canary entry to signal "nothing to see" -- why is an empty list not sufficient? I find the imposition on the controllers to be very awkward.
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 copied from Gateway API. Generally k8s users don't seem to treat the absence of status as a bad thing, so they may not realize their InferencePool is not being used/referenced.
This is particularly useful in Gateways where you made a typo on gatewayClass
and nothing picks up/implements your Gateway. Having a baseline signal that a Gateway is waiting for a controller to pick it up is useful.
A similar pattern is useful for Routes if you make a typo referring to a Gateway - there's no controller empowered to warn you of this since each Gateway controller only populates status on Routes that are attached to their Gateway. If there's a reference to a nonexistent Gateway, there's nothing to warn you about that other than some kind of default status.
With that said, this doesn't seem quite as useful on InferencePool. If someone makes a typo when pointing a route to an InferencePool, they'll get a warning in the status of that Route. This status can be useful in indicating that the InferencePool has not actually been implemented yet, but an empty list may suffice here.
cc @danehans
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 do like the explicitness of the current approach, but I don't have a strong opinion 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'd make it as resolved for now seems the majority is ok with the current approach. Feel free to re-open it if further discussion is needed.
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 find this very brittle and awkward. Doesn't this argue instead for something like an MAP which detects an empty list and inserts the canary?
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.
xref kubernetes-sigs/gateway-api#3738 for adding a similar default status condition to HTTPRoute.
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.
As a quick update from Slack - we discussed this and decided to remove the defaulting for now. In the corresponding Gateway issue we've been looking into MAP as a potential solution as well. Although it's not clear that will work as we'd like, I think it makes sense to hold off on this until we have more time to look into a MAP-based solution.
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 I resolve this with the agreement to remove the defaulting 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.
#1427 is removing the defaulting.
/reopen |
@capri-xiyue: Reopened this PR. In response to this:
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-sigs/prow 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.
I am LGTM except for a few nits
apix/v1/inferencepool_types.go
Outdated
// +listType=map | ||
// +listMapKey=type | ||
// +kubebuilder:validation:MaxItems=8 | ||
// +kubebuilder:default={{type: "Accepted", status: "Unknown", reason:"Pending", message:"Waiting for controller", lastTransitionTime: "1970-01-01T00:00:00Z"}} |
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 this right? I don't understand 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.
I will further update it once #1427 gets merged.
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.
#1427 removes the status condition defaulting.
I lost the comment thread, but I believe I saw something along the lines of:
If that's the case, you can set KALs config for Omitzero support is only for structs in KAL right now, and with it set to forbid, it will force the omitempty route with a pointer for all optional structs |
FYI #1427 is a PR under review that implements several API changes based on feedback from API reviewers here and discussions among the community, maintainers, etc. |
@thockin the challenge I see with inlining is that no field by itself can be used as the map key: type ParentReference struct {
// Group is the group of the referent API object. When unspecified, the referent is assumed
// to be in the "gateway.networking.k8s.io" API group.
//
// +optional
// +kubebuilder:default="gateway.networking.k8s.io"
Group *Group `json:"group,omitempty"`
// Kind is the kind of the referent API object. When unspecified, the referent is assumed
// to be a "Gateway" kind.
//
// +optional
// +kubebuilder:default=Gateway
Kind *Kind `json:"kind,omitempty"`
// Name is the name of the referent API object.
//
// +required
Name ObjectName `json:"name,omitempty"`
// Namespace is the namespace of the referenced object. When unspecified, the local
// namespace is inferred.
...
// +optional
Namespace *Namespace `json:"namespace,omitempty"`
} All fields are needed to ensure the uniqueness of a parent. |
I tried it, with omitzero forbid, https://github.com/kubernetes-sigs/gateway-api-inference-extension/pull/1438/files#diff-8d7db842a7673f66c7db001de9fe07ce67b67e21d8cbce12394fde46eea1e5b7R36 I still need ignore kubeapi linter otherwise it will also show |
@capri-xiyue: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. 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-sigs/prow repository. I understand the commands that are listed here. |
Kind is not a struct, it is a string. You have a non-zero minimum length marker on kind so why do we need it to be a pointer? The string being empty implies to the go client that it wasn't present when admitted |
// Status defines the observed state of the InferencePool. | ||
// | ||
// +optional | ||
//nolint:kubeapilinter // status should not be a pointer. |
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 not? It's the same as any other struct
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 followed the existing k8s convention. See https://github.com/kubernetes/api/blob/master/batch/v1/types.go#L84
// | ||
// +optional | ||
// +kubebuilder:default=Service | ||
//nolint:kubeapilinter // ignore kubeapilinter here as we want to use pointer for optional struct. |
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.
It's a string, not a struct, this should not be ignored
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 as above, moved the discussion to https://github.com/kubernetes-sigs/gateway-api-inference-extension/pull/1173/files#r2295450243
// unspecified (defaults to "Service"). | ||
// | ||
// +optional | ||
//nolint:kubeapilinter // ignore kubeapilinter here as we want to use pointer for optional struct. |
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 a struct, it's an integer. I know we wanted to not allow 0, but this isn't the right way to except this. Add an exception to the golang ci lint config with the explicit error message.
Right now you're ignoring all possible KAL issues and that might mask other problems with the field
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.
zero means all ports by convention, we don't want to use zero to indicate not set, therefore we want to add a exception here. I will change the comment as it is not accurate
// | ||
// +optional | ||
// +kubebuilder:default="FailClose" | ||
//nolint:kubeapilinter // ignore kubeapilinter here as we want to use pointer for optional struct. |
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 a struct, it's a string. Enum validation prevents the empty string, this doesn't need to be a pointer.
Go clients can check if empty to assert whether the string was provided or not
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.
Do we consider such type EndpointPickerFailureMode string
as a built-in type string or a struct(In reality, it is neither a struct nor a built-in type) But maybe more close to a string when it comes to serialization/deserialization? cc @robscott @kfswain As we are going to cut the RC, if we decide to make a last-minute change, I can send a PR for the fix.
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.
#1444 is ready to merge if we want to change it to non-pointer for such named type.
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.
EndpointPickerFailureMode
This is a string, it's definitely not a struct (that would be type Foo struct
)
// | ||
// +optional | ||
// +kubebuilder:default=Gateway | ||
//nolint:kubeapilinter // ignore kubeapilinter here as we want to use pointer for optional struct. |
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 a string, not a struct. Empty string isn't valid, should still be a non-pointer
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 as above, moved the discussion to https://github.com/kubernetes-sigs/gateway-api-inference-extension/pull/1173/files#r2295450243
// documentation for details: https://gateway-api.sigs.k8s.io/api-types/referencegrant/ | ||
// | ||
// +optional | ||
//nolint:kubeapilinter // ignore kubeapilinter here as we want to use pointer for optional struct. |
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 a string, not a struct, empty namespace is not a valid choice, does not need to be a pointer
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 as above, moved the discussion to https://github.com/kubernetes-sigs/gateway-api-inference-extension/pull/1173/files#r2295450243
Further to my comment above, did we decide all optional fields should be pointers, or, only optional structs? Cc @robscott I thought the latter, but the exceptions I'm seeing imply the former Either decision can be configured in KAL so we shouldn't need any exceptions apart from the port number where a specific decision was made to ignore the guidance about the zero value |
What type of PR is this?
/kind api-change
What this PR does / why we need it:
This PR is a diff of /apis from alpha (main branch) to v1.0 (release-1.0 branch).
Note: This PR is purely to facilitate review, it is not intended to merge.
Changes:
/assign @robscott