kpt: New Starlark fn does not support custom parameters nor imperative run

Apologies if this is premature feedback - I realize that this is yet to be released officially. Feel free to close if this is already planned for.

I tried out the new Starlark fn and it’s pretty limited compared to the current built in alpha functionality:

  1. There is no way to pass parameters to the Starlark code, the function requires a custom config that only takes a single parameter source
  2. Because it requires a custom config it can’t be run imperatively.

What I would like is to be able to do something like:

kpt fn run . --image gcr.io/kpt-fn/starlark:unstable -- source="$(cat my-func.star)" some-param=xyz

Less important, but it would also be nice to be able to use a custom config structure that gets passed into the starlark function (in ctx.resource_list["functionConfig"]) like you can today with the Starlark runtime

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 21 (16 by maintainers)

Most upvoted comments

@yhrn In case you missed it, the starlark:v0.2.0 function has been released.

It sounds like you are suggesting something like this:

kpt fn eval --image gcr.io/kpt-fn/starlark:v0.1 -- source="$(cat my-func.star)" param1=foo param2=bar

ConfigMap as a functionConfig is designed to host simple key-value pairs only. If we want to do more than that, we should use CRD. It may be debatable that if reserve key source and make it accept a multi-line string is consider simple key-value pairs.

@droot @frankfarzan Thoughts?

@yhrn Thanks a lot for your feedbacks!

There is no way to pass parameters to the Starlark code, the function requires a custom config that only takes a single parameter source

This is planed to be solved in https://github.com/GoogleContainerTools/kpt/issues/1560.

Because it requires a custom config it can’t be run imperatively.

To support it, we will need to support ConfigMap as fn config. We will share the design with you when we have something.