Skip to content

Commit f9871cf

Browse files
authored
Merge pull request #35917 from abrennan89/SRVKE-893
[SRVKE-893] Add sink binding ODC docs
2 parents 31519f4 + 2f01912 commit f9871cf

File tree

5 files changed

+114
-10
lines changed

5 files changed

+114
-10
lines changed

_topic_map.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3125,11 +3125,11 @@ Topics:
31253125
File: knative-event-sources
31263126
- Name: Listing event sources and event source types
31273127
File: serverless-listing-event-sources
3128-
- Name: Using ApiServerSource
3128+
- Name: Using the API server source
31293129
File: serverless-apiserversource
3130-
- Name: Using PingSource
3130+
- Name: Using a ping source
31313131
File: serverless-pingsource
3132-
- Name: Using SinkBinding
3132+
- Name: Using sink binding
31333133
File: serverless-sinkbinding
31343134
- Name: Using container sources
31353135
File: serverless-containersource

images/verify-sinkbinding-odc.png

71.5 KB
Loading

modules/serverless-pingsource-odc.adoc

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
// Module included in the following assemblies:
2-
//
3-
// * serverless/event_sources/serverless-pingsource.adoc
4-
51
[id="serverless-pingsource-odc_{context}"]
62
= Creating a ping source using the Developer perspective
73

@@ -57,6 +53,6 @@ You can configure the *PingSource* settings by using the *Form view* or *YAML vi
5753
You can verify that the ping source was created and is connected to the sink by viewing the *Topology* page.
5854

5955
. In the *Developer* perspective, navigate to *Topology*.
60-
. View the PingSource and sink.
56+
. View the ping source and sink.
6157
+
62-
image::verify-pingsource-ODC.png[View the PingSource and service in the Topology view]
58+
image::verify-pingsource-ODC.png[View the ping source and service in the Topology view]
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
[id="serverless-sinkbinding-odc_{context}"]
2+
= Creating a sink binding using the Developer perspective
3+
4+
You can create and verify a basic sink binding from the {product-title} web console.
5+
6+
.Prerequisites
7+
8+
To create a sink binding using the *Developer* perspective, ensure that:
9+
10+
* The {ServerlessOperatorName}, Knative Serving, and Knative Eventing are installed on your {product-title} cluster.
11+
* You have logged in to the web console.
12+
* You are in the *Developer* perspective.
13+
* 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}.
14+
15+
.Procedure
16+
17+
. Create a Knative service to use as a sink:
18+
.. In the *Developer* perspective, navigate to *+Add* -> *YAML*.
19+
.. Copy the example YAML:
20+
+
21+
[source,yaml]
22+
----
23+
apiVersion: serving.knative.dev/v1
24+
kind: Service
25+
metadata:
26+
name: event-display
27+
spec:
28+
template:
29+
spec:
30+
containers:
31+
- image: quay.io/openshift-knative/knative-eventing-sources-event-display:latest
32+
----
33+
.. Click *Create*.
34+
35+
. Create a `CronJob` resource that is used as an event source and sends an event every minute.
36+
.. In the *Developer* perspective, navigate to *+Add* -> *YAML*.
37+
.. Copy the example YAML:
38+
+
39+
[source,yaml]
40+
----
41+
apiVersion: batch/v1
42+
kind: CronJob
43+
metadata:
44+
name: heartbeat-cron
45+
spec:
46+
# Run every minute
47+
schedule: "*/1 * * * *"
48+
jobTemplate:
49+
metadata:
50+
labels:
51+
app: heartbeat-cron
52+
bindings.knative.dev/include: true <1>
53+
spec:
54+
template:
55+
spec:
56+
restartPolicy: Never
57+
containers:
58+
- name: single-heartbeat
59+
image: quay.io/openshift-knative/heartbeats
60+
args:
61+
- --period=1
62+
env:
63+
- name: ONE_SHOT
64+
value: "true"
65+
- name: POD_NAME
66+
valueFrom:
67+
fieldRef:
68+
fieldPath: metadata.name
69+
- name: POD_NAMESPACE
70+
valueFrom:
71+
fieldRef:
72+
fieldPath: metadata.namespace
73+
----
74+
<1> Ensure that you include the `bindings.knative.dev/include: true` label. The default namespace selection behavior of {ServerlessProductName} uses inclusion mode.
75+
.. Click *Create*.
76+
77+
. Create a sink binding in the same namespace as the service created in the previous step, or any other sink that you want to send events to.
78+
.. In the *Developer* perspective, navigate to *+Add* -> *Event Source*. The *Event Sources* page is displayed.
79+
.. Optional: If you have multiple providers for your event sources, select the required provider from the *Providers* list to filter the available event sources from the provider.
80+
.. Select *Sink Binding* and then click *Create Event Source*. The *Create Event Source* page is displayed.
81+
.. In the *apiVersion* field enter `batch/v1`.
82+
.. In the *Kind* field enter `Job`.
83+
+
84+
[NOTE]
85+
====
86+
The `CronJob` kind is not supported directly by {ServerlessProductName} sink binding, so the *Kind* field must target the `Job` objects created by the cron job, rather than the cron job object itself.
87+
====
88+
.. Select a *Sink*. This can be either a *Resource* or a *URI*. In this example, the `event-display` service created in the previous step is used as the *Resource* sink.
89+
.. In the *Match labels* section:
90+
... Enter `app` in the *Name* field.
91+
... Enter `heartbeat-cron` in the *Value* field.
92+
+
93+
[NOTE]
94+
====
95+
The label selector is required when using cron jobs with sink binding, rather than the resource name. This is because jobs created by a cron job do not have a predictable name, and contain a randomly generated string in their name. For example, `hearthbeat-cron-1cc23f`.
96+
====
97+
.. Click *Create*.
98+
99+
.Verification
100+
101+
You can verify that the sink binding, sink, and cron job have been created and are working correctly by viewing the *Topology* page and pod logs.
102+
103+
. In the *Developer* perspective, navigate to *Topology*.
104+
. View the sink binding, sink, and heartbeats cron job.
105+
+
106+
image::verify-sinkbinding-odc.png[View the sink binding and service in the Topology view]
107+
. Observe that successful jobs are being registered by the cron job once the sink binding is added. This means that the sink binding is successfully reconfiguring the jobs created by the cron job.
108+
. Browse the logs of the the `event-display` service pod to see events produced by the heartbeats cron job.

serverless/event_sources/serverless-sinkbinding.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ $ oc label namespace <namespace> bindings.knative.dev/include=true
1919
2020
====
2121

22-
// TODO: Add dev console
22+
include::modules/serverless-sinkbinding-odc.adoc[leveloffset=+1]
2323
// kn commands
2424
include::modules/serverless-sinkbinding-kn.adoc[leveloffset=+1]
2525
include::modules/specifying-sink-flag-kn.adoc[leveloffset=+2]

0 commit comments

Comments
 (0)