Open karlkfi opened 3 years ago
@karlkfi Why do you need a Dockerfile here? It sounds like you want to have the starlark function with a baked-in starlark script and then publish it to the catalog?
The idea of starlark function is that we provide the image and user provide the functionConfig. Publishing the functionConfig of starlark function is equivalent to publishing a function, since that's the only thing that changes. We can potentially have a separate index for starlark functionConfig.
@droot @karlkfi WDYT?
Why do you need a Dockerfile here? It sounds like you want to have the starlark function with a baked-in starlark script and then publish it to the catalog?
Yes
Publishing the functionConfig of starlark function is equivalent to publishing a function
No.
Publishing a function as a yaml file in a git repo is NOT equivalent to publishing it as a docker image. With a docker image you can include the usage of the function in any kptfile pipeline. With a yaml file you force the user to kpt pkg get a package with your yaml file.
If you can make kptfile reference a yaml file in a git repo without needing to publish it as an image, then maybe they would be more equivalent. That would certainly be easier. Otherwise they need to be published as container images, right?
I agree, having a light weight skylark sdk that scaffolds the Dockerfile
and function script
and some make
helpers to dev and publish the starlark script as function makes sense. It will be sort of a parallel to our typescript and Go SDKs for writing functions.
Another option would be to be able to reference a function by URL, instead of just container image. Then I could "publish" a starlark function just by hosting it in a github repo.
The downside is that it would be effectively as secure as sudo curl|bash (not that a container published by someone else is much better).
I like the way Starlark functions are really easy to write and very short (< 10 lines of code).
I want to be able to publish functions (to the kpt-function-catalog) written in Starlark with minimal effort.
I also need to be able to provide input variables to Starlark functions, so they can be used as validators & mutators.
Since almost all the code and Dockerfile would be boilerplate, it seems like a generator functions could be created, like:
This would generate the Dockerfile and a placeholder file for the starlark code, along with a script or makefile for building and publishing the image.