From 300fcd7d92ac673b9baf4e6ed5a540e796dc528d Mon Sep 17 00:00:00 2001 From: Tolga Ceylan Date: Tue, 3 Jul 2018 16:04:48 -0700 Subject: [PATCH] fn: applications should be aware of reserved writable space (#1083) Similar to FN_MEMORY, we pass FN_TMPSIZE to function config. --- api/agent/call.go | 1 + docs/developers/function-format.md | 1 + 2 files changed, 2 insertions(+) diff --git a/api/agent/call.go b/api/agent/call.go index 201c2e6d1..c69fdf672 100644 --- a/api/agent/call.go +++ b/api/agent/call.go @@ -154,6 +154,7 @@ func buildConfig(app *models.App, route *models.Route) models.Config { // TODO: might be a good idea to pass in: "FN_BASE_PATH" = fmt.Sprintf("/r/%s", appName) || "/" if using DNS entries per app conf["FN_MEMORY"] = fmt.Sprintf("%d", route.Memory) conf["FN_TYPE"] = route.Type + conf["FN_TMPSIZE"] = fmt.Sprintf("%d", route.TmpFsSize) CPUs := route.CPUs.String() if CPUs != "" { diff --git a/docs/developers/function-format.md b/docs/developers/function-format.md index 0bfa8dc34..23aa7e278 100644 --- a/docs/developers/function-format.md +++ b/docs/developers/function-format.md @@ -32,6 +32,7 @@ the function's format: * `FN_TYPE` - the type for this call, currently 'sync' or 'async' * `FN_MEMORY` - a number representing the amount of memory available to the call, in MB * `FN_CPUS` - a string representing the amount of CPU available to the call, in MilliCPUs or floating-point number, eg. `100m` or `0.1`. Header is present only if `cpus` is set for the route. +* `FN_TMPSIZE` - a number representing the amount of writable disk space available under /tmp for the call, in MB In addition to these, all config variables set on `app.config` or `route.config` will be populated into the environment exactly as configured, for example if `app.config = { "HAMMER": "TIME" }` your environment will be populated with `HAMMER=TIME`.