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:

    1. 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.

    1. apiVersion: flows.knative.dev/v1
    2. kind: Sequence
    3. metadata:
    4. name: sequence
    5. spec:
    6. channelTemplate:
    7. kind: InMemoryChannel
    8. steps:
    9. apiVersion: serving.knative.dev/v1
    10. kind: Service
    11. name: first
    12. - ref:
    13. apiVersion: serving.knative.dev/v1
    14. kind: Service
    15. name: second
    16. - ref:
    17. apiVersion: serving.knative.dev/v1
    18. kind: Service
    19. name: third
    20. ref:
    21. kind: Service
    22. apiVersion: serving.knative.dev/v1
    23. name: event-display

    Change in the following command to create the Sequence in the namespace where you want the resources to be created:

    1. apiVersion: serving.knative.dev/v1
    2. kind: Service
    3. metadata:
    4. name: event-display
    5. spec:
    6. template:
    7. spec:
    8. containers:
    9. - image: gcr.io/knative-releases/knative.dev/eventing/cmd/event_display
    1. 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.

      1. kubectl -n default get pods

      Wait a bit and then look at the logs for the event-display pod: