BentoML
BentoML copied to clipboard
Add Yatai deployment APIs to Yatai client
Is your feature request related to a problem? Please describe.
Currently, Yatai provides a few ways to create and manage deployments:
- Web UI (requires yatai account logged in)
- REST API (requires API token)
- kubectl / kubernetes API + BentoDeployment CRD definition YAML file (requires credentials to access the Kubernetes cluster)
The REST API is great for users to automate deployment, without direct access to the K8s cluster. However invoking a REST API call directly is not a great experience, it would be nice to add related API calls to the YataiClient class.
Describe the solution you'd like
Add deployment and bento management APIs to the YataiClient class, e.g.:
yatai_client = bentoml.YataiClient.from_env()
bento = yatai_client.get_bento('my_svc:v1')
assert bento and bento.status.is_ready()
yatai_client.create_deployment('my_deployment', bento.tag, ...)
# For updating a deployment:
yatai_client.update_deployment('my_deployment', bento.tag)
deployment_info = yatai_client.get_deployment('my_deployment')
# check deployment_info.status
This API will also allow us to create more Yatai related CLI commands, e.g.:
bentoml yatai create-deployment {BENTO_TAG} ...
Describe alternatives you've considered
Additional context
I'd be willing to hop on this if you let me :)
Could I get a few pointers on where to start, what the expectations are besides the snippet (eg. how to deal with configuration for the deployment -> class/dict based)?
I've already implemented another standalone client (with very limited functionality) for a project that needed to get urls for relevant runners, so I think I have a general overview about how this can look.
Hi @fwindolf, definitely welcome the contribution!
I assume you already have Yatai deployed and running? If that's the case, the first starting point would be to take a look at the REST API implementation.
- go to
/swagger
path of your Yatai deployment and understand the deployment related REST APIs - implement the corresponding REST API client in BentoML's Yatai REST client here: https://github.com/bentoml/BentoML/blob/main/bentoml/_internal/yatai_rest_api_client/yatai.py
- Lastly, define the top-level user-facing client APIs as described in the snippets above. The implementation should go to here: https://github.com/bentoml/BentoML/blob/main/bentoml/_internal/yatai_client/init.py
The top-level user-facing part is probably where we need a bit more explorating, regarding using attrs class or dict or yaml file as deployment configuration. It would be great to have a chat with you and discuss more. Are you in the community slack today?
On a side note, the https://github.com/bentoml/yatai-schemas contains more information about the internal structure used in yatai and yatai deployment component, if you are interested in diving deeper. @yetone would be the best person to help with code review and give feedback on the design/direction.
Thanks for the pointers. I've taken a look and I think I'll be able to find my way into it.
I'll say hi in slack sometime today :)
@fwindolf How's the progress on this? Any help we can provide?
Hey, I've been working on it and made some progress. But then I left for vacation and haven't touched it since due to shifted prios in the company, but it will probably get to it on friday. Am I blocking someone here?
@fwindolf, thanks for the update. No you are not blocking anyone. Just that we'd like to extend our help if needed. Looking forward to your PR.