serverless / serverless-kubeless

This plugin enables support for Kubeless within the Serverless Framework.
Apache License 2.0
303 stars 80 forks source link

Add support for custom runtime image #81

Closed ccll closed 6 years ago

ccll commented 6 years ago

This is a ALPHA feature in kubeless, but I need it now for several reasons:

  1. I'd like to use python3.6 which is not officially supported right now.
  2. My function have dozens of dependencies, where the deployment speed is drastically slowed down by the pod init container. And this is particularly bad if later I decided to start using HPA to auto-scale my pods.

After browsing the code I didn't found this feature, and I think may be I could give it a try. I compared two 'function.k8s.io' objects, one created with official runtime and another with a custom runtime, the only difference to me is that the former one fills the property spec.runtime while the later fills spec.template.spec.containers.image.

So I guess the steps to implement this feature is as simple as:

  1. add a new optional property like service.provider.image to the serverless.yaml, the save level as the runtime property.
  2. parse the new property and fill it in the returned function.k8s.io object of getFunctionDescription in file lib/deploy.js.
  3. then the function object get posted to the server by lib/functions.js.

Please feel free to give me some directions.

andresmgot commented 6 years ago

Yes, that will do the job. Just one minor detail: the new parameter should be either set as service.provider.image or as service.functions.<function_id>.image that way you can have in the same serverless.yaml functions with a custom image and others with the official images.

If you feel like giving it a try I am happy to help if you get stuck in any step.

ccll commented 6 years ago

@andresmgot Thanks for the tips. I've added the implementation and tests as you said, and works well in my test cluster. Please let me know if anything else.

sebgoa commented 6 years ago

@ccll we would love to know what you are doing with kubeless, maybe we can relay a blog of yours. In any case, thanks for the great contributions

ccll commented 6 years ago

@sebgoa I'm trying to re-write my private web/data scraping service to work on kubernetes, I think k8s + serverless is very suitable for this kind of jobs. After evaluated several serverless frameworks, kubeless is the most mature and promising to me.

The whole thing is still in evaluation anyway, so far the experience is very good, despite some of the features do not work well enough. Do you folks have a rough schedule or roadmap on when will kubeless be production ready?