Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions modules/serverless-connect-channel-source-odc.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// * serverless/event_workflows/serverless-channels.adoc

[id="serverless-connect-channel-source-odc_{context}"]
= Connect an event source to a channel using {product-title} web console
= Connect an event source to a channel using the Developer perspective

You can create multiple event source types in {product-title} that can be connected to channels.

Expand All @@ -12,12 +12,12 @@ To connect an event source to a channel using the *Developer* perspective, ensur

* The {ServerlessOperatorName}, Knative Serving, and Knative Eventing are installed on your {product-title} cluster.
* You have logged in to the web console.
* You are in the *Developer* perspective.
* You have created a project or have access to a project with the appropriate roles and permissions to create applications and other workloads in {product-title}.
* You have created a channel by following the documentation on _Creating a channel using {product-title} web console_.

.Procedure
. Create an event source of any type, by following the documentation on _Getting started with event sources_.
. In the *Developer* perspective, navigate to *Event Sources*.
. In the *Sink* section of the *Event Sources* form view, select *Resource*. Then use the drop-down to select your channel.
+
image::sink-pingsource-channel.png[Use your channel as the Resource]
Expand Down
56 changes: 56 additions & 0 deletions modules/serverless-create-channel-kn.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// Module included in the following assemblies:
//
// * serverless/event_workflows/serverless-channels.adoc

[id="serverless-create-channel-kn_{context}"]
= Creating a channel using the Knative CLI

You can create a channel with the cluster default configuration by using the `kn` CLI.

.Prerequisites

To create channels using the `kn` CLI, ensure that:

* The {ServerlessOperatorName} and Knative Eventing are installed on your {product-title} cluster.
* You have installed the `kn` CLI.
* You have created a project or have access to a project with the appropriate roles and permissions to create applications and other workloads in {product-title}.

.Procedure

* Create a channel:
+
[source,terminal]
----
$ kn channel create <channel_name> --type <channel_type>
----
+
The channel type is optional, but where specified, must be given in the format `Group:Version:Kind`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we have also the possibility to define prefixes on our own in the configuration file (is this correct @navidshaikh ?), plus there is one predefined prefix imc: for an InMemoryChannel.

@abrennan89 do we already have a section where we describe the configuration file for kn ? If yes, I would add this, if not, we need a JIRA for adding this to the docs, too. I can deliver draft input for this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should also explain what happens when now type is given: In this case a default type is selected which is configured clusterwide.

For example, you can create an `InMemoryChannel` object:
+
[source,terminal]
----
$ kn channel create mychannel --type messaging.knative.dev:v1beta1:InMemoryChannel
----
+
.Example output
[source,terminal]
----
Channel 'mychannel' created in namespace 'default'.
----

.Verification steps

