mirror of
https://github.com/openshift/openshift-docs.git
synced 2026-02-07 09:46:53 +01:00
68 lines
2.0 KiB
Plaintext
68 lines
2.0 KiB
Plaintext
// Module included in the following assemblies:
|
|
//
|
|
// * serverless/event_workflows/serverless-using-brokers.adoc
|
|
|
|
[id="serverless-creating-broker-annotation_{context}"]
|
|
= Creating a broker by annotating a trigger
|
|
|
|
You can create a broker by adding the `eventing.knative.dev/injection: enabled` annotation to a `Trigger` object.
|
|
|
|
[IMPORTANT]
|
|
====
|
|
If you create a broker by using the `eventing.knative.dev/injection: enabled` annotation, you cannot delete this broker without cluster administrator permissions.
|
|
If you delete the broker without having a cluster administrator remove this annotation first, the broker is created again after deletion.
|
|
====
|
|
|
|
.Prerequisites
|
|
* The {ServerlessOperatorName} and Knative Eventing are installed on your {product-title} cluster.
|
|
|
|
.Procedure
|
|
. Create a `Trigger` object as a `.yaml` file that has the `eventing.knative.dev/injection: enabled` annotation:
|
|
+
|
|
[source,yaml]
|
|
----
|
|
apiVersion: eventing.knative.dev/v1
|
|
kind: Trigger
|
|
metadata:
|
|
annotations:
|
|
eventing.knative.dev/injection: enabled
|
|
name: <trigger-name>
|
|
spec:
|
|
broker: default
|
|
subscriber: <1>
|
|
ref:
|
|
apiVersion: serving.knative.dev/v1
|
|
kind: Service
|
|
name: <service-name>
|
|
----
|
|
+
|
|
<1> Specify details about the event sink, or _subscriber_, that the trigger sends events to.
|
|
. Apply the `.yaml` file:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ oc apply -f <filename>
|
|
----
|
|
|
|
.Verification steps
|
|
|
|
You can verify that the broker has been created successfully by using the `oc` CLI, or by observing it in the *Topology* view in the web console.
|
|
|
|
. Use the `oc` command to get the broker:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ oc -n <namespace> get broker default
|
|
----
|
|
+
|
|
.Example output
|
|
[source,terminal]
|
|
----
|
|
NAME READY REASON URL AGE
|
|
default True http://broker-ingress.knative-eventing.svc.cluster.local/test/default 3m56s
|
|
----
|
|
|
|
. Navigate to the *Topology* view in the web console, and observe that the broker exists:
|
|
+
|
|
image::odc-view-broker.png[View the broker in the web console Topology view]
|