openfunction
Invokes an OpenFunction function as the upstream.
openfunctionPriority -1902What it does
openfunction answers the requests on a route from a function that runs on OpenFunction instead of an upstream. The gateway calls the function at Function URI, with Service token as its HTTP Basic credential when one is set.
When to use it
- A function your platform team runs on OpenFunction in the same Kubernetes cluster as the gateway, reached at its service address.
- An orders summary written as a function, published on the same host as the routes your own backend instances serve.
- A function that expects an HTTP Basic credential, which the gateway adds so that no client ever holds it.
Not for a backend of your own — see Upstream (Upstreams are the backends that routes and services send traffic to), a function on Apache OpenWhisk — see openwhisk (Invokes an Apache OpenWhisk action as the upstream) or code that runs inside the gateway itself — see serverless-pre-function (Runs Lua functions before the other plugins of a phase).
Set it up
Call a function with a service token and give it five seconds to answer
The token is sent as the HTTP Basic credential, so it is written as user:password.
Under Basics set Function URI to http://orders-summary.openfunction.svc.cluster.local and fill Authorization as in the JSON below. Under Behavior set Timeout to 5000 milliseconds.
{
"function_uri": "http://orders-summary.openfunction.svc.cluster.local",
"authorization": {
"service_token": "<secret>"
},
"timeout": 5000
}
Things to know
- Function URI — An empty Function URI is refused when you save.
- AdviceWrite the Service token as the user and the password the function expects, joined by a colon.
- AdviceSet Timeout to what the function needs on its slowest call, including a cold start.
Settings
The fields as the console shows them, section by section.
Basics
function_uristringRequiredThe function's full URL, to which whatever a route wildcard matched is appended.
authorizationobjectauthorization.service_tokenstringSent whole as the HTTP Basic credential, base64-encoded for you. Stored on the engine and shown only to roles that manage this object.
Behavior
timeoutintegerdefault 3000ssl_verifybooleandefault trueAdvanced
max_req_body_sizeintegerdefault 67108864The largest request body in bytes that is forwarded, where a larger one is rejected with 400.
keepalivebooleandefault truekeepalive_poolintegerdefault 5keepalive_timeoutintegerdefault 60000