We use analytics and cookies to understand site traffic. Information about your use of our site is shared with Google for that purpose. Learn more.
Writing an Event Source
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.
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).
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.
This tutorial is for having your event source in an independent repository.
If you would like to contribute Knative’s
eventing-contrib and have your source
there, there are some instructions at Adding the event source to
Before You Begin
You’ll need these tools installed:
You’re encouraged to clone the sample source and make changes there.