Skip to content

Commit b207753

Browse files
committed
Send events with kn-event
(instead of curl on remote pod)
1 parent 9718d6d commit b207753

File tree

1 file changed

+6
-57
lines changed

1 file changed

+6
-57
lines changed

Diff for: documentation/modules/eventing/pages/eventing-trigger-broker.adoc

+6-57
Original file line numberDiff line numberDiff line change
@@ -186,56 +186,13 @@ First start streaming the logs for the event consumers:
186186
stern eventing -c user-container
187187
----
188188

189-
Then create a pod for using the `curl` command:
190-
191-
[source,yaml]
192-
----
193-
apiVersion: v1
194-
kind: Pod
195-
metadata:
196-
labels:
197-
run: curler
198-
name: curler
199-
spec:
200-
containers:
201-
- name: curler
202-
image: fedora:29 # <1>
203-
tty: true
204-
----
205-
206-
<1> You can use any image that includes a curl command.
207-
208-
Wait for the `curler` pod to be running and then exec into the `curler` pod:
209-
210-
[#trigger-verify-curler]
211-
[.console-input]
212-
[source,bash,subs="+macros,+attributes"]
213-
-----
214-
kubectl -n {tutorial-namespace} apply -f curler.yaml
215-
-----
216-
217-
Exec into the `curler` pod:
218-
219-
[trigger-verify-exec-curler]
220-
[.console-input]
221-
[source,bash,subs="+macros,+attributes"]
222-
----
223-
kubectl -n {tutorial-namespace} exec -it curler -- /bin/bash
224-
----
225-
226-
Using the `curler` pod's shell, curl the broker URI for eventingaloha:
189+
Using the https://github.com/knative-sandbox/kn-plugin-event[kn-event plugin] of the Knative CLI, we will now send a CloudEvent to the broker of type `aloha`:
227190

228191
[.console-input]
229192
[source,bash,subs="+macros,+attributes"]
230193
----
231-
curl -v "http://broker-ingress.knative-eventing.svc.cluster.local/{tutorial-namespace}/default" \
232-
-X POST \
233-
-H "Ce-Id: say-hello" \
234-
-H "Ce-Specversion: 1.0" \
235-
-H "Ce-Type: aloha" \
236-
-H "Ce-Source: mycurl" \
237-
-H "Content-Type: application/json" \
238-
-d '{"key":"from a curl"}'
194+
kn event send -t aloha -f origin="from kn-event" \
195+
--to Broker:eventing.knative.dev/v1:default
239196
----
240197

241198
You will then see `eventingaloha` will scale-up to respond to that event:
@@ -253,23 +210,16 @@ The command above should show the following output:
253210
[source,bash]
254211
-----
255212
NAME READY STATUS AGE
256-
curler 1/1 Running 59s
257213
eventingaloha-1-deployment-6cdc888d9d-9xnnn 2/2 Running 30s
258214
-----
259215

260-
Next, curl the broker URI for `eventingbonjour`:
216+
Next, send another event, this time of type `bonjour`:
261217

262218
[.console-input]
263219
[source,bash,subs="+macros,+attributes"]
264220
----
265-
curl -v "http://broker-ingress.knative-eventing.svc.cluster.local/{tutorial-namespace}/default" \
266-
-X POST \
267-
-H "Ce-Id: say-hello" \
268-
-H "Ce-Specversion: 1.0" \
269-
-H "Ce-Type: bonjour" \
270-
-H "Ce-Source: mycurl" \
271-
-H "Content-Type: application/json" \
272-
-d '{"key":"from a curl"}'
221+
kn event send -t bonjour -f origin="from kn-event" \
222+
--to Broker:eventing.knative.dev/v1:default
273223
----
274224

275225
And you will see the `eventingbonjour` pod scale up:
@@ -287,7 +237,6 @@ The command above should show the following output:
287237
[source,bash]
288238
-----
289239
NAME READY STATUS AGE
290-
curler 1/1 Running 82s
291240
eventingbonjour-1-deployment-fc7858b5b-s9prj 2/2 Running 5s
292241
-----
293242

0 commit comments

Comments
 (0)