Skip to Content
Services

Events

Call a Function or start a Workflow run when something happens, on a schedule, on a new object in a Bucket or on a row change in a SQL database, and handle the deliveries that fail.

This page lists the spec and status fields of EventSource and Sensor, each with its type, its limits and its description. The Platform page explains the concept, and the metadata of every kind is the same.

EventSource

apiVersion: funcd.io/v1alpha1
kind: EventSource
metadata:
  name: schedules
  namespace: default
  resourceGroup: rg1
spec:
  timer:
    events:
      - name: every-minute
        interval: 1m
      - name: nightly
        cron: "30 2 * * *"
        timeZone: Europe/Paris
apiVersionkind
funcd.io/v1alpha1EventSource

EventSource.spec

FieldType and limitsDescription
blobobject, EventSource.spec.blobEvents that fire on new and rewritten objects of a Bucket in this namespace, which funcd lists every eventing.blobPollInterval. A firing's data has the fields bucket, key, size, version and time, the object's modification time. Exactly one of timer, blob and sql.
sqlobject, EventSource.spec.sqlEvents that fire on row changes in a SQLDatabase of this namespace. A firing's data has the fields op, table, rowId and index, and before, after and commitTimestamp when the change carries them; when before and after together pass 256 KiB, both are dropped and truncated is true. Exactly one of timer, blob and sql.
timerobject, EventSource.spec.timerEvents that fire on a schedule, each on its own interval or cron expression; a firing's data is an empty object. Exactly one of timer, blob and sql.

EventSource.spec.blob

FieldType and limitsDescription
bucketstring, required, a DNS-1123 labelThe Bucket, in this namespace, whose objects fire the events. Until it exists, the source is not Ready, with reason BucketNotFound, and watches nothing.
eventsarray of EventSource.spec.blob.events[], requiredThe source's events: at least one, with unique names, each watching the objects under its prefix.

EventSource.spec.blob.events[]

FieldType and limitsDescription
namestring, required, a DNS-1123 labelThe event's name, unique among the source's events: the type of each CloudEvent it fires, and the event a Sensor dependency names.
onarray of string valuesThe object changes that fire the event. Created, the only one, fires for each new object and again when an object is rewritten with another size or modification time; empty means Created.
prefixstringThe key prefix the event watches: only objects whose key starts with it fire, and empty means the whole Bucket. When the source is created or this prefix changes, the objects already under it fire too, to the Sensors subscribed then: an object that no Sensor got counts as seen.

EventSource.spec.sql

FieldType and limitsDescription
databasestring, required, a DNS-1123 labelThe SQLDatabase, in this namespace, whose row changes fire the events. Until it exists, the source is not Ready, with reason DatabaseNotFound.
eventsarray of EventSource.spec.sql.events[], requiredThe source's events: at least one, with unique names, each watching one table.

EventSource.spec.sql.events[]

FieldType and limitsDescription
namestring, required, a DNS-1123 labelThe event's name, unique among the source's events: the type of each CloudEvent it fires, and the event a Sensor dependency names.
onarray of string valuesThe row changes that fire the event: Insert, Update or Delete. Empty means all three.
tablestring, requiredThe table whose row changes fire the event, matched by its exact name, case included.

EventSource.spec.timer

FieldType and limitsDescription
eventsarray of EventSource.spec.timer.events[], requiredThe timer's events: at least one, with unique names, each firing on its own schedule.

EventSource.spec.timer.events[]

FieldType and limitsDescription
cronstringA cron expression: 5 fields (minute hour day-of-month month day-of-week) or a macro such as @daily. Exactly one of interval and cron.
intervalstring, a duration: whole numbers with the units h, m, s and ms, largest unit first (10m, 1h30m, 500ms)The tick period: 100ms to 24h. Exactly one of interval and cron.
namestring, required, a DNS-1123 labelThe event's name, unique among the source's events: the type of each CloudEvent it fires, and the event a Sensor dependency names.
timeZonestringThe IANA time zone of cron, such as Europe/Paris; UTC when empty. Only with cron.

EventSource.status

FieldType and limitsDescription
conditionsarray of ConditionThe conditions that explain the phase.
observedGenerationintegerThe generation of the spec that funcd last acted on.
phasestring, one of Pending, Deploying, Ready, Idle, Degraded, Failed, TerminatingWhere the object is in its lifecycle.

Sensor

apiVersion: funcd.io/v1alpha1
kind: Sensor
metadata:
  name: burst-on-tick
  namespace: default
  resourceGroup: rg1