* To confirm that the channel now exists, list the existing channels and inspect the output:
+
[source,terminal]
----
$ kn channel list
----
+
.Example output
[source,terminal]
----
kn channel list
NAME TYPE URL AGE READY REASON
mychannel InMemoryChannel http://mychannel-kn-channel.default.svc.cluster.local 93s True
----
3 changes: 1 addition & 2 deletions modules/serverless-create-channel-odc.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ You can create a channel with the cluster default configuration by using the {pr
.Prerequisites
To create channels using the *Developer* perspective ensure that:

* The {ServerlessOperatorName}, Knative Serving, and Knative Eventing are installed on your {product-title} cluster.
* The {ServerlessOperatorName} and Knative Eventing are installed on your {product-title} cluster.
* You have logged in to the web console.
* You are in the *Developer* perspective.
* You have created a project or have access to a project with the appropriate roles and permissions to create applications and other workloads in {product-title}.

.Procedure
Expand Down
14 changes: 6 additions & 8 deletions modules/serverless-create-inmemorychannel-yaml.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@
// * serverless/event_workflows/serverless-channels.adoc

[id="serverless-create-inmemorychannel-yaml_{context}"]
= Creating a development channel using YAML
= Creating a channel using YAML

You can create a channel by using YAML with the cluster default configuration.

.Prerequisites
To create channels ensure that:

* The {ServerlessOperatorName}, Knative Serving, and Knative Eventing are installed on your {product-title} cluster.
* The {ServerlessOperatorName} and Knative Eventing are installed on your {product-title} cluster.
* You have created a project or have access to a project with the appropriate roles and permissions to create applications and other workloads in {product-title}.

.Procedure

. Create a `Channel` object.
.. Create a YAML file and copy the following sample code into it:
+
To create a `Channel` object:

. Create a YAML file and copy the following sample code into it:
+
[source,yaml]
----
apiVersion: messaging.knative.dev/v1
Expand All @@ -27,10 +27,8 @@ metadata:
name: example-channel
namespace: default
----

.. Apply the YAML file:
. Apply the YAML file:
+

[source,terminal]
----
$ oc apply -f <filename>
Expand Down
5 changes: 0 additions & 5 deletions modules/serverless-create-kn-trigger.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,18 @@ The Knative CLI provides a set of `kn trigger` commands that can be used to crea

* Create a trigger:
+

[source,terminal]
----
$ kn trigger create <trigger_name> --broker <broker_name> --filter <key=value> --sink <sink_name>
----

+
Alternatively, you can create a trigger and simultaneously create the `default` broker using broker injection:
+

[source,terminal]
----
$ kn trigger create <trigger_name> --inject-broker --filter <key=value> --sink <sink_name>
----

+
By default, triggers forward all events sent to a broker to sinks that are subscribed to that broker.
+
Using the `--filter` attribute for triggers allows you to filter events from a broker, so that subscribers will only receive a subset of events based on your defined criteria.
+
57 changes: 57 additions & 0 deletions modules/serverless-creating-subscriptions-kn.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// Module included in the following assemblies:
//
// * serverless/event_workflows/serverless-channels.adoc

[id="serverless-creating-subscriptions-kn_{context}"]
= Creating subscriptions using the Knative CLI

You can create a subscription to connect a channel to a sink by using the `kn` CLI.

.Prerequisites

To create subscriptions using the `kn` CLI, ensure that:

* The {ServerlessOperatorName} and Knative Eventing are installed on your {product-title} cluster.
* You have installed the `kn` CLI.
* You have created a project or have access to a project with the appropriate roles and permissions to create applications and other workloads in {product-title}.

.Procedure

* Create a subscription to connect a sink to a channel.
+
[source,terminal]
----
$ kn subscription create <subscription_name> \
--channel <Group:Version:Kind>:<channel_name> \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder where we should add that <GVK>: is optional (could be also a prefix like imc:), and if not given (as in the example below), then the default channel is used ?

--sink <sink_prefix>:<sink_name> \
--sink-reply <sink_prefix>:<sink_name> \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a reference which describes the sink prefix (which can also be optional) would be very helpful here.

--sink-dead-letter <sink_prefix>:<sink_name>
----
+
.Example command
[source,terminal]
----
$ kn subscription create mysubscription --channel mychannel --sink ksvc:event-display
----
+
.Example output
[source,terminal]
----
Subscription 'mysubscription' created in namespace 'default'.
----

.Verification steps

* To confirm that the channel is connected to the event sink, or _subscriber_, by a subscription, list the existing subscriptions and inspect the output:
+
[source,terminal]
----
$ kn subscription list
----
+
.Example output
[source,terminal]
----
NAME CHANNEL SUBSCRIBER REPLY DEAD LETTER SINK READY REASON
mysubscription Channel:mychannel ksvc:event-display True
----
5 changes: 2 additions & 3 deletions modules/serverless-creating-subscriptions-odc.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,18 @@
// * serverless/event_workflows/serverless-channels.adoc

[id="serverless-creating-subscriptions-odc_{context}"]
= Connecting a channel to a sink using subscriptions in the Developer perspective
= Creating subscriptions in the Developer perspective

.Prerequisites
To create subscriptions using the *Developer* perspective, ensure that:

* The {ServerlessOperatorName}, Knative Serving, and Knative Eventing are installed on your {product-title} cluster.
* You have logged in to the web console.
* You are in the *Developer* perspective.
* You have created a project or have access to a project with the appropriate roles and permissions to create applications and other workloads in {product-title}.
* You have created an event sink, such as a Knative service, and a channel.

.Procedure
. Navigate to the *Topology* page.
. In the *Developer* perspective, navigate to the *Topology* page.
. Create a subscription using one of the following methods:
.. Hover over the channel that you want to create a subscription for, and drag the arrow. The *Add Subscription* option is displayed.
+
Expand Down
13 changes: 5 additions & 8 deletions modules/serverless-creating-subscriptions-yaml.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
// * serverless/event_workflows/serverless-channels.adoc

[id="serverless-creating-subscriptions-yaml_{context}"]
= Connecting a channel to a sink using subscriptions with YAML
= Creating subscriptions by using YAML

You can create a `Subscription` object to connect a channel to a sink. In the following procedure, the example sink is a Knative service named `error-handler`.
You can create a subscription to connect a channel to a sink by using YAML.

.Procedure

. Create a YAML file and copy the following sample code into it:
* Create a `Subscription` object.
** Create a YAML file and copy the following sample code into it:
+

[source,yaml]
----
apiVersion: messaging.knative.dev/v1beta1
Expand All @@ -37,16 +37,13 @@ spec:
kind: Service
name: event-display
----

+
<1> Name of the subscription.
<2> Configuration settings for the channel that the subscription connects to.
<3> Configuration settings for event delivery. This tells the subscription what happens to events that cannot be delivered to the subscriber. When this is configured, events that failed to be consumed are sent to the `deadLetterSink`. The event is dropped, no re-delivery of the event is attempted, and an error is logged in the system. The `deadLetterSink` value must be a link:https://pkg.go.dev/knative.dev/pkg/apis/duck/v1?tab=doc#Destination[Destination].
<4> Configuration settings for the subscriber. This is the event sink that events are delivered to from the channel.

. Apply the YAML file:
** Apply the YAML file:
+

[source,terminal]
----
$ oc apply -f <filename>
Expand Down
17 changes: 17 additions & 0 deletions modules/serverless-delete-channel-kn.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Module included in the following assemblies:
//
// * serverless/event_workflows/serverless-channels.adoc

[id="serverless-delete-channel-kn_{context}"]
= Deleting a channel using the Knative CLI

You can delete a channel with the cluster default configuration by using the `kn` CLI.

.Procedure

* Delete a channel:
+
[source,terminal]
----
$ kn channel delete <channel_name>
----
37 changes: 27 additions & 10 deletions serverless/event_workflows/serverless-channels.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,40 @@ include::modules/common-attributes.adoc[]

toc::[]

Events can be sent from a source to a sink by using channels and subscriptions for event delivery.

image::serverless-event-channel-workflow.png[Channel workflow overview]
// just sources or do we need to talk about other event producers?

Channels are custom resources that define a single event-forwarding and persistence layer.

After events have been sent to a channel, these events can be sent to multiple Knative services, or other sinks, by using a subscription.
image::serverless-event-channel-workflow.png[Channel workflow overview]

Developers can create their own channels directly by instantiating a supported `Channel` object.
After events have been sent to a channel from an event source or producer, these events can be sent to multiple Knative services, or other sinks, by using a subscription.

include::modules/serverless-supported-channel-types.adoc[leveloffset=+1]
// include::modules/serverless-inmemorychannel.adoc[leveloffset=+2]
// comment out for now - this information isn't necessary while only default channel type is available, and should be moved to an admin guide anyway.
include::modules/serverless-create-channel-odc.adoc[leveloffset=+1]

[id="serverless-channels-creating"]
== Creating channels

Developers can create channels by instantiating a supported `Channel` object.

include::modules/serverless-create-channel-odc.adoc[leveloffset=+2]
// include::modules/serverless-create-channel-kn.adoc[leveloffset=+2]
include::modules/serverless-create-inmemorychannel-yaml.adoc[leveloffset=+2]

[id="serverless-channels-connecting-sources"]
== Connecting a channel to an event source

Connecting a channel to an event source allows the channel to receive events from that source.
These events can then be forwarded to an event sink by using subscriptions.

include::modules/serverless-connect-channel-source-odc.adoc[leveloffset=+2]
include::modules/serverless-creating-subscriptions-odc.adoc[leveloffset=+2]

include::modules/serverless-create-inmemorychannel-yaml.adoc[leveloffset=+1]
[id="serverless-channels-creating-subs"]
== Creating subscriptions

Developers can create subscriptions that allow event sinks to subscribe to channels and receive events directly.

include::modules/serverless-creating-subscriptions-odc.adoc[leveloffset=+2]
// include::modules/serverless-creating-subscriptions-kn.adoc[leveloffset=+2]
include::modules/serverless-creating-subscriptions-yaml.adoc[leveloffset=+2]

// include::modules/serverless-delete-channel-kn.adoc[leveloffset=+1]
27 changes: 0 additions & 27 deletions serverless/event_workflows/serverless-create-kn-trigger.adoc

This file was deleted.

Loading