kyma-project / kyma-project/serverless
Rework serverless runtimes API
@halamix2 is already working on this.
Since Jun 23, 2026.
- Dominant language
- Go
- Stars
- 6
- Forks
- 27
- Avg merge
- 11h 11m
- Merged PRs (30d)
- 11
Description
Description
Design a new serverless runtimes API based on the issues and conclusions coming from using the current ones.
Reasons
Bring more user-friendly runtimes that users could reconfigure, or easily replace with their own built without limitations.
Acceptance Criteria
-
rework the handler's arguments. How it looks in other solutions:
Tool Nodejs Args Python Args Google Cloud Functions nodejs/python (req, res)(flask.req) -> flask.respAWS Lambdas nodejs/python (event)(event, context)Azure Functions nodejs/python (request, context)(req) -> respFission nodejs/python (context) -> resp()
Proposal 1
- the
eventcoming to the user's handler function should be a raw request or extending it with additional logic (right now its custom type described here) - get rid of the
contextargument coming to the user's handler function (docs)- deprecate (but still support) handlers with two arguments
- support handlers with one argument
- response is passed through the
returnlike it is described in the Flask docs
def main(event):
return "", 204
and
module.exports = {
main: function(req, res) {
// no support for tuples
return [ "", 204 ]
}
}
Proposal 2
reqandresare passed to the handler main funcreqis a raw request coming from the libraryresis an empty response that will be returned to the API consumer
def main(req, res):
res.setCode(204)
and
module.exports = {
main: function(req, res) {
data = req.body
...
res.setCode(204)
}
}
Proposal 3
- no args coming to the functions
- request and response are getting from the library
- we only support req and response manipulations by adding a custom sdk function
from flask import request
def main():
data = request.getData()
...
return '', 204
and
module.exports = {
main: function(req, res) {
res.setCode(204)
}
}
- function's SDK should be defined in a separate, included package which every user can import in the handler file (now it's a part of the
eventobject)
andimport skd ... tracer = sdk.get_tracer() sdk.publishCloudEvent(...)import {getTracer, publishCloudEvent} from sdk ... const tracer = getTracer() publishCloudEvent(...)
- redesign the ENVs architecture to include the whole configuration inside runtimes. The user should be able to reconfigure the runtime by passing custom environments to the Function CR, but the serverless-controller should not add any runtime-specific configuration through envs. Everything should be defaulted on the runtime level
-
function-controller should configure only the envs that runtime container could not calculate on its own (like source code, deps, path to sources, tracing endpoint, eventing endpoint
-
envs should have the right and unified naming convention, for example:
SERVER_*- server configurationHANDLER_*- users code configFUNC_*- function metadata (like name, namespace, annotations, labels)
-
all envs should have defaults defined insite the runtime container (expecting these ones that function-controller injects)
Example env configured inside the
server.pyfile:func_name=os.getenv('FUNC_NAME', '') func_namespace=os.getenv('FUNC_NAMESPACE', '') func_labels=os.getenv('FUNC_LABELS', '') func_annotations=os.getenv('FUNC_ANNOTATIONS', '') func_runtime=os.getenv('FUNC_RUNTIME', 'python314') server_host=os.getenv('SERVER_HOST', '0.0.0.0') server_port=int(os.getenv('SERVER_PORT', '8080')) server_numthreads=int(os.getenv('SERVER_NUMTHREADS', '50')) server_call_timeout=float(os.getenv('SERVER_CALL_TIMEOUT', '180')) handler_module_folder=os.getenv('HANDLER_FOLDER', '/') handler_module_name=os.getenv('HANDLER_MODULE_NAME', 'handler') handler_module_function=os.getenv('HANDLER_FUNCTION_NAME', 'main') tracecollector_endpoint = os.getenv('TRACE_COLLECTOR_ENDPOINT') publisher_proxy_address = os.getenv('PUBLISHER_PROXY_ADDRESS')
-
-
runtime should print basic configuration on run:
Importing function sources from <DIR>/<HANDLER_FILENAME>:<HANDLER_MAIN_FUNC> Tracing configured with endpoint <TRACECOLLECTOR_ENDPOINT> Publisher Proxy available on address <PUBLISHER_PROXY_ADDRESS> Starting <RUNTIME> server <HOST>:<PORT>
-
runtime should return standard response when the handler's code failed (500), for example:
$ curl localhost:8080 Internal Server Error
- refactor should be applied for the
python314and thenodejs26runtimes ONLY
We should work on both runtimes at the same time to keep the same API for both runtime types
Related Issues
runtime releases and their lifecycles:
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.