func icon indicating copy to clipboard operation
func copied to clipboard

Placeholders to pass values to template rendering

Open aliok opened this issue 2 years ago • 5 comments

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.

aliok avatar Sep 25 '23 13:09 aliok

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.

github-actions[bot] avatar Jan 14 '24 01:01 github-actions[bot]

cc @matzew

aliok avatar Jan 17 '24 13:01 aliok

yes this would be super helpful

matzew avatar Jan 17 '24 13:01 matzew

If we do this improvement, we can use these templates as-is in Backstage.

aliok avatar Jan 17 '24 14:01 aliok

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.

github-actions[bot] avatar Apr 18 '24 01:04 github-actions[bot]

/reopen /remove-lifecycle stale

aliok avatar Oct 04 '24 13:10 aliok

@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.

knative-prow[bot] avatar Oct 04 '24 13:10 knative-prow[bot]

@matzew @lkingland What do you think?

aliok avatar Oct 04 '24 13:10 aliok

@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.

lkingland avatar Oct 06 '24 00:10 lkingland