Knative: Operator’s Handbook

Source

Knative Eventing Sources are Kubernetes Custom Resources that read external events (eg. AWS SQS, Kafka, GCP Pub/Sub) into Knative cluster and pass them to different sinks of Knative components such as Broker or Services.

Each event source has its own way of installation and configuration. For example, CronJobSource is an event source that produces events on the specified cron schedule with an in-memory timer.

Here’s an example of a CronJobSource with a schedule of every 1 min:

apiVersion: sources.eventing.knative.dev/v1alpha1
kind: CronJobSource
metadata:
  name: test-cronjob-source
spec:
  schedule: "* * * * *"
  data: '{"message": "Hello world from cron!"}'
  sink:
    apiVersion: v1
    kind: Service
    name: event-display

Create it:

$ kubectl apply -f cronjob-source.yaml
cronjobsource.sources.eventing.knative.dev/test-cronjob-source created

Check that it works:

$ kubectl get cronjobsource
NAME                  READY   AGE
test-cronjob-source   True    7s

The previous sample shows Simple Delivery method where the sink is a Service.

In Complex Delivery and Broker and Trigger Delivery, the sink can be another Channel or a Broker as well.