Skip to content
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

feat(serving): add "Model URI" field to deployment modal #3807

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

emilys314
Copy link
Contributor

@emilys314 emilys314 commented Feb 26, 2025

https://issues.redhat.com/browse/RHOAIENG-19881

Description

Prompt the user for the OCI Model URI when selecting a OCI connection for model deployment.

  • If you paste in a URI with <...>://... it will remove the prefix
  • requires you have a non empty value, other than that the validation is sparse

Existing connection:
image

New connection:
image

How Has This Been Tested?

  • Create an ootb OCI connection deploy it
  • deploy and create the connection inline
  • test S3 and URI still work fine

Test Impact

Added jest test for the ConnectionSection.tsx

Request review criteria:

Self checklist (all need to be checked):

  • The developer has manually tested the changes and verified that the changes work
  • Testing instructions have been added in the PR body (for PRs involving changes that are not immediately obvious).
  • The developer has added tests or explained why testing cannot be added (unit or cypress tests for related changes)

If you have UI changes:

  • Included any necessary screenshots or gifs if it was a UI change.
  • Included tags to the UX team if it was a UI/UX change.

@simrandhaliw

After the PR is posted & before it merges:

  • The developer has tested their solution on a cluster by using the image produced by the PR to main

@emilys314
Copy link
Contributor Author

Comment on lines 126 to 142
export const isS3Connection = (connection?: Connection): boolean =>
!!(
connection?.data?.AWS_ACCESS_KEY_ID &&
connection.data.AWS_ACCESS_KEY_ID &&
connection.data.AWS_S3_ENDPOINT &&
connection.data.AWS_S3_BUCKET
) ||
!!(
connection?.stringData?.AWS_ACCESS_KEY_ID &&
connection.stringData.AWS_ACCESS_KEY_ID &&
connection.stringData.AWS_S3_ENDPOINT &&
connection.stringData.AWS_S3_BUCKET
);
export const isUriConnection = (connection?: Connection): boolean =>
!!connection?.data?.URI || !!connection?.stringData?.URI;
export const isOciConnection = (connection?: Connection): boolean =>
!!connection?.data?.OCI_HOST || !!connection?.stringData?.OCI_HOST;
Copy link
Contributor Author

@emilys314 emilys314 Feb 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idk if there is a less verbose way to do this.

Otherwise you need to getConnectionModelServingCompatibleTypes(selectedConnectionType)[0] === ModelServingCompatibleTypes.S3ObjectStorage (or includes(...) instead of [0]) everytime

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for the URI and OCI connection you're only checking one property, can you do the same for S3 or do we need to check all fields?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I overloaded the isModelServingTypeCompatible() function to work for Connections too so there are less imports / exports needed and it reuses the existing URIConnectionTypeKeys variables with the latest commit

@emilys314 emilys314 changed the title Add "Model URI" field to deployment modal feat(serving): add "Model URI" field to deployment modal Feb 26, 2025
Copy link

codecov bot commented Feb 26, 2025

Codecov Report

Attention: Patch coverage is 77.77778% with 18 lines in your changes missing coverage. Please review.

Project coverage is 84.66%. Comparing base (a05d232) to head (4203b83).
Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
...s/InferenceServiceModal/ConnectionOciPathField.tsx 52.63% 9 Missing ⚠️
...d/src/pages/modelServing/screens/projects/utils.ts 77.77% 4 Missing ⚠️
frontend/src/concepts/connectionTypes/utils.ts 81.25% 3 Missing ⚠️
...ojects/InferenceServiceModal/ConnectionSection.tsx 92.00% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3807      +/-   ##
==========================================
- Coverage   84.67%   84.66%   -0.01%     
==========================================
  Files        1517     1519       +2     
  Lines       35134    35252     +118     
  Branches     9836     9882      +46     
==========================================
+ Hits        29748    29846      +98     
- Misses       5386     5406      +20     
Files with missing lines Coverage Δ
...erenceServiceModal/ConnectionS3FolderPathField.tsx 100.00% <100.00%> (ø)
...erenceServiceModal/DataConnectionExistingField.tsx 0.00% <ø> (ø)
...ts/InferenceServiceModal/DataConnectionSection.tsx 0.00% <ø> (ø)
...erenceServiceModal/ManageInferenceServiceModal.tsx 97.10% <100.00%> (+0.04%) ⬆️
...screens/projects/kServeModal/ManageKServeModal.tsx 95.89% <100.00%> (+0.02%) ⬆️
...ojects/InferenceServiceModal/ConnectionSection.tsx 95.67% <92.00%> (-0.33%) ⬇️
frontend/src/concepts/connectionTypes/utils.ts 93.46% <81.25%> (-0.96%) ⬇️
...d/src/pages/modelServing/screens/projects/utils.ts 93.30% <77.77%> (+0.50%) ⬆️
...s/InferenceServiceModal/ConnectionOciPathField.tsx 52.63% <52.63%> (ø)

... and 11 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a05d232...4203b83. Read the comment docs.

Copy link
Contributor

@Griffin-Sullivan Griffin-Sullivan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

Tested on my cluster and works as expected!

Comment on lines 126 to 142
export const isS3Connection = (connection?: Connection): boolean =>
!!(
connection?.data?.AWS_ACCESS_KEY_ID &&
connection.data.AWS_ACCESS_KEY_ID &&
connection.data.AWS_S3_ENDPOINT &&
connection.data.AWS_S3_BUCKET
) ||
!!(
connection?.stringData?.AWS_ACCESS_KEY_ID &&
connection.stringData.AWS_ACCESS_KEY_ID &&
connection.stringData.AWS_S3_ENDPOINT &&
connection.stringData.AWS_S3_BUCKET
);
export const isUriConnection = (connection?: Connection): boolean =>
!!connection?.data?.URI || !!connection?.stringData?.URI;
export const isOciConnection = (connection?: Connection): boolean =>
!!connection?.data?.OCI_HOST || !!connection?.stringData?.OCI_HOST;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for the URI and OCI connection you're only checking one property, can you do the same for S3 or do we need to check all fields?

Copy link
Contributor

openshift-ci bot commented Feb 26, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Griffin-Sullivan
Once this PR has been reviewed and has the lgtm label, please ask for approval from emilys314. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link
Contributor

@mturley mturley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm
I'll hold off on approving until others have a chance to look.

Comment on lines 329 to 330
getConnectionTypeModelServingCompatibleTypes(selectedConnectionType)[0] ===
ModelServingCompatibleTypes.S3ObjectStorage && (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it maybe worth factoring out a function so you could do something like:

isModelServingConnectionType(selectedConnectionType, ModelServingCompatibleTypes.S3ObjectStorage)

(not sure on the best name here or whether this is worth it)

Comment on lines +415 to +417
existingUriOption={
editInfo?.inferenceServiceEditInfo?.spec.predictor.model?.storageUri
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah - @manaswinidas for https://issues.redhat.com/browse/RHOAIENG-19258 this is where we could pass our URI when prefilling from model registry if it is a RH registry URI (starts with oci://registry.redhat.io/). We probably want that logic encapsulated somewhere MR specific but we can maybe lift out an optional existingUriOption to be passed into ManageKServeModal and use it if present instead of this one from editInfo.

Copy link
Contributor

openshift-ci bot commented Feb 26, 2025

New changes are detected. LGTM label has been removed.

@emilys314 emilys314 force-pushed the add-oci-deployment-model-uri branch from 7766033 to 4203b83 Compare February 26, 2025 20:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants