Sequence wired to event-display
The functions used in these examples live in https://github.com/knative/eventing/blob/main/cmd/appender/main.go.
For this example, we’ll assume you have set up an InMemoryChannel
as well as Knative Serving (for our functions). The examples use default
namespace, again, if you want to deploy to another Namespace, you will need to modify the examples to reflect this.
Setup
Change default
in the following command to create the steps in the namespace where you want resources created:
kubectl -n default create -f ./steps.yaml
The sequence.yaml
file contains the specifications for creating the Sequence. If you are using a different type of Channel, you need to change the spec.channelTemplate to point to your desired Channel.
apiVersion: flows.knative.dev/v1
kind: Sequence
metadata:
name: sequence
spec:
channelTemplate:
kind: InMemoryChannel
steps:
apiVersion: serving.knative.dev/v1
kind: Service
name: first
- ref:
apiVersion: serving.knative.dev/v1
kind: Service
name: second
- ref:
apiVersion: serving.knative.dev/v1
kind: Service
name: third
ref:
kind: Service
apiVersion: serving.knative.dev/v1
name: event-display
Change in the following command to create the Sequence
in the namespace where you want the resources to be created:
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
name: event-display
spec:
template:
spec:
containers:
- image: gcr.io/knative-releases/knative.dev/eventing/cmd/event_display
kubectl -n default create -f ./event-display.yaml
This will create a PingSource which will send a CloudEvent with {“message”: “Hello world!”} as the data payload every 2 minutes.
You can now see the final output by inspecting the logs of the event-display pods.
kubectl -n default get pods
Wait a bit and then look at the logs for the event-display pod: