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 backend routes and frontend service for admin CRUD of ModelRegistries #2812

Merged

Conversation

mturley
Copy link
Contributor

@mturley mturley commented May 13, 2024

Closes https://issues.redhat.com/browse/RHOAIENG-7058

Description

Adds the following admin-only backend API routes:

  • GET /api/modelRegistries - lists ModelRegistries
  • POST /api/modelRegistries - creates a ModelRegistry
  • GET /api/modelRegistries/:modelRegistryName - gets a ModelRegistry
  • PATCH /api/modelRegistries/:modelRegistryName - updates a ModelRegistry
  • DELETE /api/modelRegistries/:modelRegistryName - deletes a ModelRegistry

And adds the new frontend/src/services/modelRegistryService.ts with functions to call these routes using axios.

Also adds a new constant MODEL_REGISTRY_NAMESPACE to backend/src/utils/constants.ts since there are some places where we were hard-coding the use of the odh-model-registries namespace.

How Has This Been Tested?

The admin page where this will be used does not exist yet (it is being created in #2810). I tested the two GET routes by inserting this temporary code into another existing page:

  React.useEffect(() => {
    const fetchData = async () => {
      const registries = await listModelRegistriesBackend();
      console.log('Registries!', registries);
      const registry = await getModelRegistryBackend('internal-registry');
      console.log('Registry!', registry);
    };
    fetchData();
  }, []);

This worked as expected. I did not yet test the POST, PATCH or DELETE routes because I don't want to mess with what's currently set up on the shared cluster. Those will be tested as part of upcoming PRs to consume these routes, and any issues we find at that time can be addressed in those PRs.

Test Impact

No tests here currently. There are no existing tests for any of these backend routes or corresponding services. They are also a temporary workaround to be removed when we access these services via a passthrough API (per @lucferbux) so tests here would be removed soon anyway.

Request review criteria:

Self checklist (all need to be checked):

  • The developer has manually tested the changes and verified that the changes work
  • Commits have been squashed into descriptive, self-contained units of work (e.g. 'WIP' and 'Implements feedback' style messages have been removed)
  • 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 (find relevant UX in the SMEs section).

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 requested review from dpanshug and pnaik1 May 13, 2024 21:55
Copy link
Contributor

@lucferbux lucferbux left a comment

Choose a reason for hiding this comment

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

Just add the permissions and I think it would be ready to go

@mturley mturley force-pushed the RHOAIENG-7056-mr-backend branch 3 times, most recently from 7a4fbab to 64b56fc Compare May 14, 2024 15:14
Copy link

codecov bot commented May 14, 2024

Codecov Report

Attention: Patch coverage is 0% with 33 lines in your changes are missing coverage. Please review.

Project coverage is 77.23%. Comparing base (8645fe6) to head (b5b8257).
Report is 2 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2812      +/-   ##
==========================================
- Coverage   77.32%   77.23%   -0.09%     
==========================================
  Files        1093     1094       +1     
  Lines       23026    23059      +33     
  Branches     5799     5799              
==========================================
+ Hits        17805    17810       +5     
- Misses       5221     5249      +28     
Files Coverage Δ
frontend/src/services/modelRegistryService.ts 0.00% <0.00%> (ø)

... and 3 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 8645fe6...b5b8257. Read the comment docs.

@mturley mturley requested a review from lucferbux May 14, 2024 15:38
…ries

Signed-off-by: Mike Turley <mike.turley@alum.cs.umass.edu>
@openshift-ci openshift-ci bot removed the lgtm label May 15, 2024
@mturley
Copy link
Contributor Author

mturley commented May 15, 2024

@lucferbux @gitdallas I updated this to add the DELETE route, if you don't mind re-reviewing

Copy link
Contributor

@lucferbux lucferbux left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci openshift-ci bot added the lgtm label May 16, 2024
Copy link
Contributor

openshift-ci bot commented May 16, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: gitdallas, lucferbux

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 43bc672 into opendatahub-io:main May 16, 2024
8 checks passed
@mturley mturley deleted the RHOAIENG-7056-mr-backend branch May 16, 2024 15:59
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.

None yet

3 participants