spec:
  on:
    - name: tick
      source: ticker
      event: tick
  do:
    - name: burst
      on: tick
      function: log-burst
apiVersionkind
funcd.io/v1alpha1Sensor

Sensor.spec

FieldType and limitsDescription
doarray of Sensor.spec.do[], requiredThe actions the Sensor runs: at least one, with unique names. An event runs every action whose on names its dependency; a failed action is tried eventing.deliveryAttempts times in all, then stored as a dead letter, which funcdctl eventing dlq list shows; while eventing.maxQueuedPerSensor deliveries wait, a new one becomes a dead letter with no attempt.
onarray of Sensor.spec.on[], requiredThe events the Sensor subscribes to, as named dependencies: at least one, with unique names.

Sensor.spec.do[]

FieldType and limitsDescription
functionstring, a DNS-1123 labelEach event calls this Function, in the Sensor's namespace, with the CloudEvent, whose data is the action's input; funcd starts a worker first when none runs. A Function whose protocol is http is never called: the Sensor is not Ready, with reason TargetServesHTTP, and each event for this action ends as a dead letter. Exactly one of workflow and function.
inputany JSON valueWhat the action passes: the run's input, or the data of the CloudEvent the Function receives. Absent or null, it is the event's data; otherwise it is a JSON object whose top-level values are literals, or strings that are a single ${{ }} expression reading event.id, event.source, event.type, event.time or event.data. An input that is not an object, or holds an invalid expression, makes the Sensor not Ready, with reason InvalidInput, and then none of its actions runs.
namestring, required, a DNS-1123 labelThe action's name, unique among the Sensor's actions. Dead letters record it, and a WorkflowRun it starts is named after the Sensor and this name, with a random suffix.
onstring, required, a DNS-1123 labelThe name of the dependency whose events run this action, one of the Sensor's on entries.
workflowstring, a DNS-1123 labelEach event starts a WorkflowRun of this Workflow, in the Sensor's namespace and resource group, with the action's input. The action succeeds once the run is created; a run whose input breaks the Workflow's contract or passes workflow.payloadLimit fails at its start. Exactly one of workflow and function.

Sensor.spec.on[]

FieldType and limitsDescription
eventstring, required, a DNS-1123 labelThe name of one of that EventSource's events, which is the type of each CloudEvent the dependency receives.
namestring, required, a DNS-1123 labelThe dependency's name, unique among the Sensor's dependencies; an action's on names it.
sourcestring, required, a DNS-1123 labelThe name of an EventSource in the Sensor's namespace.

Sensor.status

FieldType and limitsDescription
conditionsarray of ConditionThe conditions that explain the phase.
observedGenerationintegerThe generation of the spec that funcd last acted on.
phasestring, one of Pending, Deploying, Ready, Idle, Degraded, Failed, TerminatingWhere the object is in its lifecycle.

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.

MethodPathOperation
GET/apis/funcd.io/v1alpha1/namespaces/{namespace}/eventsourcesList the EventSources of a namespace
POST/apis/funcd.io/v1alpha1/namespaces/{namespace}/eventsourcesCreate an EventSource
GET/apis/funcd.io/v1alpha1/namespaces/{namespace}/eventsources/{name}Read an EventSource
PUT/apis/funcd.io/v1alpha1/namespaces/{namespace}/eventsources/{name}Replace an EventSource
DELETE/apis/funcd.io/v1alpha1/namespaces/{namespace}/eventsources/{name}Delete an EventSource
GET/apis/funcd.io/v1alpha1/namespaces/{namespace}/sensorsList the Sensors of a namespace
POST/apis/funcd.io/v1alpha1/namespaces/{namespace}/sensorsCreate a Sensor
GET/apis/funcd.io/v1alpha1/namespaces/{namespace}/sensors/{name}Read a Sensor
PUT/apis/funcd.io/v1alpha1/namespaces/{namespace}/sensors/{name}Replace a Sensor
DELETE/apis/funcd.io/v1alpha1/namespaces/{namespace}/sensors/{name}Delete a Sensor
GET/apis/funcd.io/v1alpha1/namespaces/{namespace}/deadlettersList the dead letters of a namespace
GET/apis/funcd.io/v1alpha1/namespaces/{namespace}/deadletters/{id}Read a dead letter
DELETE/apis/funcd.io/v1alpha1/namespaces/{namespace}/deadletters/{id}Discard a dead letter
POST/apis/funcd.io/v1alpha1/namespaces/{namespace}/deadletters/{id}/replayReplay a dead letter

On this page