Job
Run code once with an input, read the run's result and logs, cancel a run, and give a Job the stores and network access that its code uses.
This page lists the spec and status fields of Job and JobRun, each with its type, its limits and its description. The Platform page explains the concept, and the metadata of every kind is the same.
Job
apiVersion: funcd.io/v1alpha1
kind: Job
metadata:
name: report
namespace: default
resourceGroup: rg1
spec:
runtime: nodejs22
handler: handle
image: registry.example.com/report:1.0.0
timeout: 10m
concurrency: 2
approval:
bypass: true| apiVersion | kind |
|---|---|
funcd.io/v1alpha1 | Job |
Job.spec
| Field | Type and limits | Description |
|---|---|---|
approval | object, Job.spec.approval | Whether a run waits for a person's approval of its preview before it runs. Unset, every run previews and waits. |
bindings | object, Job.spec.bindings | What the code may use: KV tables, Bucket prefixes, SQL databases, Lakes and Functions, each under an alias, and ConfigMaps and Secrets. A binding is the grant: a call on an alias with no binding is refused with 403. Each store, Lake, ConfigMap and Secret it names must be declared at the root, in this spec's kv, buckets, sql, lakes, configMaps or secrets. |
buckets | array of Job.spec.buckets[] | The Buckets the Job declares: by name it creates and owns one, and a Bucket of that name that it does not own holds it in Pending with StoreNotOwned; by ref it uses an existing one. spec.bindings.blob binds only a declared Bucket. |
concurrency | integer, 1 to 15 | How many of the Job's runs may hold a worker at once, those Previewing included: 1 to 15; unset means 1, and a local volume allows only 1. A run past it waits in Pending with Queued. |
configMaps | array of Job.spec.configMaps[] | The ConfigMaps the Job declares: by name it defines one from its data, which goes with the Job, by ref it uses an existing one. spec.bindings.config binds only a declared ConfigMap. |
handler | string, matching ^[A-Za-z_][A-Za-z0-9_.]*$ | The name of the export that the shim calls once for each run, such as handle. A Job without one, or whose code has no such export, is not Ready, with ShapeInvalid. |
image | string | The OCI reference of the code's artifact: a registry reference with a tag or a digest, or an oci-layout:// reference to a layout on the server's disk. A Job whose image is missing, or cannot be resolved or pulled, starts no run. |
imageDigest | string, a sha256 digest | The sha256 digest that funcd pulls the image by and checks it against. Unset, funcd resolves the image to its digest when it creates the Revision of a new spec and keeps that digest, so a tag that moves later changes nothing. |
kv | array of Job.spec.kv[] | The KVStores the Job declares: by name it creates and owns one, and a store of that name that it does not own holds it in Pending with StoreNotOwned; by ref it uses an existing one. spec.bindings.kv binds only a declared store. |
lakes | array of Job.spec.lakes[] | The Lakes the Job declares: by name it creates one that goes with the Job, by ref it uses an existing one. spec.bindings.lake binds only a declared Lake, and a Lake declared by name declares nothing at its own root: it binds the Job's buckets, configMaps and secrets. |
resources | object, Job.spec.resources | The CPU and memory caps of each run's worker; a field left empty takes functions.defaultResources. Only the containerd runtime enforces them. |
runtime | string, a DNS-1123 label | The runtime that runs the code, such as nodejs22 or python314, or one that an Addon ships for Jobs. A Job without one is not Ready, with ShapeInvalid, and one whose runtime this node cannot run is not Ready, with RuntimeUnavailable. |
secrets | array of Job.spec.secrets[] | The Secrets of the namespace that the bindings may name, each with the keys the code reads; spec.bindings.secret names only a declared Secret. The Job waits in Pending, with SecretNotFound or SecretKeyMissing, until each one exists with every declared key. |
sql | array of Job.spec.sql[] | The SQLDatabases the Job declares: by name it creates and owns one, and a database of that name that it does not own holds it in Pending with StoreNotOwned; by ref it uses an existing one. spec.bindings.sql binds only a declared database. |
timeout | string, a duration: whole numbers with the units h, m, s and ms, largest unit first (10m, 1h30m, 500ms) | The bound on each call of a run's handler, its preview's and its apply's, from its worker's start: 0s to 168h; 0s or unset means none. A run past it ends Failed with RunTimedOut, and its worker stops. |
volumes | array of Job.spec.volumes[] | The directories each run's worker mounts. Apply refuses a Job with one unless runtime.mode is containerd and volumes.capacity or volumes.capacityBytes is set. A local volume is the Job's own, never a same-named Function's, and allows a concurrency of at most 1. |
Job.spec.approval
| Field | Type and limits | Description |
|---|---|---|
bypass | boolean | When true, a run runs at once, with no preview and no approval. Unset or false, a run first calls the code's preview, then waits in AwaitingApproval until a person approves or rejects it. A Job for unattended work sets it. |
expiry | string, a duration: whole numbers with the units h, m, s and ms, largest unit first (10m, 1h30m, 500ms) | How long a preview stays valid for its approval: 1m to 168h; unset means 24h. A preview older than this when it is approved, or when its run's slot frees after the approval, is previewed again: the run runs when the new preview is the same document, and waits for a new approval when it differs. |
Job.spec.bindings
| Field | Type and limits | Description |
|---|---|---|
addon | array of Job.spec.bindings.addon[] | The add-on objects whose engines the code calls, each under its alias: through ctx.addon.fetch, or with any HTTP client at FUNCD_ADDON_<ALIAS>_URL with the header X-Funcd-Addon-Token set to FUNCD_ADDON_<ALIAS>_TOKEN. Each call goes through funcd, which asks Cedar for addon::call and serves only the paths that the object's edge entry serves. |
blob | array of Job.spec.bindings.blob[] | The Bucket prefixes the code reaches through ctx.blob, and over S3 while the S3 gateway is on, each under its alias. The binding grants reads; only the prefix's owner and the writers that a RolesAssignment names may write. A Bucket or prefix that does not exist yet holds the Function in Pending with BucketNotFound. |
config | array of string values, each a DNS-1123 label | ConfigMaps whose keys each worker gets as environment variables when it starts, a later ConfigMap's value winning for a key that both hold. A key that starts with FUNCD_, or that a bound Secret holds, is left out; 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 a ConfigMap's. A missing ConfigMap holds the Function Failed with ConfigResolveFailed. |
job | array of Job.spec.bindings.job[] | The Jobs whose runs the code starts with ctx.job.start and reads with ctx.job.get, each under its alias. The binding grants both, and a namespace Policy that forbids job::start or job::read to the Function revokes one. A run that the code starts passes the checks of a run that a person starts, and a Job's own spec refuses this list. |
kv | array of Job.spec.bindings.kv[] | The KV tables the code reaches through ctx.kv, each under its alias. The binding grants reads; only the table's owner and the writers that a RolesAssignment names may write. A store or table that does not exist yet holds the Function in Pending with KVStoreNotFound. |
lake | array of Job.spec.bindings.lake[] | The Lakes the code queries, each under its alias. The Function waits in Pending with LakeNotReady until every bound Lake is Ready. |
links | array of Job.spec.bindings.links[] | The Functions the code calls, each under its alias: through ctx.invoke one whose protocol is cloudevent, through ctx.fetch one whose protocol is http. Each target must exist in the namespace when this Function is applied, the namespace's links form no cycle, and a Function that a link targets cannot be deleted until the link goes. |
secret | array of string values, each a DNS-1123 label | Secrets whose keys the code reads through ctx.secret, on each read and with no cache, a later Secret's value winning for a key that both hold. No value reaches the worker's environment. No worker starts while a bound Secret is missing, and a worker whose Function a Policy forbids to read one is not ready. |
sql | array of Job.spec.bindings.sql[] | The SQLDatabases the code queries through ctx.sql, each under its alias. The binding grants reads; only the database's owner and the writers that a RolesAssignment names may write. A database that does not exist yet holds the Function in Pending with SQLDatabaseNotFound. |
Job.spec.bindings.addon[]
| Field | Type and limits | Description |
|---|---|---|
alias | string, required, a DNS-1123 label | The name the handler calls the object by: ctx.addon.fetch takes it, and the worker gets FUNCD_ADDON_<ALIAS>_URL and FUNCD_ADDON_<ALIAS>_TOKEN for an HTTP SDK. Unique in the list. |
object | string, required, a DNS-1123 label | An add-on object of the Function's namespace, declared by its App when an App holds the Function. A missing one holds the Function in Pending with AddonObjectNotFound. |
Job.spec.bindings.blob[]
| Field | Type and limits | Description |
|---|---|---|
alias | string, required, a DNS-1123 label | The binding's name, unique in the list; code that reaches the prefix through ctx.blob passes it. |
bucket | string, required, a DNS-1123 label | The Bucket, in the same namespace, that holds the prefix. |
prefix | string, required, a DNS-1123 label | The prefix, by its name in the Bucket's prefixes. |
Job.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. |
Job.spec.bindings.kv[]
| Field | Type and limits | Description |
|---|---|---|
alias | string, required, a DNS-1123 label | The binding's name, unique in the list, which the code passes to ctx.kv. |
store | string, required, a DNS-1123 label | The KVStore, in the same namespace, that holds the table. |
table | string, required, a DNS-1123 label | The table, by its name in the store's tables. |
Job.spec.bindings.lake[]
| Field | Type and limits | Description |
|---|---|---|
alias | string, required, a DNS-1123 label | The binding's name, unique in the list. Each worker reads the Lake's address and its token from FUNCD_LAKE_<ALIAS>_URL and FUNCD_LAKE_<ALIAS>_TOKEN, the alias upper-cased. |
lake | string, required, a DNS-1123 label | The Lake to query, in the same namespace. |
Job.spec.bindings.links[]
| Field | Type and limits | Description |
|---|---|---|
alias | string, required, a DNS-1123 label | The link's name, unique in the list, which the code passes to ctx.invoke or ctx.fetch. |
target | string, required, a DNS-1123 label | The Function to call, in the same namespace. |
timeout | string, a duration: whole numbers with the units h, m, s and ms, largest unit first (10m, 1h30m, 500ms) | Bounds the synchronous call, a cold-start wake included: 0s to 5m; 0s or unset means the 30s link default. |
Job.spec.bindings.sql[]
| Field | Type and limits | Description |
|---|---|---|
alias | string, required, a DNS-1123 label | The binding's name, unique in the list, which the code passes to ctx.sql. |
database | string, required, a DNS-1123 label | The SQLDatabase to query, in the same namespace. |
Job.spec.buckets[]
| Field | Type and limits | Description |
|---|---|---|
deletion | string, one of retain, delete | retain (the default) keeps the store and its data when the resource that declares it is deleted, and delete removes them. An App applies the same choice when it drops the entry. |
name | string, a DNS-1123 label | The object's name. It takes the namespace and resource group of the resource that declares it. |
prefixes | array of Job.spec.buckets[].prefixes[] | The Bucket's prefixes, each a key space with its own owner and cap. Prefix names are unique within the Bucket. A Function or a Lake that binds a prefix the Bucket does not list waits, with the reason BucketNotFound. |
quota | object, Job.spec.buckets[].quota | Caps on the Bucket's total size and on each object. While the Bucket has a size cap, funcd refuses to sign a presigned PUT URL for it, with 403. |
ref | string, a DNS-1123 label | The name of an existing object of this kind in the namespace of the resource that declares it. A ref entry sets no other field. |
Job.spec.buckets[].prefixes[]
| Field | Type and limits | Description |
|---|---|---|
name | string, required, a DNS-1123 label | The prefix's name, unique within the Bucket. Over S3, it is the first segment of each object's key. |
owner | object, Job.spec.buckets[].prefixes[].owner | The one Function, Lake or Job that may write the prefix, named with its kind, besides the writers that a RolesAssignment names. In a Bucket that a Function, a Lake or a Job declares by name, an omitted owner is that workload. In a Workflow's buckets, a Function owner names a step and a Lake owner a lake that the Workflow declares. The prefix that a Site serves its bundle from must have no owner, since the Site writes its builds there; the prefixes of a Site's ingress rules may have one. |
quota | object, Job.spec.buckets[].prefixes[].quota | A cap on the prefix's total size: a write into the prefix must fit both this cap and the Bucket's, and while it is set funcd refuses to sign a presigned PUT URL into the prefix, with 403. It also caps a Lake's files under the prefix, though not the Lake's catalog. |
Job.spec.buckets[].prefixes[].owner
| Field | Type and limits | Description |
|---|---|---|
kind | string, required, one of Function, Lake, Job | The workload's kind. A Function, a Lake and a Job may share a name, so the kind says which one it is; each field names the kinds it accepts. |
name | string, required, a DNS-1123 label | The workload's name, in the object's namespace. |
Job.spec.buckets[].prefixes[].quota
| Field | Type and limits | Description |
|---|---|---|
maxBytes | integer, at least 0 | The same cap as a number of bytes. Set maxSize or maxBytes, not both. |
maxSize | string, a size: 1 to 15 digits and an optional binary unit, Ki, Mi, Gi or Ti, with or without a B (512Ki, 2GiB) | The cap on the total size held, above zero. Set maxSize or maxBytes, not both; neither means no cap. A write that would pass the cap gets 507 in a KV store or a Bucket; a SQL execute call gets 507 once the database holds the cap. |
Job.spec.buckets[].quota
| Field | Type and limits | Description |
|---|---|---|
maxBytes | integer, at least 0 | The same cap as a number of bytes. Set maxSize or maxBytes, not both. |
maxObjectBytes | integer, at least 0 | The largest object a write may store, in bytes. A larger write gets 413, or EntityTooLarge over S3, and while it is set funcd refuses to sign a presigned PUT URL for the Bucket, with 403. 0 sets no cap of the Bucket's own, so only funcd's upload limits apply, such as s3gateway.maxUploadBytes. |
maxSize | string, a size: 1 to 15 digits and an optional binary unit, Ki, Mi, Gi or Ti, with or without a B (512Ki, 2GiB) | The cap on the total size held, above zero. Set maxSize or maxBytes, not both; neither means no cap. A write that would pass the cap gets 507 in a KV store or a Bucket; a SQL execute call gets 507 once the database holds the cap. |
Job.spec.configMaps[]
| 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. |
name | string, a DNS-1123 label | The ConfigMap's name, at most 52 characters. It is stored as <name>-<hash of data>, and the config of each part that names it is set to that stored name. |
ref | string, a DNS-1123 label | The name of an existing object of this kind in the namespace of the resource that declares it. A ref entry sets no other field. |
Job.spec.kv[]
| Field | Type and limits | Description |
|---|---|---|
deletion | string, one of retain, delete | retain (the default) keeps the store and its data when the resource that declares it is deleted, and delete removes them. An App applies the same choice when it drops the entry. |
name | string, a DNS-1123 label | The object's name. It takes the namespace and resource group of the resource that declares it. |
quota | object, Job.spec.kv[].quota | Caps on the store's total size, on each value and on each key. |
ref | string, a DNS-1123 label | The name of an existing object of this kind in the namespace of the resource that declares it. A ref entry sets no other field. |
tables | array of Job.spec.kv[].tables[] | The store's tables. A table is a key space that only its owner and the writers that a RolesAssignment names may write. Table names are unique within the store, and a store with no table has nothing a Function can write. |
Job.spec.kv[].quota
| Field | Type and limits | Description |
|---|---|---|
maxBytes | integer, at least 0 | The same cap as a number of bytes. Set maxSize or maxBytes, not both. |
maxKeyBytes | integer, 0 to 64000 | The longest key, in bytes. 0 means 1024 (1 KiB). |
maxSize | string, a size: 1 to 15 digits and an optional binary unit, Ki, Mi, Gi or Ti, with or without a B (512Ki, 2GiB) | The cap on the total size held, above zero. Set maxSize or maxBytes, not both; neither means no cap. A write that would pass the cap gets 507 in a KV store or a Bucket; a SQL execute call gets 507 once the database holds the cap. |
maxValueBytes | integer, 0 to 1048576 | The largest value a write may store, in bytes. 0 means 1048576 (1 MiB). |
Job.spec.kv[].tables[]
| Field | Type and limits | Description |
|---|---|---|
name | string, required, a DNS-1123 label | The table's name, unique within the store. |
owner | object, Job.spec.buckets[].prefixes[].owner | The Function or Job that owns the table, in the store's namespace, named with its kind. The owner writes the table, and so does a principal that a RolesAssignment grants kv::write on the table, its store or its namespace, such as the KV Data Writer role. In a store that a Function or a Job declares, the owner defaults to that workload; in one that a Workflow declares, a Function owner names a step, and the Function that funcd creates for that step is the owner; in a KVStore applied on its own, a table with no owner is written only through such a grant. Every workload, the owner included, reaches the table through an entry of its spec.bindings.kv. |
Job.spec.lakes[]
| Field | Type and limits | Description |
|---|---|---|
bindings | object, Job.spec.lakes[].bindings | What the Lake's engine uses: Bucket prefixes, and the ConfigMaps and Secrets of its environment. |
buckets | array of Job.spec.lakes[].buckets[] | The Buckets that a Lake applied on its own declares: by name the Lake creates the Bucket, an omitted prefix owner being the Lake, and a Bucket of that name that is not the Lake's holds it in Pending with StoreNotOwned; by ref it binds an existing one. Each Bucket that the Lake's bindings.blob names must be declared here. A lake that another resource declares sets none. |
configMaps | array of Job.spec.lakes[].configMaps[] | The ConfigMaps that a Lake applied on its own declares: by name the Lake defines one, and a ConfigMap of its stored name that is not the Lake's holds it in Pending with StoreNotOwned; by ref it binds an existing one. Each ConfigMap that the Lake's bindings.config names must be declared here. A lake that another resource declares sets none. |
ingress | object, Job.spec.lakes[].ingress | Exposes the Lake gateway at the edge, only when enabled is true and while the Lake is Ready. The path defaults to /lake/<name>, or / with a host. Setting auth is refused, since the Lake gateway checks each caller itself. |
location | object, Job.spec.lakes[].location | The Bucket prefix that holds the Lake's files, one of the Lake's bindings.blob. The Lake waits in Pending, with the reason PrefixNotOwned, until the prefix's owner is this Lake. The Lake's catalog is kept outside the Bucket, under the same location, so a Lake located where another was finds that Lake's files and catalog. |
name | string, a DNS-1123 label | The object's name. It takes the namespace and resource group of the resource that declares it. |
ref | string, a DNS-1123 label | The name of an existing object of this kind in the namespace of the resource that declares it. A ref entry sets no other field. |
resources | object, Job.spec.resources | The cpu and memory of the Lake's engine. An empty cpu or memory sets no limit on it, and a change replaces the running engine. |
secrets | array of Job.spec.lakes[].secrets[] | The Secrets that a Lake applied on its own declares, with the keys its engine reads. Each Secret that the Lake's bindings.secret names must be declared here, and the Lake waits in Pending, with SecretNotFound or SecretKeyMissing, while one is missing or lacks a key. A lake that another resource declares sets none. |
Job.spec.lakes[].bindings
| Field | Type and limits | Description |
|---|---|---|
blob | array of Job.spec.bindings.blob[], required | The Bucket prefixes the engine may read, each under an alias. It writes only a prefix whose owner is this Lake, and the Lake's location must be one of them. |
config | array of string values, each a DNS-1123 label | ConfigMaps whose data the engine gets as environment variables. Only QUACK_TOKEN and the DUCKDB_ keys pass, DUCKDB_EXTENSION_DIRECTORY excepted, and a bound Secret's value wins over a ConfigMap's for the same key. A missing ConfigMap holds the Lake in Pending, with the reason BindingResolveFailed. |
secret | array of string values, each a DNS-1123 label | Secrets whose data the engine gets as environment variables, such as its QUACK_TOKEN; the same keys pass as for config. funcd asks Cedar, as the Lake, for secret::read on each: a forbidden Secret holds the Lake in Pending, with the reason BindingResolveFailed, as does a missing one in a lake that another resource declares. A changed value replaces the engine. |
Job.spec.lakes[].buckets[]
| Field | Type and limits | Description |
|---|---|---|
deletion | string, one of retain, delete | retain (the default) keeps the store and its data when the resource that declares it is deleted, and delete removes them. An App applies the same choice when it drops the entry. |
name | string, a DNS-1123 label | The object's name. It takes the namespace and resource group of the resource that declares it. |
prefixes | array of Job.spec.buckets[].prefixes[] | The Bucket's prefixes, each a key space with its own owner and cap. Prefix names are unique within the Bucket. A Function or a Lake that binds a prefix the Bucket does not list waits, with the reason BucketNotFound. |
quota | object, Job.spec.buckets[].quota | Caps on the Bucket's total size and on each object. While the Bucket has a size cap, funcd refuses to sign a presigned PUT URL for it, with 403. |
ref | string, a DNS-1123 label | The name of an existing object of this kind in the namespace of the resource that declares it. A ref entry sets no other field. |
Job.spec.lakes[].configMaps[]
| 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. |
name | string, a DNS-1123 label | The ConfigMap's name, at most 52 characters. It is stored as <name>-<hash of data>, and the config of each part that names it is set to that stored name. |
ref | string, a DNS-1123 label | The name of an existing object of this kind in the namespace of the resource that declares it. A ref entry sets no other field. |
Job.spec.lakes[].ingress
| Field | Type and limits | Description |
|---|---|---|
auth | object, Job.spec.lakes[].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. |
Job.spec.lakes[].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. |
Job.spec.lakes[].location
| Field | Type and limits | Description |
|---|---|---|
bucket | string, required, a DNS-1123 label | A Bucket of the same namespace. |
prefix | string, required, a DNS-1123 label | A prefix of that Bucket. |
Job.spec.lakes[].secrets[]
| Field | Type and limits | Description |
|---|---|---|
description | string | What the Secret is for, for the installer who provides it. |
keys | array of string values, required, each matching ^[A-Za-z_][A-Za-z0-9_]*$ | The keys read from the Secret: its data must hold each of them. |
name | string, required, a DNS-1123 label | The name of a Secret in the namespace of the resource that declares it. funcd holds its value; the resource never writes it. |
Job.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. |
Job.spec.secrets[]
| Field | Type and limits | Description |
|---|---|---|
description | string | What the Secret is for, for the installer who provides it. |
keys | array of string values, required, each matching ^[A-Za-z_][A-Za-z0-9_]*$ | The keys read from the Secret: its data must hold each of them. |
name | string, required, a DNS-1123 label | The name of a Secret in the namespace of the resource that declares it. funcd holds its value; the resource never writes it. |
Job.spec.sql[]
| Field | Type and limits | Description |
|---|---|---|
deletion | string, one of retain, delete | retain (the default) keeps the store and its data when the resource that declares it is deleted, and delete removes them. An App applies the same choice when it drops the entry. |
name | string, a DNS-1123 label | The object's name. It takes the namespace and resource group of the resource that declares it. |
owner | object, Job.spec.buckets[].prefixes[].owner | The one Function, Lake or Job that may write the database, in its namespace, named with its kind, besides the writers that a RolesAssignment names. In a database that a Function or a Job declares by name, it defaults to that workload, and in a Workflow's sql a Function owner names a step and a Lake owner a lake that the Workflow declares. A Lake writes no SQL, so a database a Lake owns is written by those writers only. With no owner, only those writers can write it. |
quota | object, Job.spec.buckets[].prefixes[].quota | A cap on the database's total size, the bytes of its pages in use. Once it is reached, an execute gets 507 unless each of its statements is a DELETE or a DROP. A change keeps the engine running. |
ref | string, a DNS-1123 label | The name of an existing object of this kind in the namespace of the resource that declares it. A ref entry sets no other field. |
resources | object, Job.spec.resources | The cpu and memory of the database's engine. An empty memory means 256Mi, and an empty cpu sets no cpu limit. A change replaces the running engine. |
Job.spec.volumes[]
| Field | Type and limits | Description |
|---|---|---|
deletion | string, one of retain, delete | Only for a local volume declared by name: retain, the default, keeps the volume and its files with no owner when the Function drops it or is deleted, so that a ref can take it again; delete removes them. |
name | string, a DNS-1123 label | The volume's name, unique in the list; set name or ref, not both. The code reads the directory's path from FUNCD_VOLUME_<NAME>, the name or ref upper-cased. |
ref | string, a DNS-1123 label | Instead of name: a retained local volume that this Function, or an earlier Function of the same name, dropped with retain, and that the Function takes over; with no such volume, it waits in Pending with VolumeNotFound. Only a local volume takes a ref; it sets no deletion and states the retained volume's own size, since apply refuses another size. |
size | string, a size: 1 to 15 digits and an optional binary unit, Ki, Mi, Gi or Ti, with or without a B (512Ki, 2GiB) | The volume's size, the most its directory may hold, above zero; set size or sizeBytes, not both. Apply refuses a local volume whose size changes, or that does not fit both the capacity that volumes.capacity or volumes.capacityBytes sets and the namespace's spec.volumeBudget. |
sizeBytes | integer, at least 1 | The same size as a number of bytes. Set size or sizeBytes, not both. |
type | string, required, one of emptyDir, local | emptyDir is a new empty directory for each worker, removed with it; local is one durable directory that keeps its files through a crash, a redeploy and a scale to zero. A Function with a local volume runs at most 1 replica, and while it redeploys, its old and new workers hold the volume at once. |
Job.status
| Field | Type and limits | Description |
|---|---|---|
conditions | array of Condition | The conditions that explain the phase. |
contract | object, Job.status.contract | The input and output schemas of the current Revision's image, read by its digest. A new run's input is checked against the input schema; an image with none holds the Job with ContractMissing. |
currentRevision | string, a DNS-1123 label | The Revision of the latest spec, named <job>-v<generation>. A run pins the current one when it starts, and keeps it until it ends. |
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. |
Job.status.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. |
JobRun
apiVersion: funcd.io/v1alpha1
kind: JobRun
metadata:
name: report-2026-10
namespace: default
resourceGroup: rg1
spec:
job: report
input:
month: "2026-10"| apiVersion | kind |
|---|---|
funcd.io/v1alpha1 | JobRun |
JobRun.spec
| Field | Type and limits | Description |
|---|---|---|
approve | string, a sha256 digest | The digest of the preview that a person approves, status.preview.digest. A create that sets it is refused. An update that sets or changes it, or that keeps one with no recorded approval of the run's current preview, is taken only while the run is AwaitingApproval and the digest is the run's preview's, else it is refused with 409, and only from a caller who may update the run's Job, else with 403; an update that cancels or rejects the run is taken whatever it holds. It is never cleared. funcdctl job approve sets it. |
cancel | boolean | When true, the run is cancelled: a run that has not started ends Cancelled, and a running one has its worker stopped first, though its handler may have done part of its work. It may only turn true, and a run that has ended ignores it. funcdctl job cancel sets it. |
input | any JSON value | The run input, the data of the event that the handler receives. Over job.payloadLimit bytes, or off the input schema in the Job's status.contract, it is refused when the run is created. It is fixed once the run is created. |
job | string, required, a DNS-1123 label | The Job to run, in the run's namespace, fixed once the run is created. The run waits in Pending while that Job is missing or not Ready. |
reject | boolean | When true, the run ends Rejected and its handler never runs. A create that sets it is refused. An update may turn it true only while the run is Pending, Previewing or AwaitingApproval, and only from a caller who may update the run's Job; it may not turn false again. A rejection wins over an approval that funcd has not acted on yet. funcdctl job reject sets it. |
rejectReason | string, 0 to 512 characters | Why the run is rejected: the message of its Ready condition once it ends Rejected, at most 512 bytes, which a text of more than one byte per character reaches before 512 characters. It is set with spec.reject, and a create that sets it is refused. |
JobRun.status
| Field | Type and limits | Description |
|---|---|---|
approvedAt | string, an RFC3339 UTC timestamp with exactly 3 fractional digits (2026-10-07T20:03.965Z) | When a person approved the run's preview. funcd runs a run only on an approval it recorded. |
approvedBy | string | The subject of the credential that approved the run, which funcd sets with approvedAt; empty with none. A preview made again with another document clears both. |
conditions | array of Condition | The conditions that explain the phase. |
endedAt | string, an RFC3339 UTC timestamp with exactly 3 fractional digits (2026-10-07T20:03.965Z) | When the run ended. |
imageDigest | string | The digest of the image of the pinned Revision. |
jobRevision | string, a DNS-1123 label | The Revision of the Job that the run runs, pinned when it starts: an edit of the Job during the run changes nothing for it. |
jobUID | string | The UID of the run's Job, set when the run is created if the Job exists, else when it starts. A run whose Job is deleted, or re-created under a new UID, is cancelled. |
observedGeneration | integer | The generation of the spec that funcd last acted on. |
phase | string, one of Pending, Previewing, AwaitingApproval, Running, Succeeded, Failed, Cancelled, Rejected | Where the run is: Pending while it waits for its Job or for a free slot, Previewing while its worker answers the code's preview, AwaitingApproval while it waits for a person to approve or reject that preview, and Running while its worker runs the handler. Succeeded, Failed, Cancelled and Rejected are final, and the Ready condition gives the reason. |
preview | object, JobRun.status.preview | The answer of the code's preview, which a person approves by its digest. Empty for a run of a Job with approval.bypass. |
rejectedBy | string | The subject of the credential that rejected the run, which funcd sets; empty with none. |
result | any JSON value | The handler's answer, once the run Succeeded. |
startedAt | string, an RFC3339 UTC timestamp with exactly 3 fractional digits (2026-10-07T20:03.965Z) | When the run started running. |
startedBy | string | Who started the run, which funcd sets: the subject of the credential that created it, empty when there was none, or, for a run that a Function started through its spec.bindings.job, the Function's Cedar principal, such as Function::"default/planner". It records who started the run and grants nothing. |
traceId | string | The run's W3C trace ID, 32 lowercase hex characters, the same for its preview and its run. funcdctl job logs reads the run's logs by it. |
JobRun.status.preview
| Field | Type and limits | Description |
|---|---|---|
digest | string, required | sha256: and the hex digest of the preview's bytes, which spec.approve names. |
document | any JSON value, required | The JSON document that the preview answered, or the run's input when the code has no preview. |
previewedAt | string, required, an RFC3339 UTC timestamp with exactly 3 fractional digits (2026-10-07T20:03.965Z) | When the preview answered. A preview older than its Job's approval.expiry is previewed again when it is approved, or when its run's slot frees after the approval. |
Handler API
The methods a handler calls on its context's clients, in each language funcd ships a shim for.
ctx
The per-invocation context the shim passes to the handler.
| Method | What it does |
|---|---|
log(...args: unknown[]): void | Writes the arguments as one log line at level INFO, as console.log does. |
invoke<I = unknown, O = unknown>(alias: string, input: I): Promise<O> | Calls the function that the link named alias targets, and returns its result parsed from JSON, or null when it returns nothing. The target's event.data is input, except that an object with a top-level data or specversion key is taken as the whole CloudEvent, so event.data is only its data: send such an object inside an envelope, as { specversion: '1.0', data: { data: [1], page: 2 } }. The link's timeout, 30 seconds by default, bounds the call. Fails with the HTTP status 403 when the function declares no link named alias, 409 when the target serves HTTP, 422 when input does not match the target's contract, and the target's status when its handler fails, such as 500. |
fetch(alias: string, path: string, init?: RequestInit): Promise<Response> | Sends an HTTP request to the function that the link named alias targets, which serves HTTP, and returns its reply as a Response, whatever its status. path starts with "/" and may carry a query; init sets the method, the headers and the body, as for the global fetch. The request body and the reply are each at most 1 MiB, and the link's timeout, 30 seconds by default, bounds the call. Fails with the HTTP status 403 when the function declares no link named alias, and 409 when the target does not serve HTTP. |
remainingMs(): number | null | The whole milliseconds left before the call's deadline, 0 once it has passed, or null when the call has none. |
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 |
|---|---|---|---|---|
invoke | 403 | urn:funcd:problem:forbidden | The Function's spec.bindings.links has no entry for the alias. | Add the link to spec.bindings.links, or call an alias that the Function links. |
invoke | 403 | urn:funcd:problem:forbidden | A Policy forbids the Function to call the link's target. | Change or remove the Policy that forbids link::invoke on the target. |
invoke | 404 | urn:funcd:problem:not-found | The Function that the link targets no longer exists, as when its App deleted it before the Function that links it. | Create the Function again, or link one that exists. |
invoke | 409 | urn:funcd:problem:conflict | The link's target serves HTTP, which ctx.invoke does not call. | Call it with ctx.fetch, which only the TypeScript shim has, or link a Function whose protocol is cloudevent. |
invoke | 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. |
invoke | 413 | urn:funcd:problem:payload-too-large | The target's reply is larger than 1 MiB, the most that a call carries back. | Return a smaller reply, or pass the data through a Bucket. |
invoke | 429 | urn:funcd:problem:resource-exhausted | The target already has as many calls from Functions in flight as invoke.maxNestedInFlight allows. | Retry once a call to the target returns, or raise invoke.maxNestedInFlight. |
invoke | 503 | urn:funcd:problem:unavailable | The target's reply broke off before its end: its worker failed during the call, or the link's timeout ended it. | Retry the call, and raise the link's timeout if the target needs longer. |
fetch | 403 | urn:funcd:problem:forbidden | The Function's spec.bindings.links has no entry for the alias. | Add the link to spec.bindings.links, or call an alias that the Function links. |
fetch | 403 | urn:funcd:problem:forbidden | A Policy forbids the Function to call the link's target. | Change or remove the Policy that forbids link::invoke on the target. |
fetch | 404 | urn:funcd:problem:not-found | The path names no alias: it is not /fetch/<alias>/<path>. | Pass the alias of a link, and a path that starts with /. |
fetch | 404 | urn:funcd:problem:not-found | The Function that the link targets no longer exists, as when its App deleted it before the Function that links it. | Create the Function again, or link one that exists. |
fetch | 409 | urn:funcd:problem:conflict | The link's target does not serve HTTP, which ctx.fetch needs. | Call it with ctx.invoke, or link a Function whose protocol is http. |
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 target's reply is larger than 1 MiB, the most that a call carries back. | Return a smaller reply, or pass the data through a Bucket. |
fetch | 429 | urn:funcd:problem:resource-exhausted | The target already has as many calls from Functions in flight as invoke.maxNestedInFlight allows. | Retry once a call to the target returns, or raise invoke.maxNestedInFlight. |
fetch | 503 | urn:funcd:problem:unavailable | The target's reply broke off before its end: its worker failed during the call, or the link's timeout ended it. | Retry the call, and raise the link's timeout if the target needs longer. |
ctx.job
The Jobs that the function binds, by alias: start a run of one with an input, and read a run back.
| Method | What it does |
|---|---|
start(alias: string, input?: unknown, name?: string): Promise<string> | Starts a run of the Job that the function binds under alias, with input as the run's input, and returns the run's name at once, without waiting for the run. Without name, funcd names the run <job>-<id>, and a start sent again starts a second run; with name, a start sent again with the same input returns that run, so a function called more than once for one event, as at-least-once delivery does, names the run from the event's id. A run of a Job without approval.bypass waits for a person's approval. Rejects with a JobError: 403 when the function binds no Job under alias or a Policy forbids it, 404 when the Job does not exist, 409 when another run holds the name, 413 when the input passes job.payloadLimit, and 422 when it does not match the Job's input schema. |
get(alias: string, run: string): Promise<JobRunState> | Reads run, a run of the Job that the function binds under alias: its phase, its reason, its times and, once it Succeeded, its result. Rejects with a JobError: 403 when the function binds no Job under alias or a Policy forbids it, and 404 when the run is not one of that Job's, or funcd removed it after job.retention. |
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 |
|---|---|---|---|---|
start | 400 | urn:funcd:problem:invalid | The body of the start is not {"input": <JSON>, "name": "<run>"}, or the name is not a DNS-1123 name. | Send the input as JSON, and a name of lowercase letters, digits and dashes, or no name. |
start | 403 | urn:funcd:problem:forbidden | The Function binds no Job under the alias. | Start or read a run under an alias of spec.bindings.job, or add the alias there. |
start | 403 | urn:funcd:problem:forbidden | Cedar denies the Function job::start or job::read on the bound Job, as when a namespace Policy forbids it. | Ask the operator to lift the forbid. |
start | 404 | urn:funcd:problem:not-found | The Job that the alias binds does not exist. | Create the Job, or bind a Job that exists. |
start | 409 | urn:funcd:problem:conflict | Another run of the namespace holds the name: a run of another Job, or one with another input. | Start the run under another name, or with no name, so that funcd names it. |
start | 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. |
start | 413 | urn:funcd:problem:payload-too-large | The run's input is larger than job.payloadLimit. | Pass large data by reference, such as the key of an object in a Bucket. |
start | 422 | none | The input does not match the Job's input schema: funcd answers as a Function's call answers an input off its contract, with the contract's {"error", "details"} body, which the error keeps as its detail. | Send an input that the Job's contract takes. |
get | 403 | urn:funcd:problem:forbidden | The Function binds no Job under the alias. | Start or read a run under an alias of spec.bindings.job, or add the alias there. |
get | 403 | urn:funcd:problem:forbidden | Cedar denies the Function job::start or job::read on the bound Job, as when a namespace Policy forbids it. | Ask the operator to lift the forbid. |
get | 404 | urn:funcd:problem:not-found | No run of the bound Job has the name: the name is another Job's run's, or job.retention removed the run. | Read a run that ctx.job.start returned, before job.retention removes it. |
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}/jobs | List the Jobs of a namespace |
POST | /apis/funcd.io/v1alpha1/namespaces/{namespace}/jobs | Create a Job |
GET | /apis/funcd.io/v1alpha1/namespaces/{namespace}/jobs/{name} | Read a Job |
PUT | /apis/funcd.io/v1alpha1/namespaces/{namespace}/jobs/{name} | Replace a Job |
DELETE | /apis/funcd.io/v1alpha1/namespaces/{namespace}/jobs/{name} | Delete a Job |
GET | /apis/funcd.io/v1alpha1/namespaces/{namespace}/jobruns | List the JobRuns of a namespace |
POST | /apis/funcd.io/v1alpha1/namespaces/{namespace}/jobruns | Create a JobRun |
GET | /apis/funcd.io/v1alpha1/namespaces/{namespace}/jobruns/{name} | Read a JobRun |
PUT | /apis/funcd.io/v1alpha1/namespaces/{namespace}/jobruns/{name} | Replace a JobRun |
DELETE | /apis/funcd.io/v1alpha1/namespaces/{namespace}/jobruns/{name} | Delete a JobRun |
GET | /apis/funcd.io/v1alpha1/namespaces/{namespace}/jobruns/{name}/logs | Read the logs of a JobRun |