You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After comparing with popular Serverless/FaaS open-source products, We chose to integrate with Knative which is host by Google/RedHat/IBM[1].
Easegress has a Controller called Function for abstracting the communication between Easegress's HTTP server and Function provider(Knative) locally with the help of a separate FaaSServer binary.
Proposal
Refactor Easegress' Function Controller to support FaaS CRUD operation with its own RESTful API. Move original FaaSServer's logic into the Easegress' Function controller.
The Function controller manages a shared HTTPServer and one pipeline per Knative function.
Design
Roles
FaaSController: An controller in Easegress, will listen to a port in HTTP protocol and forward ingress traffic to FaaS Provider's function instances locally. It manages one or many FaaSFunction vias its RESTful API.
FaaSFunction: One logic concept in Easegress, will represent a FaaS Provider's function instances, has its own lifecycle, shared with the same HTTP port own by the FaaSController who created it. Its spec will be stored in Easegress's ETCD.
FaaSProvider: The physical FaaS function instance manager, currently, is Knative.
Function controller spec
name: faascontroller-1kind: Functionprovider: knative # FaaS provider kind, currently we only support KnativehttpServer:
http3: falseport: 10083keepAlive: truekeepAliveTimeout: 60shttps: falsecertBase64:
keyBase64:
maxConnections: 10240knative:
functionHost: 127.0.0.1.xip.io # the host for Knative functions shared part, FaaSController will forward ingress traffic to this host combining with function's name
Function spec
name: demoimage: dev.local/colorddeploy:14.0 # the function logic, currently we only support HTTP protocolautoScaleType: concurrency # there are three kinds of scale type, concurrency/rps/cpuPercentautoScaleValue: "300"# the scaling metrics valueminReplica: 1# the function's minimum instance number maxReplica: 5# the function's maximum instance numberlimitCPU: 200m# the function's maximum CPU resource ( the same in K8s's Pod resource limitation)limitMemory: 80Mi # the function's maximum memory resource ( the same in K8s's Pod resource limitation) requestCPU: 100m# the function's minimum CPU resource ( the same in K8s's Pod resource request)requestMemory: 40Mi # the function's minimum memory resource ( the same in K8s's Pod resource request)requestAdaptor: # optional, indicate how FaasController should transform original HTTP request to FaaSProvider's needed formatmethod: POST # change HTTP method to `POST` for visiting FaaSProvider's function path:
replace: / # replace HTTP Path to '/', also support Regexp replacing, trimming or adding. header:
set:
X-Func: func-demo # add one HTTP header
Lifecycle
There four types of function status, Pending, Active, InActive, and Failed[2]. Basically, they come from AWS Lambda's status.
Once the function has been created in Easegress, its original status is pending. After the function had been provisioned successfully by FaaSProvider(Knative), its status will become active. At last, FaaSController will add the routing rule in its HTTPServer for this function.
Easegress's FaaSFunction will be active not matter there are requests or not. Stop function execution by calling FaaSController's stop RESTful API, then it will turn function into inactive. Updating function's spec for image URL or else fields, or deleting function also need to stop it first.
After updating the function, it will run into pending status. (Once provision successfully, it will become active automatically)
FaaSController will remove the routing rule in its HTTPServer for rejecting one function's ingress traffic when it's in inactive status. (Then the client will receive HTTP 404 failure response. For becoming zero-downtime, deploy another new FaaSfunction in this FaaSController may be helpful)
Background
Controller
calledFunction
for abstracting the communication between Easegress's HTTP server and Function provider(Knative) locally with the help of a separate FaaSServer binary.Proposal
Design
Roles
Function controller spec
Function spec
Lifecycle
There four types of function status, Pending, Active, InActive, and Failed[2]. Basically, they come from AWS Lambda's status.
pending
. After the function had been provisioned successfully by FaaSProvider(Knative), its status will becomeactive
. At last, FaaSController will add the routing rule in its HTTPServer for this function.active
not matter there are requests or not. Stop function execution by calling FaaSController'sstop
RESTful API, then it will turn function intoinactive
. Updating function's spec for image URL or else fields, or deleting function also need to stop it first.pending
status. (Once provision successfully, it will becomeactive
automatically)inactive
status. (Then the client will receive HTTP 404 failure response. For becoming zero-downtime, deploy another new FaaSfunction in this FaaSController may be helpful)RESTful APIs
The RESTful API path obey this design
http://host/{version}/{namespace}/{scope}(optional)/{resource}/{action}
,References
The text was updated successfully, but these errors were encountered: