func
func copied to clipboard
Placeholders to pass values to template rendering
When I create a NodeJS HTTP func using the template, I see it is always created with the same package name: http-handler: https://github.com/knative/func/blob/main/templates/node/http/package.json#L2
kn func create -l node -t http
It would be useful to make some[^1] of these hardcoded values placeholders.
Something like this:
kn func create -l node -t http -p name:"my-handler"
which can generate something like:
{
"name": "my-handler",
"version": "0.1.0",
Current hardcoded values can be the defaults.
While name is just very simple and doesn't provide much value, having ports, builders, baseImages, etc. can be very useful.
Context:
- I am working on creating some Backstage templates for Knative Function templates.
- If there was a way to pass some arguments to the function during the creation, I wouldn't need to duplicate these templates and add some placeholders in them
[^1]: Definition of what to keep hardcoded and what to parametrize needs some work.
This issue is stale because it has been open for 90 days with no
activity. It will automatically close after 30 more days of
inactivity. Reopen the issue with /reopen. Mark the issue as
fresh by adding the comment /remove-lifecycle stale.
cc @matzew
yes this would be super helpful
If we do this improvement, we can use these templates as-is in Backstage.
This issue is stale because it has been open for 90 days with no
activity. It will automatically close after 30 more days of
inactivity. Reopen the issue with /reopen. Mark the issue as
fresh by adding the comment /remove-lifecycle stale.
/reopen /remove-lifecycle stale
@aliok: Reopened this issue.
In response to this:
/reopen /remove-lifecycle stale
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.
@matzew @lkingland What do you think?
@matzew @lkingland What do you think?
Yes, I would like to explore offering more customizable templates and integration with Backstage.
Let's discuss how this might work in practice either async via Slack or a meeting; at your convenience. I have a few thoughts.