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

Add connection type to model serving create modal #3356

Conversation

emilys314
Copy link
Contributor

@emilys314 emilys314 commented Oct 21, 2024

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

Description

Replaces the data connections section in the model serving modals with connection types. The existing connection has fairly similar behavior. The new connection options has the ability to create a new connection inline,

Updated the single kserving modal and the modelmesh multi model modals.

image
image

How Has This Been Tested?

  1. Set disableConnectionTypes dev flag to false
  2. either navigate to a project and open the "Models" details section OR go to /modelServing which is the "Model Serving" on the left nav bar
  3. Make sure you have a runtime setup
    • (either single serving or multi. you can have 2 projects with each having one of them)
  4. Edit or deploy a new model
    • Try various combinations of connections types and connection instances on the project

Test Impact

Jest tests added

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.

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

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress This PR is in WIP state label Oct 21, 2024
Copy link
Contributor

openshift-ci bot commented Oct 21, 2024

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

Copy link

codecov bot commented Oct 21, 2024

Codecov Report

Attention: Patch coverage is 72.98851% with 47 lines in your changes missing coverage. Please review.

Project coverage is 84.93%. Comparing base (c96cc39) to head (aaad986).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...ojects/InferenceServiceModal/ConnectionSection.tsx 69.79% 29 Missing ⚠️
frontend/src/utilities/useWatchConnectionTypes.tsx 69.23% 4 Missing ⚠️
...ts/connectionTypes/ConnectionDetailsHelperText.tsx 76.92% 3 Missing ⚠️
frontend/src/concepts/connectionTypes/utils.ts 75.00% 3 Missing ⚠️
...d/src/pages/modelServing/screens/projects/utils.ts 76.92% 3 Missing ⚠️
...erenceServiceModal/ManageInferenceServiceModal.tsx 75.00% 2 Missing ⚠️
...screens/projects/kServeModal/ManageKServeModal.tsx 75.00% 2 Missing ⚠️
...jects/screens/detail/connections/useConnections.ts 90.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3356      +/-   ##
==========================================
- Coverage   84.96%   84.93%   -0.03%     
==========================================
  Files        1333     1335       +2     
  Lines       29951    30104     +153     
  Branches     8201     8253      +52     
==========================================
+ Hits        25448    25570     +122     
- Misses       4503     4534      +31     
Files with missing lines Coverage Δ
...eens/detail/connections/ManageConnectionsModal.tsx 93.54% <100.00%> (ø)
...jects/screens/detail/connections/useConnections.ts 85.71% <90.00%> (-1.79%) ⬇️
...erenceServiceModal/ManageInferenceServiceModal.tsx 96.05% <75.00%> (-2.50%) ⬇️
...screens/projects/kServeModal/ManageKServeModal.tsx 95.10% <75.00%> (-1.22%) ⬇️
...ts/connectionTypes/ConnectionDetailsHelperText.tsx 76.92% <76.92%> (ø)
frontend/src/concepts/connectionTypes/utils.ts 89.26% <75.00%> (-1.39%) ⬇️
...d/src/pages/modelServing/screens/projects/utils.ts 95.96% <76.92%> (-1.31%) ⬇️
frontend/src/utilities/useWatchConnectionTypes.tsx 69.23% <69.23%> (-30.77%) ⬇️
...ojects/InferenceServiceModal/ConnectionSection.tsx 69.79% <69.79%> (ø)

... and 8 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 c96cc39...aaad986. Read the comment docs.

@emilys314 emilys314 marked this pull request as ready for review October 22, 2024 19:12
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress This PR is in WIP state label Oct 22, 2024
@emilys314 emilys314 force-pushed the add-connections-to-model-serving branch 4 times, most recently from 2409ca4 to 2162712 Compare October 23, 2024 14:58
Comment on lines 17 to 19
const secrets = await fetchConnectionTypes();

let connectionTypes = secrets;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const secrets = await fetchConnectionTypes();
let connectionTypes = secrets;
let connectionTypes = await fetchConnectionTypes();

Comment on lines +20 to +24
if (modelServingCompatible) {
connectionTypes = connectionTypes.filter((type) => {
const compatibleTypes = getCompatibleTypes(
type.data?.fields?.filter(isConnectionTypeDataField).map((field) => field.envVar) ?? [],
);

return compatibleTypes.includes(CompatibleTypes.ModelServing);
Copy link
Contributor

Choose a reason for hiding this comment

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

With the changes UX wants to do to the Compatibility column, I'm going to rework how these checks are made...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

okay. yeah I was looking at this for connections as well, it's a little tricky to accommodate the different data structures the env variables can be represented as. And for connections the values need to be checked to be truthy as well

@@ -110,6 +113,10 @@ const ManageKServeModal: React.FC<ManageKServeModalProps> = ({
registeredModelDeployInfo,
);

const isConnectionTypesEnabled = useConnectionTypesEnabled();
const [connection, setConnection] = React.useState<Connection>();
const [isConnectionValid, setIsConnectionvalid] = React.useState(false);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const [isConnectionValid, setIsConnectionvalid] = React.useState(false);
const [isConnectionValid, setIsConnectionValid] = React.useState(false);

data: CreatingInferenceServiceObject;
setData: UpdateObjectAtPropAndValue<CreatingInferenceServiceObject>;
setConnection: (connection?: Connection) => void;
setIsConnectionvalid: (isValid: boolean) => void;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
setIsConnectionvalid: (isValid: boolean) => void;
setIsConnectionValid: (isValid: boolean) => void;

setSelectedConnectionType(
withRequiredFields(
connectionTypes.find((t) => getResourceNameFromK8sResource(t) === type),
['AWS_ACCESS_KEY_ID', 'AWS_SECRET_ACCESS_KEY', 'AWS_S3_ENDPOINT', 'AWS_S3_BUCKET'],
Copy link
Contributor

Choose a reason for hiding this comment

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

Should be a const set of env vars that is shared with isModelServingCompatibility.

): ConnectionTypeConfigMapObj | undefined => {
for (const field of connectionType?.data?.fields ?? []) {
if (isConnectionTypeDataField(field) && envVars?.includes(field.envVar)) {
field.required = true;
Copy link
Contributor

Choose a reason for hiding this comment

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

This should not mutate the original value.

export const assembleConnectionSecret = (
project: ProjectKind,
project: ProjectKind | string,
Copy link
Contributor

Choose a reason for hiding this comment

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

Change to projectName: string and all callers.

@emilys314 emilys314 force-pushed the add-connections-to-model-serving branch 4 times, most recently from b5a1d16 to 27d60f3 Compare October 25, 2024 17:16
@emilys314 emilys314 force-pushed the add-connections-to-model-serving branch from 27d60f3 to aaad986 Compare October 25, 2024 17:24
@christianvogt
Copy link
Contributor

/lgtm
/approve

Copy link
Contributor

openshift-ci bot commented Oct 25, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: christianvogt

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-bot openshift-merge-bot bot merged commit 05e394b into opendatahub-io:main Oct 25, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants