1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-06 06:46:26 +01:00
Files
openshift-docs/modules/serverless-creating-subscriptions-yaml.adoc
OpenShift Cherrypick Robot a396f07407 Add kn channel docs (#26787)
Co-authored-by: abrennan <abrennan@redhat.com>
2020-10-27 10:16:45 -04:00

51 lines
1.7 KiB
Plaintext

// Module included in the following assemblies:
//
// <List assemblies here, each on a new line>
// * serverless/event_workflows/serverless-channels.adoc
[id="serverless-creating-subscriptions-yaml_{context}"]
= Creating subscriptions by using YAML
You can create a subscription to connect a channel to a sink by using YAML.
.Procedure
* Create a `Subscription` object.
** Create a YAML file and copy the following sample code into it:
+
[source,yaml]
----
apiVersion: messaging.knative.dev/v1beta1
kind: Subscription
metadata:
name: my-subscription <1>
namespace: default
spec:
channel: <2>
apiVersion: messaging.knative.dev/v1beta1
kind: Channel
name: example-channel
delivery: <3>
deadLetterSink:
ref:
apiVersion: serving.knative.dev/v1
kind: Service
name: error-handler
subscriber: <4>
ref:
apiVersion: serving.knative.dev/v1
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:
+
[source,terminal]
----
$ oc apply -f <filename>
----