Create an OpenShift Serverless function
A Function as a Service (FaaS) object can be used to process data on an as-needed basis, which limits costs, since you only pay for the CPU cycles you need. In this learning path, you will learn how to implement a back-end function and a front-end web application, then use a FaaS object to process data.
Overview:Create an OpenShift Serverless function
You can use a Function-as-a-Service (FaaS) object to process data as needed, with the function shutting down after a period of time if unused. If you try to access the function after it has shut down, there will be a slight delay as it restores. Using a service in this way enables you to limit costs because you only pay for the CPU cycles when you actually need them.
In the world ofKubernetes, Knative is the most commonly used technology implementing the FaaS pattern.Red Hat OpenShift implements the FaaS pattern using Knative via the Red Hat OpenShift Serverless operator.
Prerequisites
You will need the following in order to complete this activity:
- ADeveloper Sandboxaccount
- The
oc
command-line interface - A web browser to access the Developer Sandbox
What you will do
This activity consists of two pieces: A back-end function and a front-end web application. You will implement both pieces. The back end is created from the command line, while the front end is created via the OpenShift web-based user interface (i.e., the dashboard). Here are the steps:
- Start the back-endserverless function.
- Start the front-end Photobooth application.
- Open the Photobooth application.
- Get the serverless URL.
- Paste the URL into Photobooth.
- Take a picture and observe the results.
What will you learn?
When you have finished this activity, you will be able to:
- Access the Developer Sandbox
- Create an OpenShift Serverless function from the command line or the dashboard
How long will this activity take?
- About 30 minutes
Programming languages
- You don’t need to know any programming languages to complete this task. If you want to view the code, the back-end is written inJava; the front-end is Blazor running in WebAssembly.
Need help?
- If you get stuck, if something isn’t working, or if you simply have questions, you can contact us via email atdevsandbox@redhat.com.