Knative: Operator’s Handbook

Ordering with Sequence

Sequence provides a way to define a list of services that will be invoked in order. Each Service can modify, filter or create a new kind of an event.

Here’s an example of a Sequence backed by an in-memory Channel and 2 services invoked in-order:

apiVersion: flows.knative.dev/v1alpha1
kind: Sequence
metadata:
  name: sequence
spec:
  channelTemplate:
    apiVersion: messaging.knative.dev/v1alpha1
    kind: InMemoryChannel
  steps:
  - ref:
      apiVersion: serving.knative.dev/v1
      kind: Service
      name: first
  - ref:
      apiVersion: serving.knative.dev/v1
      kind: Service
      name: second

[Full example]

A Sequence can end without a reply, as above. It can also end with a reply to another Service:

apiVersion: flows.knative.dev/v1alpha1
kind: Sequence
...
  steps:
  ...
  reply:
    ref:
      kind: Service
      apiVersion: serving.knative.dev/v1
      name: event-display

[Full example]

Or it can be chained into another Sequence:

apiVersion: flows.knative.dev/v1alpha1
kind: Sequence
...
  steps:
  ...
  reply:
    ref:
      kind: Sequence
      apiVersion: flows.knative.dev/v1alpha1
      name: second-sequence

[Full example]