OpenFunction is a cloud-native open source FaaS (Function as a Service) platform aiming to enable users to focus on their business logic without worrying about the underlying runtime environment and infrastructure. Users only need to submit business-related source code in the form of functions.
OpenFunction features but not limited to the following:
- Convert business-related function source code to runnable application source code.
- Generate a deployable container image from the converted application source code.
- Deploy the generated container image to the underlying runtime environment such as K8s, and automatically scale up and down according to business traffic, and scale to 0 when there is no traffic.
- Provide event management functions for trigger functions.
- Provide additional functions to manage function versions, ingress management etc.
The current version of OpenFunction requires that you have a Kubernetes cluster with version >=1.18.6.
In addition, you need to deploy several dependencies for the OpenFunction Builder and Serving.
You can refer to the Installation Guide to setup OpenFunction Builder and Serving.
You need to install at least one of the following options for builders:
- Currently, OpenFunction Builder uses Tekton and Cloud Native Buildpacks to build container images, you need to install Tekton.
You need to install at least one of the following options for the serving component:
- Currently, OpenFunction Serving relies on Knative, so you need to install Knative Serving.
- Another Serving runtime Dapr + KEDA will be supported soon.
You can deploy Tekton and Knative follow this command.
sh hack/deploy-tekon-and-knative.shYou deploy Tekton and Knative follow this command if you having poor network connectivity to GitHub/Googleapis.
sh hack/deploy-tekon-and-knative.sh --poor-networkIf you want to use NodePort to expose the Tekton dashboard service, follow this command.
sh hack/deploy-tekon-and-knative.sh --tekton-dashboard-nodeport <port>The core function of OpenFunction is to enable users to develop, run, and manage business applications as execution units of code functions. OpenFunction implements the following custom resource definitions (CRDs):
Function, defines a function.Builder, defines a function builder.Serving, defines a function workload.
You can install the OpenFunction platform by the following command:
- Install the latest stable version
kubectl apply -f https://github.com/OpenFunction/OpenFunction/releases/download/v0.1.0/release.yaml- Install the development version
kubectl apply -f https://raw.githubusercontent.com/OpenFunction/OpenFunction/main/config/bundle.yamlNote: When using non-default namespaces, make sure that the ClusterRoleBinding in the namespace is adapted.
If you have already installed the OpenFunction platform, follow the steps below to run a sample function.
-
Creating a secret
In order to access your container registry, you need to create a secret. You can create this secret by editing the
usernameandpasswordfields inconfig/samples/registry-account.yaml, and then apply it.kubectl apply -f config/samples/registry-account.yaml
-
Creating functions
For sample function below, modify the
spec.imagefield inconfig/samples/function-sample.yamlto your own container registry address:apiVersion: core.openfunction.io/v1alpha1 kind: Function metadata: name: function-sample spec: image: "<your registry name>/sample-go-func:latest"
Use the following command to create this Function:
kubectl apply -f config/samples/function-sample.yaml
-
Result observation
You can observe the process of a function with the following command:
kubectl get functions.core.openfunction.io NAME AGE function-sample 5s
You can also observe the process of a builder in the Tekton Dashboard.
Finally, you can observe the final state of the function workload in the Serving:
kubectl get servings.core.openfunction.io NAME AGE function-sample-serving 15s
You can now find out the service entry of the function with the following command:
kubectl get ksvc NAME URL LATESTCREATED LATESTREADY READY REASON function-sample-serving-ksvc http://function-sample-serving-ksvc.default.<external-ip>.nip.io function-sample-serving-ksvc-00001 function-sample-serving-ksvc-00001 True
Or get the service address directly with the following command:
where
<external-ip>indicates the external address of your gateway servicekubectl get ksvc function-sample-serving-ksvc -o jsonpath={.status.url} http://function-sample-serving-ksvc.default.<external-ip>.nip.ioAccess the above service address via commands such as
curl:curl http://function-sample-serving-ksvc.default.<external-ip>.nip.io Hello, World!
You can uninstall the components of OpenFunction by executing the following command:
kubectl delete -f config/bundle.yamlYou can get help on developing this project by visiting Development Guide.
Here you can find OpenFunction's roadmap.

