Event sources
An event source is a Kubernetes custom resource (CR), created by a developer or cluster administrator, that acts as a link between an event producer and an event sink. A sink can be a k8s service, including Knative Services, a Channel, or a Broker that receives events from an event source.
Event sources are created by instantiating a CR from a Source object. The Source object defines the arguments and parameters needed to instantiate a CR.
All Sources are part of the sources
category.
{{< tabs name=”List event sources” default=”kubectl” >}} {{% tab name=”kubectl” %}} You can list existing event sources on your cluster by entering the ommand:
kubectl get sources
{{< /tab >}}
{{% tab name=”kn” %}} You can list existing event sources on your cluster by entering the kn command:
kn source list
{{< /tab >}} {{< /tabs >}}
Knative Sources
Name | API Version | Maintainer | Description |
---|---|---|---|
APIServerSource | v1beta1 | Knative | Brings Kubernetes API server events into Knative. The APIServerSource fires a new event each time a Kubernetes resource is created, updated or deleted. |
AWS SQS | v1alpha1 | Knative | Brings AWS Simple Queue Service messages into Knative. The AwsSqsSource fires a new event each time an event is published on an AWS SQS topic. |
Apache Camel | v1alpha1 | Knative | Enables use of Apache Camel components for pushing events into Knative. A CamelSource is an event source that can represent any existing Apache Camel component, that provides a consumer side, and enables publishing events to an addressable endpoint. Each Camel endpoint has the form of a URI where the scheme is the ID of the component to use. CamelSource requires Camel-K to be installed into the current namespace. See the CamelSource example. |
Apache CouchDB | v1alpha1 | Knative | Brings Apache CouchDB messages into Knative. |
Apache Kafka | v1beta1 | Knative | Brings Apache Kafka messages into Knative. The KafkaSource reads events from an Apache Kafka Cluster, and passes these events to a sink so that they can be consumed. See the Kafka Source example for more details. |
Container Source | v1beta1 | Knative | The ContainerSource will instantiate container image(s) that can generate events until the ContainerSource is deleted. This may be used, for example, to poll an FTP server for new files or generate events at a set time interval. Given a spec.template with at least a container image specified, ContainerSource will keep a Pod running with the specified image(s). K_SINK (destination address) and KE_CE_OVERRIDES (JSON CloudEvents attributes) environment variables are injected into the running image(s). It is used by multiple other Sources as underlying infrastructure. Refer to the Container Source example for more details. |
GitHub | v1alpha1 | Knative | Registers for events of the specified types on the specified GitHub organization or repository, and brings those events into Knative. The GitHubSource fires a new event for selected GitHub event types. See the GitHub Source example for more details. |
GitLab | v1alpha1 | Knative | Registers for events of the specified types on the specified GitLab repository, and brings those events into Knative. The GitLabSource creates a webhooks for specified event types, listens for incoming events, and passes them to a consumer. See the GitLab Source example for more details. |
Heartbeats | N/A | Knative | Uses an in-memory timer to produce events at the specified interval. |
PingSource | v1beta1 | Knative | Produces events with a fixed payload on a specified Cron schedule. See the Ping Source example for more details. |
RabbitMQ | Active development | None | Brings RabbitMQ messages into Knative. |
SinkBinding | v1beta1 | Knative | The SinkBinding can be used to author new event sources using any of the familiar compute abstractions that Kubernetes makes available (e.g. Deployment, Job, DaemonSet, StatefulSet), or Knative abstractions (e.g. Service, Configuration). SinkBinding provides a framework for injecting K_SINK (destination address) and K_CE_OVERRIDES (JSON cloudevents attributes) environment variables into any Kubernetes resource which has a spec.template that looks like a Pod (aka PodSpecable). See the SinkBinding example for more details. |
WebSocket | N/A | Knative | Opens a WebSocket to the specified source and packages each received message as a Knative event. |
Third-Party Sources
Name | API Version | Maintainer | Description |
---|---|---|---|
Auto Container Source | Proof of Concept | None | AutoContainerSource is a controller that allows the Source CRDs without needing a controller. It notices CRDs with a specific label and starts controlling resources of that type. It utilizes Container Source as underlying infrastructure. |
AWS CodeCommit | Supported | TriggerMesh | Registers for events of the specified types on the specified AWS CodeCommit repository. Brings those events into Knative. |
AWS Cognito | Supported | TriggerMesh | Registers for AWS Cognito events. Brings those events into Knative. |
AWS DynamoDB | Supported | TriggerMesh | Registers for events of on the specified AWS DynamoDB table. Brings those events into Knative. |
AWS Kinesis | Supported | TriggerMesh | Registers for events on the specified AWS Kinesis stream. Brings those events into Knative. |
AWS SNS | Supported | TriggerMesh | Registers for events of the specified AWS SNS endpoint. Brings those events into Knative. |
AWS SQS | Supported | TriggerMesh | Registers for events of the specified AWS SQS queue. Brings those events into Knative. |
BitBucket | Proof of Concept | None | Registers for events of the specified types on the specified BitBucket organization/repository. Brings those events into Knative. |
CloudAuditLogsSource | v1 | Registers for events of the specified types on the specified Google Cloud Audit Logs. Brings those events into Knative. Refer to the CloudAuditLogsSource example for more details. | |
CloudPubSubSource | v1 | Brings Cloud Pub/Sub messages into Knative. The CloudPubSubSource fires a new event each time a message is published on a Google Cloud Platform PubSub topic. See the CloudPubSubSource example for more details. | |
CloudSchedulerSource | v1 | Create, update, and delete Google Cloud Scheduler Jobs. When those jobs are triggered, receive the event inside Knative. See the CloudSchedulerSource example for further details. | |
CloudStorageSource | v1 | Registers for events of the specified types on the specified Google Cloud Storage bucket and optional object prefix. Brings those events into Knative. See the CloudStorageSource example. | |
FTP / SFTP | Proof of concept | None | Watches for files being uploaded into a FTP/SFTP and generates events for those. |
Heartbeat | Proof of Concept | None | Uses an in-memory timer to produce events as the specified interval. Uses AutoContainerSource for underlying infrastructure. |
Konnek | Active Development | None | Retrieves events from cloud platforms (like AWS and GCP) and transforms them into CloudEvents for consumption in Knative. |
K8s | Proof of Concept | None | Brings Kubernetes cluster events into Knative. Uses AutoContainerSource for underlying infrastructure. |
VMware | Active Development | None | Brings vSphere events into Knative. |
Additional resources
- For information about creating your own Source type, see the tutorial on writing a Source with a Receive Adapter.
- If your code needs to send events as part of its business logic and doesn’t fit the model of a Source, consider feeding events directly to a Broker.
- For more information about using
kn
Source related commands, see thekn source
reference documentation.