Add-ons
Register an add-on built outside funcd, such as rauthy, declare its objects, run Functions and Jobs on the runtimes it ships, call their engines from a Function, apply their settings, reconcile an engineless kind's objects, back them up and sign users in through them.
This page lists the spec and status fields of Addon, AddonObject and AddonRevision, each with its type, its limits and its description. The Platform page explains the concept, and the metadata of every kind is the same.
Addon
apiVersion: funcd.io/v1alpha1
kind: Addon
metadata:
name: rauthy
spec:
runtimes:
- name: rauthy
image: ghcr.io/pyvvo/funcd-rauthy@sha256:7686fef5edcb27399e23f8386fecb03b13f909966d2c3c4708095e2c31ccfe2d
workloads:
- Engine
attributes:
kind: IdentityProvider
port: 8080
basePath: /auth/v1
privatePaths:
- /auth/v1/clients_dyn
readiness:
path: /auth/v1/ping
storage:
path: /app/data
uid: 10001
gid: 10001
config:
type: object
additionalProperties: false
properties:
publicHost:
type: string
https:
type: boolean
required:
- publicHost
- https
env:
PUB_URL: ${{ config.publicHost }}
PROXY_MODE: '${{ config.https ? "true" : "false" }}'
secretKeys:
- ENC_KEYS
- ENC_KEY_ACTIVE
snapshot:
path: /app/data/state_machine/backups
restore:
path: /app/data/restore
env:
HQL_BACKUP_RESTORE: ${{ "file:" + restore.file }}
settings:
- kind: RauthyPasswordPolicy
target: spec.config.provider
resync: 10m
function:
image: ghcr.io/example/rauthy-settings@sha256:b8390e254d5f99832bdcfa0567d144725d1d96907c9da01dc5917f71c3989cba
constraints:
count:
perTarget: 1
immutable:
- spec.config.provider| apiVersion | kind |
|---|---|
funcd.io/v1alpha1 | Addon |
Addon.spec
| Field | Type and limits | Description |
|---|---|---|
runtimes | array of Addon.spec.runtimes[], required | The runtimes that the add-on ships, each an image and the workloads it serves. At most one entry runs the add-on's kind; an Addon whose entries run none adds no kind, and may gain one once. |
Addon.spec.runtimes[]
| Field | Type and limits | Description |
|---|---|---|
attributes | object, Addon.spec.runtimes[].attributes | The entry's fields for its workloads: an Engine entry's kind, config, settings and engine fields; an Engineless entry's kind, config, function and resync. A Function or Job entry takes none. |
image | string, matching ^[^:@\s]+(:[0-9]+/[^:@\s]+)?@sha256:[a-f0-9]{64}$ | The image, pinned by digest as <repository>@sha256:<64 hex digits>, from a registry that addons.registries lists, and pulled as an engine's. A registry taken out of that list stops no worker or engine, and refuses the Addon's next change. |
name | string, required, a DNS-1123 label | The runtime's name, which a Function's or a Job's spec.runtime names: a DNS label that is none of funcd's runtimes (nodejs22, python314, duckdb, rqlite), does not start with node or python, is no key of runtime.containerd.imageOverride, and that no other Addon ships. |
workloads | array of string values, required, each one of Function, Job, Engine, Engineless | What the entry serves: Function and Job, which Functions and Jobs may name in spec.runtime; Engine, alone, which runs one engine of the image per object of the entry's kind; or Engineless, alone, whose kind's objects run no engine and no image: a Function of their namespace reconciles them. |
Addon.spec.runtimes[].attributes
| Field | Type and limits | Description |
|---|---|---|
basePath | string | The path under which the edge serves an object's engine, which the engine gets as it was called. It begins with /, does not end with / unless it is /, and holds no empty, . or .. segment. Empty is /. |
config | any JSON value | An Engine entry's JSON Schema of the objects' spec.config, within funcd's contract profile: closed objects, and no $ref. funcd refuses an object whose config breaks it; an object stored before a change that its config breaks waits in Pending with ConfigInvalid, with no engine. An Engineless entry sets none: its Function's contract describes its objects. |
env | map of string to string | The engine's environment. Each value is a literal, or a single ${{ }} expression over config, such as ${{ config.issuer }}, which funcd checks against the config schema when the Addon is applied. A value that is not a string reaches the engine as its JSON; one that fails holds the object in Pending with EnvInvalid. |
function | object, Addon.spec.runtimes[].attributes.function | An Engineless entry's Function, which reconciles the objects of its kind and which funcd calls with their list: an image, from which funcd creates one Function for each object, or an existing Function of each object's namespace. An object may name its own in spec.functions. |
kind | string, matching ^[A-Z][A-Za-z0-9]{1,62}$ | The namespaced kind that the entry runs: an upper-case letter, then 1 to 62 letters or digits. Its objects are served at /apis/funcd.io/v1alpha1/namespaces/<namespace>/<plural>, where the plural is the kind in lower case with an s. funcd refuses a kind that is its own, or whose plural is a path funcd serves or another Addon's plural, whatever the case. An Addon gains its kind once: it cannot change or go. |
port | integer, 1 to 65535 | The port that the engine serves on, in its own network namespace; an Engine entry requires it. Only funcd reaches it. |
privatePaths | array of string values | Paths under basePath that the edge answers with 404, however a caller spells them; funcd reaches them at the engine's own address. Each has basePath's form and lies under it. |
readiness | object, Addon.spec.runtimes[].attributes.readiness | How funcd learns that an object's engine is ready; an Engine entry requires it. |
restore | object, Addon.spec.runtimes[].attributes.restore | How the engine loads a copy at its start, which an in-place Restore of an object puts in place. Unset, an object of the add-on cannot be restored. |
resync | string, a duration: whole numbers with the units h, m, s and ms, largest unit first (10m, 1h30m, 500ms) | How often funcd sends an Engineless kind's lists again with no change, from 1s to 24h; unset is 10m. |
secretKeys | array of string values | The keys of an object's bound Secrets that reach the engine's environment. A bound Secret's other keys do not. |
settings | array of Addon.spec.runtimes[].attributes.settings[] | Kinds of settings objects that the add-on adds beside kind. An object of one runs no engine: the kind's Function applies the objects of each target through the target's engine. |
snapshot | object, Addon.spec.runtimes[].attributes.snapshot | Where the engine writes its own consistent copies, which a Backup of an object copies. Unset, a Backup that names an object of the add-on fails with reason NoSnapshot, and a resourceGroup scope leaves the add-on's objects out. |
storage | object, Addon.spec.runtimes[].attributes.storage | A directory that outlives each object's engine, kept across a replaced engine and funcd's restarts. Unset, the engine keeps nothing. |
Addon.spec.runtimes[].attributes.function
| Field | Type and limits | Description |
|---|---|---|
image | string | A Function's artifact, pinned by digest, from a registry that addons.registries lists. funcd creates the Function from it and puts back what differs: it runs the export handle, has no address of its own, and binds the object that runs an engine, the object's Secrets and an engineless object's Jobs. The artifact's contract describes the objects, and funcd refuses one whose config breaks it. Set either image or ref. |
ref | string, a DNS-1123 label | The name of an existing Function in the object's namespace. funcd does not create or change it, and the objects wait while it is missing. Their config has no schema, and the kind takes no rules. Set either image or ref. |
Addon.spec.runtimes[].attributes.readiness
| Field | Type and limits | Description |
|---|---|---|
path | string, required | The path that funcd sends GET to on the engine's port. The object turns Ready once it answers 200. |
Addon.spec.runtimes[].attributes.restore
| Field | Type and limits | Description |
|---|---|---|
env | map of string to string | The environment of the start that loads the copy, laid over env. Each value is a literal, or a single ${{ }} expression over config and restore, such as ${{ "file:" + restore.file }}: restore.file is the copy's path in the engine. |
path | string, required | The folder in the engine where funcd puts the copy that the next start loads: under storage.path, and neither snapshot.path nor inside it. funcd empties it before it writes the copy, and removes the copy once the engine that loaded it is Ready. |
timeout | string, a duration: whole numbers with the units h, m, s and ms, largest unit first (10m, 1h30m, 500ms) | How long an in-place Restore waits for the engine to load the copy and start again without restore.env, from 1s to 1h; unset is 10m. Past it, the Restore fails with reason RestoreTimedOut and the namespace stays held. |
Addon.spec.runtimes[].attributes.settings[]
| Field | Type and limits | Description |
|---|---|---|
constraints | object, Addon.spec.runtimes[].attributes.settings[].constraints | What an object must keep at admission, beside its schema, which is its Function's contract. |
function | object, Addon.spec.runtimes[].attributes.function, required | The Function that applies a target's objects: an image, from which funcd creates one Function for each target that an object of the kind names, or an existing Function of the target's namespace. A target may name its own in its spec.functions. |
kind | string, required | The settings kind, a kind name as the Addon's kind is, served at its plural. |
resync | string, a duration: whole numbers with the units h, m, s and ms, largest unit first (10m, 1h30m, 500ms) | How often funcd sends a target's objects again with no change, from 1s to 24h; unset is 10m. |
target | string, required | The string field under spec.config that names the object's target, such as spec.config.provider. A replace of the Addon cannot change it. |
Addon.spec.runtimes[].attributes.settings[].constraints
| Field | Type and limits | Description |
|---|---|---|
count | object, Addon.spec.runtimes[].attributes.settings[].constraints.count | How many objects of the kind a target or a namespace holds at most; 0 is no limit. |
immutable | array of string values | Fields under spec.config that a replace cannot change. |
rules | array of Addon.spec.runtimes[].attributes.settings[].constraints.rules[] | Conditions over object, oldObject and others that a write must meet. |
unique | array of string values | Fields under spec.config whose value no two objects of the kind in a namespace share. |
Addon.spec.runtimes[].attributes.settings[].constraints.count
| Field | Type and limits | Description |
|---|---|---|
perNamespace | integer, at least 0 | The most objects of the kind in a namespace. |
perTarget | integer, at least 0 | The most objects of the kind that name one target. |
Addon.spec.runtimes[].attributes.settings[].constraints.rules[]
| Field | Type and limits | Description |
|---|---|---|
message | string, required | What a refusal says. |
rule | string, required | A single ${{ }} condition over object, oldObject (on a replace) and others. |
Addon.spec.runtimes[].attributes.snapshot
| Field | Type and limits | Description |
|---|---|---|
path | string, required | The folder in the engine where it writes its copies: under storage.path, and neither restore.path nor inside it. A Backup copies the newest regular file there whose name does not end in ~ and that has not changed for 2 s, as it is. |
Addon.spec.runtimes[].attributes.storage
| Field | Type and limits | Description |
|---|---|---|
gid | integer, at least 0 | The group ID that owns the directory. |
path | string, required | Where the directory is mounted in the engine, an absolute path. |
uid | integer, at least 0 | The user ID that owns the directory: the user the engine's image runs as. |
Addon.status
| Field | Type and limits | Description |
|---|---|---|
conditions | array of Condition | The conditions that explain the phase. |
currentRevision | string, a DNS-1123 label | The AddonRevision of the Addon's latest spec: an object created, or edited outside an App, pins it, and an App's new revision records it. Empty until funcd has stamped the Addon's first revision. |
observedGeneration | integer | The generation of the spec that funcd last acted on. |
phase | string, one of Pending, Deploying, Ready, Idle, Degraded, Failed, Terminating | Where the object is in its lifecycle. |
AddonObject
apiVersion: funcd.io/v1alpha1
kind: IdentityProvider
metadata:
name: login
namespace: default
resourceGroup: default
spec:
config:
publicHost: login.example.com
https: true
bindings:
secret:
- rauthy-keys
ingress:
host: login.example.com| apiVersion | kind |
|---|---|
funcd.io/v1alpha1 | AddonObject |
AddonObject.spec
| Field | Type and limits | Description |
|---|---|---|
bindings | object, AddonObject.spec.bindings | What the object's engine uses, and what the Functions that funcd creates for the object from its kinds' images use. An object of a settings kind takes none, nor does one of an engineless kind whose Function is a ref. |
config | any JSON value | The object's settings, which its kind's schema checks: the config schema of its Addon's kind entry when the object runs an engine, else the contract of the kind's Function. Unset is an empty object. |
deletion | string, one of retain, delete | What becomes of the engine's storage once the object is deleted and its engine is gone: retain, the default, moves it into the quarantine for storage.quarantineRetention, from which it comes back by hand with funcd stopped; delete removes it. A new object of the same name starts empty either way. For an object of an Engineless kind, delete holds the object at its deletion, with metadata.deletionTimestamp set, until its Function answers ok to a call that carried it as deleting; retain lets it go at once, and the Function forgets it. |
functions | array of AddonObject.spec.functions[] | The object's own Function for a settings kind of its Addon, or for its own kind when that kind is Engineless, in place of the kind's function, so each copy of an App template applies its own objects. The objects it applies have no schema. A settings object names none. |
ingress | object, AddonObject.spec.ingress | Exposes the engine at the edge, on ingress.host under its Addon's basePath, while the object is Ready. Its own ingress.auth alone decides the stance, open when unset; ingress.path and the authenticated mode are refused. An object of a settings or an engineless kind takes none. |
kind | string | The add-on's kind, which funcd sets from the path the object is written at. |
resources | object, AddonObject.spec.resources | The cpu and memory of the object's engine. An empty cpu or memory sets no limit, and a change replaces the running engine. An object of a settings or an engineless kind takes none. |
AddonObject.spec.bindings
| Field | Type and limits | Description |
|---|---|---|
job | array of AddonObject.spec.bindings.job[] | The Jobs whose runs the Function that funcd creates for an engineless object starts and reads, by their alias. Only an object of an engineless kind whose function is an image takes them. |
secret | array of string values, each a DNS-1123 label | Secrets of the namespace whose keys, those that its Addon's kind entry lists in secretKeys, reach the engine's environment. funcd asks Cedar, as the object, for secret::read on each: a missing Secret holds the object in Pending with SecretNotFound, and a forbidden one with BindingResolveFailed. A changed value replaces the engine. The Functions that funcd creates for the object read every key of them. |
AddonObject.spec.bindings.job[]
| Field | Type and limits | Description |
|---|---|---|
alias | string, required, a DNS-1123 label | The name that the code passes to ctx.job.start and ctx.job.get. Unique in the list. |
job | string, required, a DNS-1123 label | A Job of the Function's namespace. While the Job is missing, a start on its alias answers 404, and a read still answers each run that a deleted Job left, until job.retention removes it. |
AddonObject.spec.functions[]
| Field | Type and limits | Description |
|---|---|---|
kind | string, required | A settings kind of the object's Addon, named once. |
ref | string, required, a DNS-1123 label | A Function of the object's namespace that binds the object in its bindings.addon, which funcd calls with the object's settings objects of the kind. In an App, a Function the App declares. |
AddonObject.spec.ingress
| Field | Type and limits | Description |
|---|---|---|
auth | object, AddonObject.spec.ingress.auth | How the edge checks callers at the resource's own address; unset, the namespace's spec.edgeDefaults.auth decides, else open. A Lake refuses it, since the Lake gateway checks each caller. |
enabled | boolean | Turns the resource's own address on or off. Unset, it is on unless the namespace's spec.defaultExposure is explicit; a Lake's address is on only when this is true. |
host | string | The exact host of the resource's own address. Empty is the namespace's host, <namespace>.<server.baseDomain>, or, in the default namespace, any host that no other namespace reserves. |
path | string | The edge path of the resource's own address, which begins with / and does not end with / unless it is /. Empty is / when host is set, else /function/<name>, /site/<name> or /lake/<name> by kind. |
AddonObject.spec.ingress.auth
| Field | Type and limits | Description |
|---|---|---|
mode | string, one of "", authenticated, open, oidc | How the edge checks callers. authenticated requires a bearer token, or an X-Api-Key header, of an identity that RBAC lets get Functions in the namespace: 401 without a valid one, 403 when it may not; while server.auth.edge is off, every caller gets 401. open lets anonymous callers in. oidc signs callers in with the OIDCProvider that provider names, and passes the signed-in user to the code behind it in the X-Funcd-Principal headers. Empty takes the enclosing stance, if any, else the namespace's spec.edgeDefaults.auth.mode, else open. |
provider | string, a DNS-1123 label | With mode oidc, the OIDCProvider of the namespace that signs callers in; required with oidc and refused with another mode. |
unauthenticated | string, one of "", redirect, 401, allow | With mode oidc, what a call that is not signed in gets: redirect, the default, sends a GET or HEAD navigation to the provider with 302 and gives any other call 401; 401 gives every such call 401; allow passes every call, with no principal. Refused with another mode. |
AddonObject.spec.resources
| Field | Type and limits | Description |
|---|---|---|
cpu | string | The CPU cap of the worker or engine it sizes, as a number of cores of at least 0.01, such as 0.5 or 2. Empty takes the default of the resource that declares it, or no cap when there is none. Only the containerd runtime enforces it. |
memory | string | The memory cap of the worker or engine it sizes, such as 256Mi or 4GiB: 1 to 15 digits and an optional binary unit, Ki, Mi, Gi or Ti, with or without a B, above zero. Empty takes the default of the resource that declares it, or no cap when there is none. Only the containerd runtime enforces it, and there a worker that uses more memory than the cap is killed. |
AddonObject.status
| Field | Type and limits | Description |
|---|---|---|
addonRevision | string, a DNS-1123 label | The AddonRevision whose spec the engine runs. A newer revision of the Addon moves no object: an edit of the object moves it to the Addon's current revision, and for an App's part, the App's revision moves it. |
address | string | The engine's own address, its host and port, which only funcd reaches. |
appRevision | string, a DNS-1123 label | For an App's part, the AppRevision whose record for its kind it pins: the App's latest revision once that one is applied. A part moves forward only. |
conditions | array of Condition | The conditions that explain the phase. |
observedGeneration | integer | The generation of the spec that funcd last acted on. |
phase | string, one of Pending, Deploying, Ready, Idle, Degraded, Failed, Terminating | Where the object is in its lifecycle. |
restore | object, AddonObject.status.restore | The in-place Restore whose copy the engine loads: it goes once an engine started without restore.env is Ready, or once that Restore has failed or is gone. While it stands, the namespace is held. |
workload | string, one of Function, Job, Engine, Engineless | The workload of the object's kind, which funcd stores at the object's first pass: Engineless for a kind whose objects run no engine, Engine once funcd has tried to start its engine. No call of its Function carries the object before then, and a deletion holds only an Engineless object. An Addon created again for the kind keeps it. |
AddonObject.status.restore
| Field | Type and limits | Description |
|---|---|---|
file | string, required | The copy's file name in the Addon's restore.path. |
restore | string, required, a DNS-1123 label | The Restore that placed the copy. |
state | string, required, one of Loading, Loaded | Loading while the engine starts with restore.env to load the copy; Loaded once the copy is gone, while the engine starts again without restore.env. |
AddonRevision
| apiVersion | kind |
|---|---|
funcd.io/v1alpha1 | AddonRevision |
AddonRevision.spec
| Field | Type and limits | Description |
|---|---|---|
addon | string, required, a DNS-1123 label | The Addon this revision belongs to. |
number | integer, required, at least 1 | The Addon's generation when funcd stamped this revision. Numbers may skip: funcd stamps the generation it reads. |
spec | object, Addon.spec, required | The Addon's spec at that generation. It never changes: an object that pins this revision runs its engine from it. |
AddonRevision.status
| Field | Type and limits | Description |
|---|---|---|
contracts | array of AddonRevision.status.contracts[] | The contract and the runtime of each kind whose function is an image, once funcd has read them from the registry. |
AddonRevision.status.contracts[]
| Field | Type and limits | Description |
|---|---|---|
contract | object, AddonRevision.status.contracts[].contract, required | The image's contract. What it says of one object's config is the kind's schema. |
kind | string, required | The kind whose function is the image. |
runtime | string, required, a DNS-1123 label | The runtime that the image declares, on which the kind's Functions run. |
AddonRevision.status.contracts[].contract
| Field | Type and limits | Description |
|---|---|---|
dialect | string | The URI of the JSON Schema dialect that input and output follow. funcd checks nothing against it. |
input | any JSON value | The JSON Schema of the input. A declared one must be an object, and each property it does not require must declare a default. |
output | any JSON value | The JSON Schema of the output. A declared one must be an object, and each property it does not require must declare a default. |
Handler API
The methods a handler calls on its context's clients, in each language funcd ships a shim for.
ctx.addon
The add-on objects that the function binds, by alias: fetch calls an object's engine through funcd, which serves only the paths that the object's edge entry serves.
| Method | What it does |
|---|---|
fetch(alias: string, path: string, init?: RequestInit): Promise<Response> | Sends an HTTP request to the engine of the add-on object that the function binds under alias, through funcd, and returns the engine's answer as a Response, whatever its status; funcd follows no redirect. path starts with "/" and may carry a query, and init sets the method, the headers and the body, as for the global fetch. Rejects with an AddonError when funcd refuses the call: 403 for an alias the function does not bind or a call a Policy forbids, 404 for a path the object's edge entry does not serve, 413 for a request or an answer body over addons.callPayloadLimit, 1 MiB by default, and 503 while the object is not Ready, while its namespace is held (with retryAfter), or when the engine does not answer within addons.callTimeout, 10 seconds by default. |
Each method here that calls funcd can also fail with the status 500 and the problem type urn:funcd:problem:internal, when funcd meets an error that it did not expect; funcd logs its cause.
When funcd refuses a call, the method fails with an error that holds funcd's status and problem type. This table gives them for each method, with when each happens and what to do.
| Method | Status | Problem type | When | What to do |
|---|---|---|---|---|
fetch | 403 | urn:funcd:problem:forbidden | The Function binds no add-on object under the alias. | Call an alias of spec.bindings.addon, or add it there. |
fetch | 403 | urn:funcd:problem:forbidden | Cedar denies the Function addon::call on the object, as when a Policy forbids it. | Ask the operator to lift the forbid. |
fetch | 404 | urn:funcd:problem:not-found | The path names no alias, or the object's edge entry would refuse it: outside its Addon's basePath, under one of its privatePaths, or with a .. segment. | Call a path under the Addon's basePath that it does not keep private. |
fetch | 413 | urn:funcd:problem:payload-too-large | The request's body is larger than the local API takes for the call. | Send a smaller body. |
fetch | 413 | urn:funcd:problem:payload-too-large | The engine's answer body is larger than addons.callPayloadLimit. | Ask for less, or ask the operator to raise addons.callPayloadLimit. |
fetch | 503 | urn:funcd:problem:unavailable | The caller's namespace is held while a Restore loads its data. | Retry after the Retry-After seconds. |
fetch | 503 | urn:funcd:problem:unavailable | The add-on object is not Ready, has no engine address yet, or its engine refused the connection. | Wait until the object is Ready, then retry. |
fetch | 503 | urn:funcd:problem:unavailable | The engine did not answer within addons.callTimeout. | Retry, or ask the operator to raise addons.callTimeout. |
fetch | 503 | urn:funcd:problem:unavailable | The engine's answer ended before its body did. | Retry. |
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/addons | List the Addons |
POST | /apis/funcd.io/v1alpha1/addons | Create an Addon |
GET | /apis/funcd.io/v1alpha1/addons/{name} | Read an Addon |
PUT | /apis/funcd.io/v1alpha1/addons/{name} | Replace an Addon |
DELETE | /apis/funcd.io/v1alpha1/addons/{name} | Delete an Addon |
GET | /apis/funcd.io/v1alpha1/namespaces/{namespace}/{plural} | List the objects of an add-on's kind in a namespace |
POST | /apis/funcd.io/v1alpha1/namespaces/{namespace}/{plural} | Create an object of an add-on's kind |
GET | /apis/funcd.io/v1alpha1/namespaces/{namespace}/{plural}/{name} | Read an object of an add-on's kind |
PUT | /apis/funcd.io/v1alpha1/namespaces/{namespace}/{plural}/{name} | Replace an object of an add-on's kind |
DELETE | /apis/funcd.io/v1alpha1/namespaces/{namespace}/{plural}/{name} | Delete an object of an add-on's kind |
GET | /apis/funcd.io/v1alpha1/namespaces/{namespace}/{plural}/{name}/logs | Read the logs of an add-on object's engine |
GET | /apis/funcd.io/v1alpha1/addonrevisions | List the AddonRevisions |
GET | /apis/funcd.io/v1alpha1/addonrevisions/{name} | Read an AddonRevision |