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
Url and Address Url set in TrainedModel Status using InferenceService Status #1319
Conversation
This reverts commit 4ddf017.
Hi @abchoo. Thanks for your PR. I'm waiting for a kubeflow 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. |
if err := r.Get(context.TODO(), types.NamespacedName{Namespace: req.Namespace, Name: desiredModel.Spec.InferenceService}, isvc); err != nil { | ||
if errors.IsNotFound(err) { | ||
log.Info("Parent InferenceService does not exists, deleting TrainedModel", "TrainedModel", desiredModel.Name, "InferenceService", isvc.Name) | ||
r.Delete(context.TODO(), desiredModel) |
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 we shouldn't delete trained model here, instead we can return error back and the next reconciliation loop will retry.
// Check if parent inference service has the status URL | ||
if isvc.Status.URL != nil { | ||
// Update status to contain the isvc URL with /v1/models/trained-model-name:predict appened | ||
url := isvc.Status.URL.String() + "/" + protocolVersion + "/models/" + desiredModel.Name + ":predict" |
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.
for v2 the verb is /infer
if isvc.Status.Address != nil { | ||
if isvc.Status.Address.URL != nil { | ||
////Update status to contain the isvc address with /v1/models/trained-model-name:predict appened | ||
url := isvc.Status.Address.URL.String() + "/" + protocolVersion + "/models/" + desiredModel.Name + ":predict" |
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.
/infer
for v2 protocol
duckv1 "knative.dev/pkg/apis/duck/v1" | ||
) | ||
|
||
// TrainedModelStatus defines the observed state of TrainedModel | ||
type TrainedModelStatus struct { | ||
// Conditions for trained model | ||
duckv1.Status `json:",inline"` | ||
// URL holds the url that will distribute traffic over the provided traffic targets. | ||
// http[s]://{route-name}.{route-namespace}.{cluster-level-suffix}/v1/models/<trainedmodel>:predict |
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.
For v2 it should be http[s]://{route-name}.{route-namespace}.{cluster-level-suffix}/v2/models/:infer
// V1 ends with :predict whereas V2 ends with /infer | ||
endpointSuffix := ":predict" | ||
if protocolVersion == string(constants.ProtocolV2) { | ||
endpointSuffix = "/infer" | ||
} | ||
|
||
// Check if parent inference service has the status URL | ||
if isvc.Status.URL != nil { | ||
// Update status to contain the isvc URL with /v1/models/trained-model-name:predict appened | ||
url := isvc.Status.URL.String() + "/" + protocolVersion + "/models/" + desiredModel.Name + endpointSuffix |
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 can use this utility to construct the predict path.
/LGTM |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: abchoo, yuzisun 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 this PR does / why we need it: Included url and addressable url in TrainedModel from parent inference service. Test are added to confirm proper updates.
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #1007
Special notes for your reviewer:
Release note: