OpenFunction is a cloud-native open source FaaS (Function as a Service) platform aiming to let you focus on your business logic without having to maintain the underlying runtime environment and infrastructure. You only need to submit business-related source code in the form of functions.
OpenFunction features include:
- Converting business-related function source code to application source code.
- Generating ready-to-run container images from the converted application source code.
- Deploying generated container images to any underlying runtime environments such as Kubernetes, and automatically scaling up and down from 0 to N according to business traffic.
- Providing event management functions for trigger functions.
- Providing additional functions for function version management, ingress management, etc.
OpenFunction manages resources in the form of Custom Resource Definitions (CRD) throughout the lifecycle of a function. To learn more about it, visit Components or Concepts.
OpenFunction Events is OpenFunction's events framework, you can refer to OpenFunction Events for more infomation.
The following Kubernetes versions are supported as we tested against these versions in their respective branches. Besides, OpenFunction might also work well with other Kubernetes versions!
OpenFunction | Kubernetes 1.17 | Kubernetes 1.18 | Kubernetes 1.19 | Kubernetes 1.20+ |
---|---|---|---|---|
release-0.3 |
β | β | β | β |
release-0.4 |
β | β | β | β |
release-0.5 |
β * | β * | β | β |
HEAD |
β * | β * | β | β |
*Note: OpenFunction has added the function ingress feature in release-0.5, which means that:
- You have to install OpenFunction in Kuberenetes v1.19 or later if you enable this feature.
- You can still use OpenFunction in Kubernetes v1.17βv1.20+ without this feature enabled.
Visit ofn releases page to download the latest version of ofn
, the CLI of OpenFunction, to install OpenFunction and its dependencies on your Kubernetes cluster.
Besides, you can perform the following steps to install the latest version of OpenFunction.
-
Run the following command to download
ofn
.wget -c https://github.com/OpenFunction/cli/releases/latest/download/ofn_linux_amd64.tar.gz -O - | tar -xz
-
Run the following commands to make
ofn
executable and move it to/usr/local/bin/
.chmod +x ofn && mv ofn /usr/local/bin/
-
Run the following command to install OpenFunction.
ofn install --all
You can refer to ofn install document for more information about the ofn install
command.
After you install OpenFunction, refer to OpenFunction samples to learn more about function samples.
Here is an example of a synchronous function:
This function writes "Hello, World!" to the HTTP response.
package hello
import (
"fmt"
"net/http"
)
func HelloWorld(w http.ResponseWriter, r *http.Request) {
fmt.Fprint(w, "Hello, World!\n")
}
Function ingress defines a unified entry point for a synchronous function. You can use it as in below format to access a synchronous function without configuring LB for Knative.
curl http://<domain-name>.<domain-namespace>/<function-namespace>/<function-name>
Here is an example of asynchronous function:
This function receives a greeting message and then send it to "another-target".
package bindings
import (
"encoding/json"
"log"
ofctx "github.com/OpenFunction/functions-framework-go/openfunction-context"
)
func BindingsOutput(ctx *ofctx.OpenFunctionContext, in []byte) ofctx.RetValue {
log.Printf("receive greeting: %s", string(in))
_ := ctx.Send("another-target", in)
return 200
}
You can also run the following command to make a quick demo:
ofn demo
By default, a demo environment will be deleted when a demo finishes. You can keep the demo kind cluster for further exploration by running
ofn demo --auto-prune=false
. The demo kind cluster can be deleted by runningkind delete cluster --name openfunction
.
For more information about how to use the ofn demo
command, refer to ofn demo document.
Run the following command to uninstall OpenFunction and its dependencies.
ofn uninstall --all
For more information about how to use the ofn uninstall
command, refer to ofn uninstall document.
See the Development Guide to get started with developing this project.
Learn more about OpenFunction roadmap.
Meeting room: Zoom
Meeting time: Wednesday at 15:30β16:30 Beijing Time (biweekly, starting from June 23rd, 2021)
Check out the meeting calendar and meeting notes.
OpenFunction is sponsored and open-sourced by the KubeSphere Team and maintained by the OpenFunction community.
- Slack: #sig-serverless
- Wechat: join the OpenFunction user group by following the KubeSphere WeChat subscription
OpenFunction enriches the CNCF Cloud Native Landscape.