Giter VIP home page Giter VIP logo

openfunction's Introduction

banner

Cloud native FaaS platform for running Serverless workloads with ease

A+ good first follow on Twitter

πŸ‘€ Overview

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:

  • Cloud agnostic and decoupled with cloud providers' BaaS
  • Pluggable architecture that allows multiple function runtimes
  • Support both sync and async functions
  • Unique async functions support that can consume events directly from event sources
  • Support generating OCI-Compliant container images directly from function source code.
  • Flexible autoscaling between 0 and N
  • Advanced async function autoscaling based on event sources' specific metrics
  • Simplified BaaS integration for both sync and async functions by introducing Dapr
  • Advanced function ingress & traffic management powered by K8s Gateway API (In Progress)
  • Flexible and easy-to-use events management framework

☸ Architecture

OpenFunction Architecture

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 information.

βœ”οΈ Compatibility

Kubernetes compatibility matrix

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.4 √ √ √ √
release-0.5 √ * √ * √ √
release-0.6 √ * √ * √ √
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.

πŸš€ QuickStart

Install OpenFunction

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.

  1. 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
    
  2. Run the following commands to make ofn executable and move it to /usr/local/bin/.

    chmod +x ofn && mv ofn /usr/local/bin/
    
  3. 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.

Run a function sample

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. Refer to here to find more samples of synchronous functions.

package hello

import (
	"fmt"
	"net/http"
)

func HelloWorld(w http.ResponseWriter, r *http.Request) {
	fmt.Fprintf(w, "Hello, %s!\n", r.URL.Path[1:])
}

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 an async function:

This function receives a greeting message and then send it to "another-target". Refer to here to find more samples of asynchronous functions.

package bindings

import (
	"encoding/json"
	"log"

	ofctx "github.com/OpenFunction/functions-framework-go/context"
)

func BindingsOutput(ctx ofctx.Context, in []byte) (ofctx.Out, error) {
	var greeting []byte
	if in != nil {
		greeting = in
	} else {
		greeting, _ = json.Marshal(map[string]string{"message": "Hello"})
	}

	_, err := ctx.Send("another-target", greeting)
	if err != nil {
		log.Printf("Error: %v\n", err)
		return ctx.ReturnOnInternalError(), err
	}
	return ctx.ReturnOnSuccess(), nil
}

One more example with tracing capability:

SkyWalking provides solutions for observing and monitoring distributed systems, in many different scenarios.

We have introduced SkyWalking (go2sky) for OpenFunction as a distributed tracing solution for Go language functions.

You can find the method to enable SkyWalking tracing for Go functions in tracing sample.

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 running kind delete cluster --name openfunction.

For more information about how to use the ofn demo command, refer to ofn demo document.

Uninstall OpenFunction

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.

FAQ

When you encounter any problems when using OpenFunction, you can refer to the FAQ for help.

πŸ’» Development

See the Development Guide to get started with developing this project.

πŸ›£οΈ Roadmap

Learn more about OpenFunction roadmap.

🏘️ Community

Community Call and Events

Meeting time:15:00-16:00(GMT+08:00), Thursday every two weeks starting from March 17th, 2022

Meeting room: Tencent Meeting

Tencent Meeting Number: 443-6181-3052

Check out the meeting calendar and meeting notes.

OpenFunction team has presented OpenFunction project in some community events including CNCF TAG-runtime meeting, Dapr community meeting, and OpenFunction community call. You can watch the recording videos and ask us anything.

Contact Us

OpenFunction is sponsored and open-sourced by the KubeSphere Team and maintained by the OpenFunction community.

Landscape



Β Β Β Β 

OpenFunction enriches the CNCF Cloud Native Landscape.

πŸ“Š Status

Alt

openfunction's People

Contributors

aarush-goyal avatar arugal avatar benjaminhuo avatar felixnoo avatar feynmanzhou avatar hurricane1988 avatar lizzzcai avatar tpiperatgod avatar wanjunlei avatar wentevill avatar wrongerror avatar yangchuansheng avatar zhu733756 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.