About sinks

    Addressable objects

    Addressable objects receive and acknowledge an event delivered over HTTP to an address defined in their field. As a special case, the core Kubernetes Service object also fulfils the Addressable interface.

    Callable objects

    Callable objects are able to receive an event delivered over HTTP and transform the event, returning 0 or 1 new events in the HTTP response. These returned events may be further processed in the same way that events from an external event source are processed.

    Sink is used as a reference to an object that resolves to a URI to use as the sink.

    A sink definition supports the following fields:

    Note

    Given the following YAML, if ref resolves into "http://mysink.default.svc.cluster.local", then uri is added to this resulting in "http://mysink.default.svc.cluster.local/extra/path".

    Contract

    This results in the K_SINK environment variable being set on the subject as "http://mysink.default.svc.cluster.local/extra/path".

    To use a Kubernetes custom resource (CR) as a sink for events, you must:

    1. Make the CR Addressable. You must ensure that the CR contains a status.address.url. For more information, see the spec for .

    2. Create an Addressable-resolver ClusterRole to obtain the necessary RBAC rules for the sink to receive events.

      For example, you can create a kafkasinks-addressable-resolver ClusterRole to allow get, , and watch access to KafkaSink objects and statuses:

    For example:

    Where;

    • <kafka-sink-name> is the name of a KafkaSink object.

    When you create an event-producing CR by using the Knative (kn) CLI, you can specify a sink where events are sent to from that resource, by using the --sink flag.

    The following example creates a SinkBinding that uses a Service, http://event-display.svc.cluster.local, as the sink:

    The svc in http://event-display.svc.cluster.local determines that the sink is a Knative Service. Other default sink prefixes include Channel and Broker.

    Tip

    You can configure which resources can be used with the --sink flag for kn CLI commands by Customizing kn.

    NameMaintainerDescription
    KnativeSend events to a Kafka topic
    RedisSinkKnativeSend events to a Redis Stream