knative / func

Knative Functions client API and CLI
Apache License 2.0
279 stars 138 forks source link

Placeholders to pass values to template rendering #1996

Open aliok opened 1 year ago

aliok commented 1 year ago

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:

[^1]: Definition of what to keep hardcoded and what to parametrize needs some work.

github-actions[bot] commented 9 months ago

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.

aliok commented 9 months ago

cc @matzew

matzew commented 9 months ago

yes this would be super helpful

aliok commented 9 months ago

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

github-actions[bot] commented 6 months ago

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.

aliok commented 2 weeks ago

/reopen /remove-lifecycle stale

knative-prow[bot] commented 2 weeks ago

@aliok: Reopened this issue.

In response to [this](https://github.com/knative/func/issues/1996#issuecomment-2393707171): >/reopen >/remove-lifecycle stale Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes-sigs/prow](https://github.com/kubernetes-sigs/prow/issues/new?title=Prow%20issue:) repository.
aliok commented 2 weeks ago

@matzew @lkingland What do you think?

lkingland commented 2 weeks ago

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