2.2. Creating a function in the web console
You can create a function from a Git repository by using the OpenShift Container Platform web console.
Prerequisites
Before you can create a function by using the web console, a cluster administrator must complete the following steps:
- Install the OpenShift Serverless Operator and Knative Serving on the cluster.
- Install the OpenShift Pipelines Operator on the cluster.
Create the following pipeline tasks so that they are available for all namespaces on the cluster:
func-s2i and func-deploy tasks
$ kn func tkn-tasks | oc apply -f -Node.js function
$ oc apply -f https://raw.githubusercontent.com/openshift-knative/kn-plugin-func/serverless-1.34/pkg/pipelines/resources/tekton/pipeline/dev-console/0.1/nodejs-pipeline.yaml
- You must log into the OpenShift Container Platform web console.
- You must create a project or have access to a project with the appropriate roles and permissions to create applications and other workloads in OpenShift Container Platform.
-
You must create or have access to a Git repository that contains the code for your function. The repository must contain a
func.yamlfile and use thes2ibuild strategy.
Procedure
-
Navigate to +Add
Create Serverless function. The Create Serverless function page is displayed. - Enter a Git Repo URL that points to the Git repository that contains the code for your function.
In the Pipelines section:
- Select the Build, deploy and configure a Pipeline Repository radio button to create a new pipeline for your function.
- Select the Use Pipeline from this cluster radio button to connect your function to an existing pipeline in the cluster.
- Click Create.
Verification
- After you have created a function, you can view it in the Topology view.