Configuration
Give a Function settings that are not secret through a ConfigMap, and read them in the handler.
This page lists the spec fields of ConfigMap, each with its type, its limits and its description. The Platform page explains the concept, and the metadata of every kind is the same.
ConfigMap
apiVersion: funcd.io/v1alpha1
kind: ConfigMap
metadata:
name: shared-settings
namespace: default
resourceGroup: rg1
spec:
data:
LOG_LEVEL: info
TIMEZONE: Europe/Paris| apiVersion | kind |
|---|---|
funcd.io/v1alpha1 | ConfigMap |
ConfigMap.spec
| Field | Type and limits | Description |
|---|---|---|
data | map of string to string | Keys and their string values, for settings that are not secret. Each key is an environment variable name: ASCII letters, digits and _, not starting with a digit. Each value must be UTF-8 text with no NUL byte: a Function or a Lake that binds a ConfigMap holding another value does not start. Each worker of a Function that lists the ConfigMap in bindings.config gets each key as an environment variable when it starts, except a key that starts with FUNCD_ or that a bound Secret also holds; and while the S3 gateway is on, a Function that binds a Bucket gets the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY that funcd issues it, in place of the ConfigMap's. A Lake that lists it gives its engine only the keys that the Lake's bindings.config lets through. |
Handler API
The methods a handler calls on its context's clients, in each language funcd ships a shim for.
ctx.config
The keys of the ConfigMaps that the function binds, with the values that the worker got when it started. A key that starts with FUNCD_ is left out, since funcd reserves that prefix. A key that a bound Secret also holds is left out too, and ctx.secret reads the Secret's value. While funcd's S3 gateway runs, a function that binds a Bucket reads the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY that funcd issues it, in place of a ConfigMap's.
| Method | What it does |
|---|---|
get(key: string): string | undefined | The key's value, or undefined when list() does not include the key. |
list(): string[] | The keys of the bound ConfigMaps, sorted, without the keys left out. |
HTTP API
The table lists each described operation of these kinds, with its method and path. The operation's page in the API reference gives its parameters, its body, its authentication and every answer, with when it happens and what to do.
| Method | Path | Operation |
|---|---|---|
GET | /apis/funcd.io/v1alpha1/namespaces/{namespace}/configmaps | List the ConfigMaps of a namespace |
POST | /apis/funcd.io/v1alpha1/namespaces/{namespace}/configmaps | Create a ConfigMap |
GET | /apis/funcd.io/v1alpha1/namespaces/{namespace}/configmaps/{name} | Read a ConfigMap |
PUT | /apis/funcd.io/v1alpha1/namespaces/{namespace}/configmaps/{name} | Replace a ConfigMap |
DELETE | /apis/funcd.io/v1alpha1/namespaces/{namespace}/configmaps/{name} | Delete a ConfigMap |