apache / openserverless

Apache OpenServerless (incubating)
https://openserverless.apache.org
Apache License 2.0
407 stars 14 forks source link

Implement the proxy in main in the runtimes #53

Open sciabarracom opened 2 months ago

sciabarracom commented 2 months ago

The runtime proxy (repo: apache/openserverless-runtime) will support proxy with a main in this format:

<main>@<proxy>

so you provide for example --main=main@vastai.nuvolaris.io the runtime will behave as follow:

Some notes on the sintax:

To awoid security issues, enable the beaviour only if the the variable OW_USE_PROXY_MAIN is provided, so we will build a proxy image (that will be just the proxy without anything else)

francescotimperi commented 2 months ago

To add a bit more of context the idea it is to create a runtime with proxy capabilities which will assume that

Under this circumstances, the proxy will have to forward the request to a runtime running at the https://<hostname>:<port>, but the request has to be rewritten in a way that the --main params is transformed into something like --main main. The format main@<hostname>:<port> it not understood by any of the OpenWhisk action loop based runtimes, as they are only able to parse something like --main main or --main class#method (for Java).

francescotimperi commented 2 months ago

The current implementation has been packaged within the common1.18.0 version. The proxy can now support these two environment variables

to be used to set the proxy in proxy client mode or proxy server mode.

In client mode, the proxy simply forward the request to the URL specified via the --main attribute. In server mode, the proxy accept multiple init requests and therefore it is capable to run multiple actions

francescotimperi commented 2 months ago

For an initial complete implementation we need to add these capabilities to the proxy client/server mode