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

Refactor CSI as different command of the model registry module #338

Closed
lampajr opened this issue Sep 2, 2024 · 13 comments · Fixed by #601
Closed

Refactor CSI as different command of the model registry module #338

lampajr opened this issue Sep 2, 2024 · 13 comments · Fixed by #601

Comments

@lampajr
Copy link
Member

lampajr commented Sep 2, 2024

Is your feature request related to a problem? Please describe.
At the moment the CSI heavily relies on the model registry project, this is because the model-registry dependency is imported in order to interact with model registry by making use of the auto-generated and provided client:

client := openapi.NewAPIClient(cfg)
return &ModelRegistryProvider{
Client: client,
Providers: map[kserve.Protocol]kserve.Provider{},
}, nil

This implementation could lead to some issues, especially from a maintenance point of view, see #328 (comment) as an example.

Describe the solution you'd like
Decouple CSI and Model Registry by removing the model-registry dependency from the CSI dependencies.

Then update the CSI to make use of a custom and auto-generated REST client (or whatever could be valuable and easy-to-maintain approach) relying on the versioned model-registry OpenAPI specification.

Describe alternatives you've considered
n/a

Additional context
If we go for a custom auto-generated client to interact with the MR REST interface consider that we just need a couple of endpoints to invoke so I think it is worth to evaluate whether we can auto-generate just a subset of the OpenAPI spec.

@rareddy
Copy link
Contributor

rareddy commented Sep 2, 2024

Is there reason why CSI needs to be designed as extension to MR vs have it part of the MR code directly to avoid such issues?

@tarilabs
Copy link
Member

tarilabs commented Sep 2, 2024

Describe alternatives you've considered

an alternative I didn't have chance to investigate is whether workspaces would make this easier also to be properly managed from dependabot automated toolings.

@lampajr
Copy link
Member Author

lampajr commented Sep 2, 2024

Is there reason why CSI needs to be designed as extension to MR vs have it part of the MR code directly to avoid such issues?

@rareddy TBH I've never considered this because I always tried to make CSI as isolated and independent project as possible (at least this was the initial goal) but now that you pointed out again I am starting thinking it is worth to evaluate whether adding another go cmd https://github.com/kubeflow/model-registry/tree/main/cmd just for the CSI. Obviously generating the executable for the CSI will rebuild the model-registry source code as well (but this is actually already happening with the relative import).

Don't know if that could introduce other issues but I think it is worth to investigate.

an alternative I didn't have chance to investigate is whether workspaces would make this easier also to be properly managed from dependabot automated toolings.

Good point, this is another thing I did not try yet too.

@lampajr
Copy link
Member Author

lampajr commented Sep 2, 2024

As discussed in the last bi-weekly mtg, as part of this issue we should probably evaluate the following options:

  • decouple the REST part, by relying on the openapi to generate the client
  • ad-hoc command inside the existing Model Registry
    To be noticed here, would require another command (not subcommand)

@rareddy
Copy link
Contributor

rareddy commented Sep 6, 2024

@lampajr can you explain what is ad-hoc command or sub-command in this context? I do not understand it.

@lampajr
Copy link
Member Author

lampajr commented Sep 6, 2024

@lampajr can you explain what is ad-hoc command or sub-command in this context? I do not understand it.

With command I mean a dedicated Go script like main.go which then will use the model registry source code directly. The only issue I might see here is that every dependency that is required by CSI needs to be included in the root go.mod

With sub-command I mean another cli command like the one we already have named proxy.

@tarilabs
Copy link
Member

tarilabs commented Sep 6, 2024

Another difference between opting for command vs subcommand is the resulting artifact produced: in the case of subcommand, that would have been a "subroutine" in the same binary, while for CSI we only need a subset of the whole in the final binary (for CSI). I believe is important to keep in mind/highlight.

@lampajr
Copy link
Member Author

lampajr commented Sep 6, 2024

Another difference between opting for command vs subcommand is the resulting artifact produced: in the case of subcommand, that would have been a "subroutine" in the same binary, while for CSI we only need a subset of the whole in the final binary (for CSI). I believe is important to keep in mind/highlight.

Definitely worth to mention it, thanks @tarilabs

@rareddy
Copy link
Contributor

rareddy commented Sep 6, 2024

Thanks, @tarilabs and @lampajr for the explanation, makes sense.

I guess command is the way we should do where the go.mod is common but different package structures produce multiple binaries. ex: https://stackoverflow.com/questions/50904560/how-to-structure-go-application-to-produce-multiple-binaries.

@tarilabs
Copy link
Member

tarilabs commented Sep 7, 2024

Yes @rareddy or something along those lines.

However as mentioned I believe Workspaces should be investigated first, if that ameliorates the problem of keeping deps in sync, without actually "mixing code". If that doesn't help, then the "different command(s) from the same go project" is likely the next simpler approach. my2c.

Copy link

github-actions bot commented Dec 7, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@lampajr
Copy link
Member Author

lampajr commented Dec 10, 2024

After some investigation it turned out the best approach here is to keep CSI as different executable/command from the same model registry go module such that we don't have to maintain different modules that share part of the codebase.
(changed the title of this issue reflecting the final decision)

The proposal can be found here 👉🏻 #601

@tarilabs I think we can remove the lifecycle/stale here, wdyt?

@lampajr lampajr changed the title Make CSI depend on the model registry OpenAPI sepc Refactor CSI as different command of the model registry module Dec 10, 2024
@tarilabs
Copy link
Member

@tarilabs I think we can remove the lifecycle/stale here, wdyt?

indeed this auto-resolved per #601
thanks a lot again @lampajr for these contributions!! 🚀

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 a pull request may close this issue.

3 participants