mirror of
https://github.com/openshift/openshift-docs.git
synced 2026-02-06 06:46:26 +01:00
42 lines
1.3 KiB
Plaintext
42 lines
1.3 KiB
Plaintext
:_content-type: ASSEMBLY
|
|
[id="serverless-pingsource"]
|
|
= Creating a ping source
|
|
:context: serverless-pingsource
|
|
include::modules/serverless-document-attributes.adoc[]
|
|
include::modules/common-attributes.adoc[]
|
|
|
|
toc::[]
|
|
|
|
A ping source is used to periodically send ping events with a constant payload to an event consumer.
|
|
|
|
A ping source can be used to schedule sending events, similar to a timer.
|
|
|
|
.Example ping source YAML
|
|
[source,yaml]
|
|
----
|
|
apiVersion: sources.knative.dev/v1alpha2
|
|
kind: PingSource
|
|
metadata:
|
|
name: test-ping-source
|
|
spec:
|
|
schedule: "*/2 * * * *" <1>
|
|
jsonData: '{"message": "Hello world!"}' <2>
|
|
sink: <3>
|
|
ref:
|
|
apiVersion: serving.knative.dev/v1
|
|
kind: Service
|
|
name: event-display
|
|
----
|
|
|
|
<1> The schedule of the event specified using https://kubernetes.io/docs/tasks/job/automated-tasks-with-cron-jobs/#schedule[CRON expression].
|
|
<2> The event message body expressed as a JSON encoded data string.
|
|
<3> These are the details of the event consumer. In this example, we are using a Knative service named `event-display`.
|
|
|
|
// dev console
|
|
include::modules/serverless-pingsource-odc.adoc[leveloffset=+1]
|
|
// kn commands
|
|
include::modules/serverless-pingsource-kn.adoc[leveloffset=+1]
|
|
include::modules/specifying-sink-flag-kn.adoc[leveloffset=+2]
|
|
// YAML
|
|
include::modules/serverless-pingsource-yaml.adoc[leveloffset=+1]
|