Create a custom event source

If you want to create a custom event source for a specific event producer type, you must create the components that enable forwarding events from that producer type to a Knative sink.

This type of integration requires more effort than using some simpler integration types, such as SinkBinding or ContainerSource; however, this provides the most polished result and is the easiest integration type for users to consume. By providing a custom resource definition (CRD) for your source rather than a general container definition, it is easier to expose meaningful configuration options and documentation to users and hide implementation details.

Note

If you have created a new event source type that is not a part of the core Knative project, you can open a pull request to add it to the list of Third-Party Sources, and announce the new source in the #knative-eventing Slack channel.

You can also add your event source to the knative-extensions organization, by following the instructions to create a extensions repository.

Required components

To create a custom event source, you must create the following components:

ComponentDescription
Receive adapterContains logic that specifies how to get events from a producer, what the sink URI is, and how to translate events into the CloudEvent format.
Kubernetes controllerManages the event source and reconciles underlying receive adapter deployments.
Custom resource definition (CRD)Provides the configuration that the controller uses to manage the receive adapter.

Using the sample source

The Knative project provides a sample repository that contains a template for a basic event source controller and a receive adapter.

For more information on using the sample source, see the documentation.

Additional resources

  • Implement CloudEvent binding interfaces, cloudevent’s go sdk provides libraries for standard access to configure interfaces as needed.

  • Controller runtime (this is what we share via injection) incorporates protocol specific config into “generic controller” CRD.