You can define a common JavaScript Function as below:
apiVersion: core.openfunction.io/v1beta2
kind: Function
metadata:
name: node-sample
spec:
version: "v1.0.0"
image: "<your registry name>/sample-node-func:v1"
imageCredentials:
name: push-secret
port: 8080 # default to 8080
build:
builder: "openfunction/builder-node:latest"
env:
FUNC_NAME: "helloWorld"
FUNC_TYPE: "http"
srcRepo:
url: "https://github.com/OpenFunction/samples.git"
sourceSubPath: "functions/knative/hello-world-node/commonjs"
revision: "main"
serving:
runtime: "knative" # default to knative
template:
containers:
- name: function # DO NOT change this
imagePullPolicy: IfNotPresent