Skip to content

Conversation

Griffin-Sullivan
Copy link
Contributor

@Griffin-Sullivan Griffin-Sullivan commented Jul 30, 2025

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

Description

Adding a fix for maintaining non-dashboard properties on an ISVC and SR when editing

How Has This Been Tested?

Create a project via OC
Create a ServingRuntime & InferenceService with as much bare bones as possible
Add a custom annotation & label (doesn't matter what)
Include dashboard label (related verification is RHOAIENG-26146)
Deploy resources into the project via OC
Go to the UI & edit the resource
Make no change if possible, but maybe change replicas if needed
Verify the resource still mains your custom annotation & label
Repeat for a property in the spec. See https://issues.redhat.com/browse/RHOAIENG-18976

Test Impact

We should probably add a unit test for this but I think how we assemble inference services will change soon

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

Summary by CodeRabbit

  • Bug Fixes
    • Improved updating of inference services to better preserve existing configuration settings during updates.

Copy link
Contributor

coderabbitai bot commented Jul 30, 2025

Walkthrough

The assembleInferenceService function in the frontend API was refactored to unify creation and update logic by initializing or cloning a single inference service object and incrementally updating its properties. Metadata, labels, predictor specs, authentication, routing, and resource requests are now merged and applied explicitly, improving clarity and maintainability.

Changes

Cohort / File(s) Change Summary
Inference Service Assembly Refactor
frontend/src/api/k8s/inferenceServices.ts
Refactored assembleInferenceService to consolidate creation and update logic into one flow, explicitly merge metadata and labels, shallow-copy and update predictor specs, apply authentication and routing, and conditionally add resource requests. Removed unused imports.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~7 minutes

Suggested labels

lgtm, approved

Suggested reviewers

  • emilys314
  • ppadti

Poem

🐇
I hop through code with nimble feet,
Merging specs so all align neat.
One object now, no split divide,
With labels and specs all unified.
A tidy change, so fresh and bright,
In code’s soft glow, I dance tonight!
🌿✨

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 385e0d0 and dca0035.

📒 Files selected for processing (1)
  • frontend/src/api/k8s/inferenceServices.ts (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • frontend/src/api/k8s/inferenceServices.ts
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@openshift-ci openshift-ci bot requested review from antowaddle and FedeAlonso July 30, 2025 18:58
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
frontend/src/api/k8s/inferenceServices.ts (1)

150-152: LGTM! Excellent fix for preserving existing properties during updates.

The spread operator usage correctly preserves all existing spec and predictor properties while allowing new properties to override as needed. This directly addresses the PR objective of maintaining extraneous UI properties during ISVC edits.

Consider adding optional chaining for additional safety:

        spec: {
-          ...inferenceService.spec,
+          ...inferenceService.spec,
          predictor: {
-            ...inferenceService.spec.predictor,
+            ...inferenceService.spec?.predictor,

This would prevent potential runtime errors if the existing InferenceService has an unexpected structure, though the current implementation should work fine in normal scenarios.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 194215d and db42581.

📒 Files selected for processing (1)
  • frontend/src/api/k8s/inferenceServices.ts (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Lint
  • GitHub Check: Cypress-Setup

@emilys314
Copy link
Contributor

Changing the serving runtime stuff to support this too would be great I think

Copy link

codecov bot commented Jul 30, 2025

Codecov Report

❌ Patch coverage is 97.50000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 29.59%. Comparing base (4ec2b6f) to head (fee7849).
⚠️ Report is 19 commits behind head on main.

Files with missing lines Patch % Lines
frontend/src/api/k8s/inferenceServices.ts 97.50% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##             main    #4582       +/-   ##
===========================================
- Coverage   82.30%   29.59%   -52.72%     
===========================================
  Files        1880     1920       +40     
  Lines       39129    39394      +265     
  Branches    11711    12117      +406     
===========================================
- Hits        32207    11658    -20549     
- Misses       6922    27736    +20814     
Files with missing lines Coverage Δ
frontend/src/k8sTypes.ts 50.00% <ø> (-50.00%) ⬇️
...ojects/InferenceServiceModal/ConnectionSection.tsx 70.66% <ø> (-21.96%) ⬇️
frontend/src/api/k8s/inferenceServices.ts 92.62% <97.50%> (-4.47%) ⬇️

... and 1573 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 e60a84b...fee7849. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between db42581 and 8a356f6.

📒 Files selected for processing (2)
  • frontend/src/api/k8s/inferenceServices.ts (2 hunks)
  • frontend/src/api/k8s/servingRuntimes.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • frontend/src/api/k8s/inferenceServices.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Cypress-Setup
  • GitHub Check: Lint

@emilys314
Copy link
Contributor

To fix your lint issue you can try increasing the memory node has https://redhat-internal.slack.com/archives/C05SMJ09DD2/p1753989489311749

Copy link
Contributor

Choose a reason for hiding this comment

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

So yeah I think there has to be a bit more nuance to this, which can make it tricky.

If i switch the model source from S3 to OCI then the S3 stuff remains

      storage:
        key: with-whitespace
        path: test
      storageUri: 'oci://quay.io/rh-ee-esamoylo/private:test'
image

Copy link
Contributor

Choose a reason for hiding this comment

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

I was looking at the InferenceService spec here https://kserve.github.io/website/0.8/reference/api/#serving.kserve.io/v1beta1.ModelSpec
and spec.predictor.model also extends PredictorExtensionSpec which extends Container v1 core which will include a bunch of container specs. So we may want to also ...inferenceService.spec.predictor.model for it too.

This includes args, command, env, envFrom, image, imagePullPolicy, lifecycle ports, etc.

I think after a _.merge, we could manually clear storage: ... if there is a storageUri and also for removing the imagePullSecret

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Been messing around with this I think we would also need to remove args or env variables if they change

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah it seems to be kinda funky doing it this way

Copy link
Contributor

Choose a reason for hiding this comment

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

Do the args and env stuff get fully pulled into the UI field for it?
If so we can overwrite those 2 safely, because the UI controls it fully

@Griffin-Sullivan Griffin-Sullivan force-pushed the edit-keep-props branch 2 times, most recently from 385e0d0 to dca0035 Compare August 6, 2025 15:18
Copy link
Contributor

@emilys314 emilys314 left a comment

Choose a reason for hiding this comment

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

Overall it looks good, i need to test it

if (!isModelMesh) {
predictor.minReplicas = minReplicas;
predictor.maxReplicas = maxReplicas;
predictor.imagePullSecrets = imagePullSecrets;
Copy link
Contributor

Choose a reason for hiding this comment

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

It may be possible if there are extraneous pull secrets added that are not the oci image pull secret.

But that is tricky to determine

@Griffin-Sullivan
Copy link
Contributor Author

/test-e2e@Modelserving

@rhods-ci-bot
Copy link

E2E Tests #2473 triggered by #4582 (comment)

@rhods-ci-bot
Copy link

E2E Tests #2473 finished with result: FAILURE

@Griffin-Sullivan
Copy link
Contributor Author

/test-e2e@Modelserving

@rhods-ci-bot
Copy link

E2E Tests #2474 triggered by #4582 (comment)

@rhods-ci-bot
Copy link

E2E Tests #2474 finished with result: FAILURE

@Griffin-Sullivan
Copy link
Contributor Author

First a 503 now an SSL error when trying to get the RHEL 9 repo???

@Griffin-Sullivan
Copy link
Contributor Author

/test-e2e@Modelserving

@rhods-ci-bot
Copy link

E2E Tests #2475 triggered by #4582 (comment)

@rhods-ci-bot
Copy link

E2E Tests #2475 finished with result: FAILURE

Copy link
Contributor

@emilys314 emilys314 left a comment

Choose a reason for hiding this comment

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

Besides the one resources property everything seems to work good

Also there seems to be a CI test failure

Comment on lines 207 to 209
updatedInferenceService.spec.predictor.model = {
...updatedInferenceService.spec.predictor.model,
resources,
Copy link
Contributor

Choose a reason for hiding this comment

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

The resources doesn't preserve the claims field, everything else is working though
image

Copy link
Contributor

Choose a reason for hiding this comment

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

Also I think adding some unit tests for the new functionality should be fairly straightforward and valuable

Comment on lines +173 to +175
delete model.storage;
} else {
delete model.storageUri;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmmm I don't think this is working actually...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nevermind this is because the ConnectionSection had a bug where selecting a new existing connection didn't clear the URI data

@Griffin-Sullivan Griffin-Sullivan force-pushed the edit-keep-props branch 2 times, most recently from dccc131 to c60eaa3 Compare August 12, 2025 20:07
Comment on lines +472 to +473
inferenceServiceModalEdit.findConnectionFieldInput('URI').blur();
inferenceServiceModalEdit.findSubmitButton().should('be.disabled');
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'm not sure why I hit this? Did I mess something up with validation? You have to blur the field for the submit button to disable or else it will be enabled

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Screencast.From.2025-08-13.11-46-42.mp4

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 don't think it was me cause this is running main

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same behavior in my PR too so not sure what changed but from user perspective it's the same and I updated the test to be more reliable

@emilys314
Copy link
Contributor

Looks good to me! I tested it by running locally, it preserved all the properties i changed, and then compared it to the old version which then swiftly removed those properties. Additionally the changing of connections seems to be working all smoothly still

Custom values start:
image

After saving with the new code:
image

After saving with the old code:
image

Copy link
Contributor

openshift-ci bot commented Aug 13, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: emilys314

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 c73ccc3 into opendatahub-io:main Aug 13, 2025
41 checks passed
antowaddle pushed a commit to antowaddle/odh-dashboard that referenced this pull request Aug 15, 2025
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.

3 participants