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
5 changes: 5 additions & 0 deletions antora.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ nav:
start_ROOT: 'ROOT:index.adoc'
asciidoc:
attributes:
smproductshortname: Service Mesh
smproductname: OpenShift Service Mesh
product-title: OpenShift
serverlessoperatorname: OpenShift Serverless Operator
serverlessproductname: OpenShift Serverless
product_name: OpenShift Serverless Logic
context: OpenShift Serverless Logic
kogito_version_redhat: 1.35.0.Final-redhat-00003
Expand Down
5 changes: 5 additions & 0 deletions modules/ROOT/nav.adoc
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
* xref:index.adoc[Overview]
* Serverless Eventing
** Using Eventing with OpenShift Service Mesh
*** xref:serverless-eventing:service-mesh/eventing-service-mesh-setup.adoc[Setup Eventing with OpenShift Service Mesh]
*** xref:serverless-eventing:service-mesh/eventing-service-mesh-containersource.adoc[Using ContainerSource with OpenShift Service Mesh]
*** xref:serverless-eventing:service-mesh/eventing-service-mesh-sinkbinding.adoc[Using SinkBinding with OpenShift Service Mesh]
* Serverless Logic
** xref:serverless-logic:about.adoc[About OpenShift Serverless Logic]
** User Guides
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
= Using ContainerSource with {SMProductName}
:compat-mode!:
// Metadata:
:description: Using ContainerSource with {SMProductName}

.Prerequisites

* You have followed the setup {SMProductShortName} with {ServerlessProductName} procedure

.Procedure

. Create a `Service` in a namespace that is member of the `ServiceMeshMemberRoll`:
+
[source,yaml]
----
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
name: event-display
namespace: <namespace> <1>
spec:
template:
metadata:
annotations:
sidecar.istio.io/inject: "true" <2>
sidecar.istio.io/rewriteAppHTTPProbers: "true"
Copy link
Member

Choose a reason for hiding this comment

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

you wanna add some <3> explanation here too?

spec:
containers:
- image: quay.io/openshift-knative/knative-eventing-sources-event-display:latest
----
<1> A namespace that is member of the `ServiceMeshMemberRoll`.
<2> Injects {SMProductShortName} sidecars into the Knative service pods.

. Apply the `Service` resource:
+
[source,terminal]
----
$ oc apply -f <filename>
----

. Create a `ContainerSource` in a namespace that is member of the `ServiceMeshMemberRoll` and sink set to the `event-display`:
+
[source,yaml]
----
apiVersion: sources.knative.dev/v1
kind: ContainerSource
metadata:
name: test-heartbeats
namespace: <namespace> <1>
spec:
template:
metadata: <2>
annotations:
sidecar.istio.io/inject": "true"
sidecar.istio.io/rewriteAppHTTPProbers: "true"
spec:
containers:
# This corresponds to a heartbeats image URI that you have built and published
- image: quay.io/openshift-knative/heartbeats
name: heartbeats
args:
- --period=1s
env:
- name: POD_NAME
value: "example-pod"
- name: POD_NAMESPACE
value: "event-test"
sink:
ref:
apiVersion: serving.knative.dev/v1
kind: Service
name: event-display-service
----
<1> A namespace that is part of the `ServiceMeshMemberRoll`.
<2> Enables {SMProductShortName} integration with a `ContainerSource`

. Apply the `ContainerSource` resource:
+
[source,terminal]
----
$ oc apply -f <filename>
----

.Verification

You can verify that the events were sent to the Knative event sink by looking at the message dumper function logs.

. Enter the command:
+
[source,terminal]
----
$ oc get pods
----

. Enter the command:
+
[source,terminal]
----
$ oc logs $(oc get pod -o name | grep event-display) -c user-container
----
+
.Example output
[source,terminal]
----
☁️ cloudevents.Event
Validation: valid
Context Attributes,
specversion: 1.0
type: dev.knative.eventing.samples.heartbeat
source: https://knative.dev/eventing-contrib/cmd/heartbeats/#event-test/mypod
id: 2b72d7bf-c38f-4a98-a433-608fbcdd2596
time: 2019-10-18T15:23:20.809775386Z
contenttype: application/json
Extensions,
beats: true
heart: yes
the: 42
Data,
{
"id": 1,
"label": ""
}
----
Loading