Writing an Event Source
Introduction
This tutorial will walk you though writing a new event source for Knative Eventing using a sample repository and explaining the key concepts used throughout each component.
After completing the tutorial, you’ll have a basic event source controller as well as receive adapter, which events can be viewed through a basic event_display
Knative Service.
Just want to see the code? The reference project is https://github.com/knative-sandbox/sample-source.
Knative Sources can be used as a reference.
Other ways
With the approach in this tutorial, you will create a CRD and a controller for the event source which makes it reusable.
You can also write your own event source using a ContainerSource which is an easy way to turn any dispatcher container into an Event Source. Similarly, another option is using SinkBinding which provides a framework for injecting environment variables into any Kubernetes resource which has a spec.template
that looks like a Pod (aka PodSpecable).
Target Audience
The target audience is already familiar with Kubernetes and Go development and wants to develop a new event source, importing their custom events via Knative Eventing into the Knative system.
Before You Begin
You’ll need these tools installed:
You’re encouraged to clone the sample source and make changes there.