Relocate event source docs (#3948)

* Update links

* Update nav.yaml for event source move

* fix another link

* Move event source files to developer guide

* Move event samples to samples folder

* Move event samples to samples folder

* link fixes and improvements

* tweak some more links

* Update redirects

* Rebase redirects

* fixing infinite redirect bug

* Move creating event sources

Co-authored-by: Omer B <obensaadon@vmware.com>
This commit is contained in:
Samia Nneji 2021-07-07 15:26:25 +01:00 committed by GitHub
parent f35845f964
commit 06953771be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
52 changed files with 76 additions and 466 deletions

View File

@ -20,7 +20,7 @@ instructions, as part of my [Knative Tutorial](https://github.com/meteatamel/kna
When creating these example pipelines, I relied on a few Knative components that greatly simplified When creating these example pipelines, I relied on a few Knative components that greatly simplified
my development. More specifially: my development. More specifially:
1. [Event sources](https://knative.dev/docs/eventing/sources/) allow you to 1. [Event sources](https://knative.dev/docs/developer/eventing/sources/) allow you to
read external events in your cluster. [Knative-GCP read external events in your cluster. [Knative-GCP
Sources](https://github.com/google/knative-gcp#knative-gcp-sources) provide a Sources](https://github.com/google/knative-gcp#knative-gcp-sources) provide a
number of eventing sources ready to read events from various Google Cloud number of eventing sources ready to read events from various Google Cloud

View File

@ -47,7 +47,7 @@ type: "blog"
<p name="7ce7" id="7ce7" class="graf graf--p graf-after--h3">A frequently-requested feature is the ability to deploy services which are not exposed externally and can only be accessed by other services in the cluster. In v0.3, Routes <a href="../../../../../docs/reference/serving-api/#RouteStatus">configured</a> to use the `svc.cluster.local` domain will only be exposed to the cluster-local Istio gateway. The cluster-local gateway will keep the deployed service inaccessible from outside the cluster. Developers can also use the `serving.knative.dev/visibility=cluster-local` label on their Route or Service to enable this behaviour.</p> <p name="7ce7" id="7ce7" class="graf graf--p graf-after--h3">A frequently-requested feature is the ability to deploy services which are not exposed externally and can only be accessed by other services in the cluster. In v0.3, Routes <a href="../../../../../docs/reference/serving-api/#RouteStatus">configured</a> to use the `svc.cluster.local` domain will only be exposed to the cluster-local Istio gateway. The cluster-local gateway will keep the deployed service inaccessible from outside the cluster. Developers can also use the `serving.knative.dev/visibility=cluster-local` label on their Route or Service to enable this behaviour.</p>
<p name="09bc" id="09bc" class="graf graf--p graf-after--p">Knative is also deprecating its dedicated Istio gateway. In v0.3 release, Knative will still expose public routes to both the deprecated gateway and the default Istio gateway. Starting with next release however, Knative will remove the deprecated gateway to further reduce overhead and avoid the additional cost of public IP. (Note, you may have to update the gateway IP in your DNS mappings).</p> <p name="09bc" id="09bc" class="graf graf--p graf-after--p">Knative is also deprecating its dedicated Istio gateway. In v0.3 release, Knative will still expose public routes to both the deprecated gateway and the default Istio gateway. Starting with next release however, Knative will remove the deprecated gateway to further reduce overhead and avoid the additional cost of public IP. (Note, you may have to update the gateway IP in your DNS mappings).</p>
<h3 name="d066" id="d066" class="graf graf--h3 graf-after--p">Eventing</h3> <h3 name="d066" id="d066" class="graf graf--h3 graf-after--p">Eventing</h3>
<p name="7ef7" id="7ef7" class="graf graf--p graf-after--h3">With the inclusion of Eventing in the previous release, there has been a significant focus on extending the number of and documenting available external event sources which can be installed in Knative as Kubernetes Custom Resource Definitions (CRDs). The complete list of currently supported event sources can be found <a href="../../../../../docs/eventing/sources#sources">here</a>.</p> <p name="7ef7" id="7ef7" class="graf graf--p graf-after--h3">With the inclusion of Eventing in the previous release, there has been a significant focus on extending the number of and documenting available external event sources which can be installed in Knative as Kubernetes Custom Resource Definitions (CRDs). The complete list of currently supported event sources can be found <a href="../../../../../docs/developer/eventing/sources#sources">here</a>.</p>
<h3 name="87ba" id="87ba" class="graf graf--h3 graf-after--p">Build</h3> <h3 name="87ba" id="87ba" class="graf graf--h3 graf-after--p">Build</h3>
<p name="9e6a" id="9e6a" class="graf graf--p graf-after--h3">The Knative Build component can now support both single `source` and multiple input `sources`. If multiple sources are requested, each will be fetched in declared order and placed into a directory under `/workspace` named after the sources name field. The Build controller is also now subject to the PodSecurityPolicy which enables cluster operators to specify further limitations.</p> <p name="9e6a" id="9e6a" class="graf graf--p graf-after--h3">The Knative Build component can now support both single `source` and multiple input `sources`. If multiple sources are requested, each will be fetched in declared order and placed into a directory under `/workspace` named after the sources name field. The Build controller is also now subject to the PodSecurityPolicy which enables cluster operators to specify further limitations.</p>
<h3 name="6e57" id="6e57" class="graf graf--h3 graf-after--p">Monitoring</h3> <h3 name="6e57" id="6e57" class="graf graf--h3 graf-after--p">Monitoring</h3>

View File

@ -72,13 +72,33 @@ nav:
- Debugging application issues: developer/serving/troubleshooting/debugging-application-issues.md - Debugging application issues: developer/serving/troubleshooting/debugging-application-issues.md
- Knative Eventing: - Knative Eventing:
- Event sources: - Event sources:
- Overview: developer/eventing/sources/README.md
- Creating an event source:
- Overview: developer/eventing/sources/creating-event-sources/README.md
- Writing an event source using Javascript: developer/eventing/sources/creating-event-sources/writing-event-source-easy-way/README.md
- Using the sample event source:
- Overview: developer/eventing/sources/creating-event-sources/writing-event-source/README.md
- Design of an Event Source: developer/eventing/sources/creating-event-sources/writing-event-source/01-theory.md
- Lifecycle and Types: developer/eventing/sources/creating-event-sources/writing-event-source/02-lifecycle-and-types.md
- Controller Implemetation: developer/eventing/sources/creating-event-sources/writing-event-source/03-controller.md
- Reconciler Implementation: developer/eventing/sources/creating-event-sources/writing-event-source/04-reconciler.md
- Receive Adapter Implementation: developer/eventing/sources/creating-event-sources/writing-event-source/05-receive-adapter.md
- Publishing to your cluster: developer/eventing/sources/creating-event-sources/writing-event-source/06-yaml.md
- Moving to knative-sandbox: developer/eventing/sources/creating-event-sources/writing-event-source/07-knative-sandbox.md
- ApiServerSource: - ApiServerSource:
- Overview: developer/eventing/sources/apiserversource/README.md - Overview: developer/eventing/sources/apiserversource/README.md
- Creating an ApiServerSource object: developer/eventing/sources/apiserversource/getting-started/README.md - Creating an ApiServerSource object: developer/eventing/sources/apiserversource/getting-started/README.md
- ApiServerSource reference: developer/eventing/sources/apiserversource/reference.md - ApiServerSource reference: developer/eventing/sources/apiserversource/reference.md
- Camel source: developer/eventing/sources/apache-camel-source/README.md
- ContainerSource: - ContainerSource:
- Creating a ContainerSource object: developer/eventing/sources/containersource/README.md - Creating a ContainerSource object: developer/eventing/sources/containersource/README.md
- ContainerSource Reference: developer/eventing/sources/containersource/reference.md - ContainerSource Reference: developer/eventing/sources/containersource/reference.md
- Kafka source: developer/eventing/sources/kafka-source/README.md
- PingSource: developer/eventing/sources/ping-source/README.md
- SinkBinding:
- Overview: developer/eventing/sources/sinkbinding/README.md
- Creating a SinkBinding object: developer/eventing/sources/sinkbinding/getting-started.md
- SinkBinding reference: developer/eventing/sources/sinkbinding/reference.md
- Event delivery: developer/eventing/event-delivery.md - Event delivery: developer/eventing/event-delivery.md
- Event sinks: - Event sinks:
- About sinks: developer/eventing/sinks/README.md - About sinks: developer/eventing/sinks/README.md
@ -156,27 +176,6 @@ nav:
- Knative Eventing: - Knative Eventing:
- Overview: eventing/README.md - Overview: eventing/README.md
- Getting started: eventing/getting-started.md - Getting started: eventing/getting-started.md
- Event sources:
- Overview: eventing/sources/README.md
- PingSource: eventing/sources/ping-source/README.md
- SinkBinding:
- Overview: eventing/sources/sinkbinding/README.md
- Creating a SinkBinding object: eventing/sources/sinkbinding/getting-started.md
- SinkBinding reference: eventing/sources/sinkbinding/reference.md
- Camel source: eventing/sources/apache-camel-source/README.md
- Kafka source: eventing/sources/kafka-source/README.md
- Creating an event source:
- Overview: eventing/sources/creating-event-sources/README.md
- Writing an event source using Javascript: eventing/sources/creating-event-sources/writing-event-source-easy-way/README.md
- Using the sample event source:
- Overview: eventing/sources/creating-event-sources/writing-event-source/README.md
- Design of an Event Source: eventing/sources/creating-event-sources/writing-event-source/01-theory.md
- Lifecycle and Types: eventing/sources/creating-event-sources/writing-event-source/02-lifecycle-and-types.md
- Controller Implemetation: eventing/sources/creating-event-sources/writing-event-source/03-controller.md
- Reconciler Implementation: eventing/sources/creating-event-sources/writing-event-source/04-reconciler.md
- Receive Adapter Implementation: eventing/sources/creating-event-sources/writing-event-source/05-receive-adapter.md
- Publishing to your cluster: eventing/sources/creating-event-sources/writing-event-source/06-yaml.md
- Moving to knative-sandbox: eventing/sources/creating-event-sources/writing-event-source/07-knative-sandbox.md
- Event registry: eventing/event-registry.md - Event registry: eventing/event-registry.md
- Flows: - Flows:
- Overview: eventing/flows/README.md - Overview: eventing/flows/README.md
@ -206,7 +205,7 @@ nav:
- Experimental Features: eventing/experimental-features.md - Experimental Features: eventing/experimental-features.md
- Code samples: - Code samples:
- Overview: eventing/samples/README.md - Overview: eventing/samples/README.md
- Container source: eventing/sources/container-source/README.md - Container source: eventing/samples/container-source/README.md
- Hello World: - Hello World:
- Overview: eventing/samples/helloworld/README.md - Overview: eventing/samples/helloworld/README.md
- GO: eventing/samples/helloworld/helloworld-go/README.md - GO: eventing/samples/helloworld/helloworld-go/README.md
@ -219,12 +218,12 @@ nav:
- Overview: eventing/samples/parallel/README.md - Overview: eventing/samples/parallel/README.md
- Multiple Cases: eventing/samples/parallel/multiple-branches/README.md - Multiple Cases: eventing/samples/parallel/multiple-branches/README.md
- Mutual Exclusivity: eventing/samples/parallel/mutual-exclusivity/README.md - Mutual Exclusivity: eventing/samples/parallel/mutual-exclusivity/README.md
- CloudAuditLogsSource: eventing/sources/cloud-audit-logs-source/README.md - CloudAuditLogsSource: eventing/samples/cloud-audit-logs-source/README.md
- CloudPubSubSource: eventing/sources/cloud-pubsub-source/README.md - CloudPubSubSource: eventing/samples/cloud-pubsub-source/README.md
- CloudSchedulerSource: eventing/sources/cloud-scheduler-source/README.md - CloudSchedulerSource: eventing/samples/cloud-scheduler-source/README.md
- CloudStorageSource: eventing/sources/cloud-storage-source/README.md - CloudStorageSource: eventing/samples/cloud-storage-source/README.md
- GitHub source: eventing/sources/github-source/README.md - GitHub source: eventing/samples/github-source/README.md
- GitLab source: eventing/sources/gitlab-source/README.md - GitLab source: eventing/samples/gitlab-source/README.md
- IoT core: eventing/samples/iot-core/README.md - IoT core: eventing/samples/iot-core/README.md
# Reference docs # Reference docs
- Reference: - Reference:

View File

@ -10,36 +10,35 @@ plugins:
eventing/broker/alternate/index.md: eventing/broker/README.md eventing/broker/alternate/index.md: eventing/broker/README.md
eventing/broker/broker-event-delivery.md: developer/eventing/event-delivery.md eventing/broker/broker-event-delivery.md: developer/eventing/event-delivery.md
eventing/broker/configmaps/README.md: admin/eventing/broker-configuration.md eventing/broker/configmaps/README.md: admin/eventing/broker-configuration.md
eventing/broker/kafka-broker/index.md: eventing/broker/kafka-broker/README.md
eventing/broker/kafka-broker/kafka-configmap.md: admin/eventing/kafka-channel-configuration.md eventing/broker/kafka-broker/kafka-configmap.md: admin/eventing/kafka-channel-configuration.md
eventing/channels/default-channels/index.md: eventing/channels/README.md eventing/channels/default-channels/index.md: eventing/channels/README.md
eventing/event-delivery.md: developer/eventing/event-delivery.md eventing/event-delivery.md: developer/eventing/event-delivery.md
eventing/metrics.md: admin/collecting-metrics/eventing-metrics/metrics.md eventing/metrics.md: admin/collecting-metrics/eventing-metrics/metrics.md
eventing/parallel.md: eventing/flows/parallel.md eventing/parallel.md: eventing/flows/parallel.md
eventing/samples/apache-camel-source/index.md: eventing/sources/apache-camel-source/README.md eventing/samples/apache-camel-source/index.md: developer/eventing/sources/apache-camel-source/README.md
eventing/samples/gcp-pubsub-source/README.md: eventing/sources/cloud-pubsub-source/README.md eventing/samples/gcp-pubsub-source/README.md: eventing/samples/cloud-pubsub-source/README.md
eventing/samples/kubernetes-event-source/index.md: developer/eventing/sources/apiserversource/getting-started/README.md eventing/samples/kubernetes-event-source/index.md: developer/eventing/sources/apiserversource/README.md
eventing/samples/ping-source/index.md: eventing/sources/ping-source/README.md eventing/samples/ping-source/index.md: developer/eventing/sources/ping-source/README.md
eventing/samples/sequence/index.md: eventing/flows/sequence/README.md eventing/samples/sequence/index.md: eventing/flows/sequence/README.md
eventing/samples/sequence/sequence-replay-to-event-display/index.md: eventing/flows/sequence/sequence-reply-to-event-display/README.md eventing/samples/sequence/sequence-replay-to-event-display/index.md: eventing/flows/sequence/sequence-reply-to-event-display/README.md
eventing/samples/sequence/sequence-reply-to-sequence/index.md: eventing/flows/sequence/sequence-reply-to-sequence/README.md eventing/samples/sequence/sequence-reply-to-sequence/index.md: eventing/flows/sequence/sequence-reply-to-sequence/README.md
eventing/samples/sequence/sequence-terminal/index.md: eventing/flows/sequence/sequence-terminal/README.md eventing/samples/sequence/sequence-terminal/index.md: eventing/flows/sequence/sequence-terminal/README.md
eventing/samples/sequence/sequence-with-broker-trigger/index.md: eventing/flows/sequence/sequence-with-broker-trigger/README.md eventing/samples/sequence/sequence-with-broker-trigger/index.md: eventing/flows/sequence/sequence-with-broker-trigger/README.md
eventing/samples/sinkbinding/README.md: eventing/sources/sinkbinding/README.md eventing/samples/sinkbinding/README.md: developer/eventing/sources/sinkbinding/README.md
eventing/samples/writing-event-source-easy-way/index.md: eventing/sources/creating-event-sources/writing-event-source-easy-way/README.md eventing/samples/writing-event-source-easy-way/index.md: developer/eventing/sources/creating-event-sources/writing-event-source-easy-way/README.md
eventing/samples/writing-event-source/01-theory/index.md: eventing/sources/creating-event-sources/writing-event-source/01-theory.md eventing/samples/writing-event-source/01-theory/index.md: developer/eventing/sources/creating-event-sources/writing-event-source/01-theory.md
eventing/samples/writing-event-source/02-lifecycle-and-types/index.md: eventing/sources/creating-event-sources/writing-event-source/02-lifecycle-and-types.md eventing/samples/writing-event-source/02-lifecycle-and-types/index.md: developer/eventing/sources/creating-event-sources/writing-event-source/02-lifecycle-and-types.md
eventing/samples/writing-event-source/03-controller/index.md: eventing/sources/creating-event-sources/writing-event-source/03-controller.md eventing/samples/writing-event-source/03-controller/index.md: developer/eventing/sources/creating-event-sources/writing-event-source/03-controller.md
eventing/samples/writing-event-source/04-reconciler/index.md: eventing/sources/creating-event-sources/writing-event-source/04-reconciler.md eventing/samples/writing-event-source/04-reconciler/index.md: developer/eventing/sources/creating-event-sources/writing-event-source/04-reconciler.md
eventing/samples/writing-event-source/05-receive-adapter/index.md: eventing/sources/creating-event-sources/writing-event-source/05-receive-adapter.md eventing/samples/writing-event-source/05-receive-adapter/index.md: developer/eventing/sources/creating-event-sources/writing-event-source/05-receive-adapter.md
eventing/samples/writing-event-source/06-yaml/index.md: eventing/sources/creating-event-sources/writing-event-source/06-yaml.md eventing/samples/writing-event-source/06-yaml/index.md: developer/eventing/sources/creating-event-sources/writing-event-source/06-yaml.md
eventing/samples/writing-event-source/07-knative-sandbox/index.md: eventing/sources/creating-event-sources/writing-event-source/07-knative-sandbox.md eventing/samples/writing-event-source/07-knative-sandbox/index.md: developer/eventing/sources/creating-event-sources/writing-event-source/07-knative-sandbox.md
eventing/samples/writing-event-source/index.md: eventing/sources/creating-event-sources/writing-event-source/README.md eventing/samples/writing-event-source/index.md: developer/eventing/sources/creating-event-sources/writing-event-source/README.md
eventing/sequence.md: eventing/flows/sequence/README.md eventing/sequence.md: eventing/flows/sequence/README.md
eventing/sink/README.md: developer/eventing/sinks/README.md eventing/sink/README.md: developer/eventing/sinks/README.md
eventing/sink/kafka-sink.md: developer/eventing/sinks/kafka-sink.md eventing/sink/kafka-sink.md: developer/eventing/sinks/kafka-sink.md
eventing/sources/apiserversource/index.md: developer/eventing/sources/apiserversource/README.md eventing/sources/apiserversource/index.md: developer/eventing/sources/apiserversource/README.md
eventing/sources/pingsource/index.md: eventing/sources/ping-source/README.md eventing/sources/pingsource/index.md: developer/eventing/sources/ping-source/README.md
eventing/sources/containersource.md: developer/eventing/sources/containersource/README.md eventing/sources/containersource.md: developer/eventing/sources/containersource/README.md
eventing/triggers/index.md: eventing/broker/triggers/README.md eventing/triggers/index.md: eventing/broker/triggers/README.md
help/README.md: help/contributor/README.md help/README.md: help/contributor/README.md

View File

@ -42,7 +42,7 @@ Follow the procedure for the channel of your choice:
=== "Apache Kafka Channel" === "Apache Kafka Channel"
1. First, 1. First,
[Install Apache Kafka for Kubernetes](../../../../eventing/samples/kafka) [Install Apache Kafka for Kubernetes](../../../eventing/samples/kafka/README.md)
1. Then install the Apache Kafka Channel: 1. Then install the Apache Kafka Channel:
@ -53,8 +53,7 @@ Follow the procedure for the channel of your choice:
``` ```
!!! tip !!! tip
To learn more about the Apache Kafka channel, try To learn more, try the [Apache Kafka channel sample](../../../eventing/samples/kafka/channel/README.md).
[our sample](../../../../eventing/samples/kafka/channel/)
=== "Google Cloud Pub/Sub Channel" === "Google Cloud Pub/Sub Channel"
@ -66,8 +65,7 @@ Follow the procedure for the channel of your choice:
``` ```
!!! tip !!! tip
To learn more about the Google Cloud Pub/Sub channel, try To learn more, try the [Google Cloud Pub/Sub channel sample](https://github.com/google/knative-gcp/blob/master/docs/examples/channel/README.md).
[our sample](https://github.com/google/knative-gcp/blob/master/docs/examples/channel/README.md)
=== "In-Memory (standalone)" === "In-Memory (standalone)"
@ -115,7 +113,7 @@ Follow the procedure for the broker of your choice:
kubectl apply -f {{ artifact(org="knative-sandbox",repo="eventing-kafka-broker",file="eventing-kafka-broker.yaml")}} kubectl apply -f {{ artifact(org="knative-sandbox",repo="eventing-kafka-broker",file="eventing-kafka-broker.yaml")}}
``` ```
For more information, see the [Kafka broker](../../../../eventing/broker/kafka-broker/) documentation. For more information, see the [Kafka broker](../../../eventing/broker/kafka-broker/README.md) documentation.
=== "MT-Channel-based" === "MT-Channel-based"
@ -260,8 +258,7 @@ The tabs below expand to show instructions for installing each Eventing extensio
GitHub sources in the cluster. This source does not support logging or tracing GitHub sources in the cluster. This source does not support logging or tracing
configuration yet. configuration yet.
To learn more about the Github source, try To learn more, try the [Github source sample](../../../eventing/samples/github-source/README.md)
[our sample](../../../../eventing/sources/github-source/)
=== "Apache Kafka Source" === "Apache Kafka Source"
@ -271,8 +268,7 @@ The tabs below expand to show instructions for installing each Eventing extensio
kubectl apply -f {{ artifact(org="knative-sandbox",repo="eventing-kafka",file="source.yaml")}} kubectl apply -f {{ artifact(org="knative-sandbox",repo="eventing-kafka",file="source.yaml")}}
``` ```
To learn more about the Apache Kafka source, try To learn more, try the [Apache Kafka source sample](../../../developer/eventing/sources/kafka-source/README.md).
[our sample](../../../../eventing/sources/kafka-source)
=== "GCP Sources" === "GCP Sources"
@ -284,17 +280,12 @@ The tabs below expand to show instructions for installing each Eventing extensio
kubectl apply -f {{ artifact(org="google",repo="knative-gcp",file="cloud-run-events.yaml")}} kubectl apply -f {{ artifact(org="google",repo="knative-gcp",file="cloud-run-events.yaml")}}
``` ```
To learn more about the Cloud Pub/Sub source, try To learn more, try the following:
[our sample](../../../../eventing/sources/cloud-pubsub-source).
To learn more about the Cloud Storage source, try - [Cloud Pub/Sub source sample](../../../eventing/samples/cloud-pubsub-source/README.md)
[our sample](../../../../eventing/sources/cloud-storage-source). - [Cloud Storage source sample](../../../eventing/samples/cloud-storage-source/README.md)
- [Cloud Scheduler source sample](../../../eventing/samples/cloud-scheduler-source/README.md)
To learn more about the Cloud Scheduler source, try - [Cloud Audit Logs source sample](../../../eventing/samples/cloud-audit-logs-source/README.md)
[our sample](../../../../eventing/sources/cloud-scheduler-source).
To learn more about the Cloud Audit Logs source, try
[our sample](../../../../eventing/sources/cloud-audit-logs-source).
=== "Apache CouchDB Source" === "Apache CouchDB Source"
@ -305,7 +296,7 @@ The tabs below expand to show instructions for installing each Eventing extensio
kubectl apply -f {{ artifact(org="knative-sandbox",repo="eventing-couchdb",file="couchdb.yaml")}} kubectl apply -f {{ artifact(org="knative-sandbox",repo="eventing-couchdb",file="couchdb.yaml")}}
``` ```
To learn more about the Apache CouchDB source, read the [documentation](https://github.com/knative-sandbox/eventing-couchdb/blob/main/source/README.md). To learn more, read the [Apache CouchDB source](https://github.com/knative-sandbox/eventing-couchdb/blob/main/source/README.md) documentation.
=== "VMware Sources and Bindings" === "VMware Sources and Bindings"
@ -315,5 +306,4 @@ The tabs below expand to show instructions for installing each Eventing extensio
kubectl apply -f {{ artifact(org="vmware-tanzu",repo="sources-for-knative",file="release.yaml")}} kubectl apply -f {{ artifact(org="vmware-tanzu",repo="sources-for-knative",file="release.yaml")}}
``` ```
To learn more about the VMware sources and bindings, try To learn more, try the [VMware sources and bindings samples](https://github.com/vmware-tanzu/sources-for-knative/tree/master/samples/README.md).
[our samples](https://github.com/vmware-tanzu/sources-for-knative/tree/master/samples/README.md).

View File

@ -28,27 +28,22 @@ All Sources are part of the `sources` category.
kubectl get sources kubectl get sources
``` ```
## Knative Sources ## Knative Sources
| Name | API Version | Maintainer | Description | | Name | API Version | Maintainer | Description |
| -- | -- | -- | -- | | -- | -- | -- | -- |
| [APIServerSource](./apiserversource) | v1 | Knative | Brings Kubernetes API server events into Knative. The APIServerSource fires a new event each time a Kubernetes resource is created, updated or deleted. | | [APIServerSource](./apiserversource/README.md) | v1 | Knative | Brings Kubernetes API server events into Knative. The APIServerSource fires a new event each time a Kubernetes resource is created, updated or deleted. |
| [AWS SQS](https://github.com/knative-sandbox/eventing-awssqs/tree/main/samples) | v1alpha1 | Knative | Brings [AWS Simple Queue Service](https://aws.amazon.com/sqs/) messages into Knative. The AwsSqsSource fires a new event each time an event is published on an [AWS SQS topic](https://aws.amazon.com/sqs/). | | [AWS SQS](https://github.com/knative-sandbox/eventing-awssqs/tree/main/samples) | v1alpha1 | Knative | Brings [AWS Simple Queue Service](https://aws.amazon.com/sqs/) messages into Knative. The AwsSqsSource fires a new event each time an event is published on an [AWS SQS topic](https://aws.amazon.com/sqs/). |
| [Apache Camel](./apache-camel-source) | N/A | Apache Software Foundation | Enables use of [Apache Camel](https://github.com/apache/camel) components for pushing events into Knative. Camel sources are now provided via [Kamelets](https://camel.apache.org/camel-kamelets/latest/) as part of the [Apache Camel K](https://camel.apache.org/camel-k/latest/installation/installation.html) project. | | [Apache Camel](./apache-camel-source/README.md) | N/A | Apache Software Foundation | Enables use of [Apache Camel](https://github.com/apache/camel) components for pushing events into Knative. Camel sources are now provided via [Kamelets](https://camel.apache.org/camel-kamelets/latest/) as part of the [Apache Camel K](https://camel.apache.org/camel-k/latest/installation/installation.html) project. |
| [Apache CouchDB](https://github.com/knative-sandbox/eventing-couchdb/blob/main/source) | v1alpha1 | Knative | Brings [Apache CouchDB](https://couchdb.apache.org/) messages into Knative. | | [Apache CouchDB](https://github.com/knative-sandbox/eventing-couchdb/blob/main/source) | v1alpha1 | Knative | Brings [Apache CouchDB](https://couchdb.apache.org/) messages into Knative. |
| [Apache Kafka](../samples/kafka) | v1beta1 | Knative | Brings [Apache Kafka](https://kafka.apache.org/) messages into Knative. The KafkaSource reads events from an Apache Kafka Cluster, and passes these events to a sink so that they can be consumed. See the [Kafka Source](https://github.com/knative-sandbox/eventing-kafka/blob/main/pkg/source) example for more details. | | [Apache Kafka](../../../eventing/samples/kafka/README.md) | v1beta1 | Knative | Brings [Apache Kafka](https://kafka.apache.org/) messages into Knative. The KafkaSource reads events from an Apache Kafka Cluster, and passes these events to a sink so that they can be consumed. See the [Kafka Source](https://github.com/knative-sandbox/eventing-kafka/blob/main/pkg/source) example for more details. |
| [Container Source](./containersource/README.md) | v1 | Knative | The ContainerSource will instantiate container image(s) that can generate events until the ContainerSource is deleted. This may be used, for example, to poll an FTP server for new files or generate events at a set time interval. Given a `spec.template` with at least a container image specified, ContainerSource will keep a `Pod` running with the specified image(s). `K_SINK` (destination address) and `KE_CE_OVERRIDES` (JSON CloudEvents attributes) environment variables are injected into the running image(s). It is used by multiple other Sources as underlying infrastructure. Refer to the [Container Source](./container-source) example for more details. | | [ContainerSource](./containersource/README.md) | v1 | Knative | The ContainerSource will instantiate container image(s) that can generate events until the ContainerSource is deleted. This may be used, for example, to poll an FTP server for new files or generate events at a set time interval. Given a `spec.template` with at least a container image specified, ContainerSource will keep a `Pod` running with the specified image(s). `K_SINK` (destination address) and `KE_CE_OVERRIDES` (JSON CloudEvents attributes) environment variables are injected into the running image(s). It is used by multiple other Sources as underlying infrastructure. Refer to the [Container Source](../../../eventing/samples/container-source/README.md) example for more details. |
| [GitHub](./github-source) | v1alpha1 | Knative | Registers for events of the specified types on the specified GitHub organization or repository, and brings those events into Knative. The GitHubSource fires a new event for selected [GitHub event types](https://developer.github.com/v3/activity/events/types/). See the [GitHub Source](./github-source) example for more details. | | [GitHub](../../../eventing/samples/github-source/README.md) | v1alpha1 | Knative | Registers for events of the specified types on the specified GitHub organization or repository, and brings those events into Knative. The GitHubSource fires a new event for selected [GitHub event types](https://developer.github.com/v3/activity/events/types/). See the [GitHub Source](../../../eventing/samples/github-source/README.md) example for more details. |
| [GitLab](./gitlab-source) | v1alpha1 | Knative | Registers for events of the specified types on the specified GitLab repository, and brings those events into Knative. The GitLabSource creates a webhooks for specified [event types](https://docs.gitlab.com/ee/user/project/integrations/webhooks.html#events), listens for incoming events, and passes them to a consumer. See the [GitLab Source](./gitlab-source) example for more details. | | [GitLab](../../../eventing/samples/gitlab-source/README.md) | v1alpha1 | Knative | Registers for events of the specified types on the specified GitLab repository, and brings those events into Knative. The GitLabSource creates a webhooks for specified [event types](https://docs.gitlab.com/ee/user/project/integrations/webhooks.html#events), listens for incoming events, and passes them to a consumer. See the [GitLab Source](../../../eventing/samples/gitlab-source/README.md) example for more details. |
| [Heartbeats](https://github.com/knative/eventing/tree/main/cmd/heartbeats) | N/A | Knative | Uses an in-memory timer to produce events at the specified interval. | | [Heartbeats](https://github.com/knative/eventing/tree/main/cmd/heartbeats) | N/A | Knative | Uses an in-memory timer to produce events at the specified interval. |
| [PingSource](./ping-source) | v1beta2 | Knative | Produces events with a fixed payload on a specified [Cron](https://en.wikipedia.org/wiki/Cron) schedule. See the [Ping Source](./ping-source) example for more details. | | [PingSource](./ping-source/README.md) | v1beta2 | Knative | Produces events with a fixed payload on a specified [Cron](https://en.wikipedia.org/wiki/Cron) schedule. See the [Ping Source](./ping-source/README.md) example for more details. |
| [RabbitMQ](https://github.com/knative-sandbox/eventing-rabbitmq) | Active development | None | Brings [RabbitMQ](https://www.rabbitmq.com/) messages into Knative. | [RabbitMQ](https://github.com/knative-sandbox/eventing-rabbitmq) | Active development | None | Brings [RabbitMQ](https://www.rabbitmq.com/) messages into Knative.
| [SinkBinding](./sinkbinding/) | v1 | Knative | The SinkBinding can be used to author new event sources using any of the familiar compute abstractions that Kubernetes makes available (e.g. Deployment, Job, DaemonSet, StatefulSet), or Knative abstractions (e.g. Service, Configuration). SinkBinding provides a framework for injecting `K_SINK` (destination address) and `K_CE_OVERRIDES` (JSON cloudevents attributes) environment variables into any Kubernetes resource which has a `spec.template` that looks like a Pod (aka PodSpecable). See the [SinkBinding](./container-source) example for more details. | | [SinkBinding](./sinkbinding/README.md) | v1 | Knative | The SinkBinding can be used to author new event sources using any of the familiar compute abstractions that Kubernetes makes available (e.g. Deployment, Job, DaemonSet, StatefulSet), or Knative abstractions (e.g. Service, Configuration). SinkBinding provides a framework for injecting `K_SINK` (destination address) and `K_CE_OVERRIDES` (JSON cloudevents attributes) environment variables into any Kubernetes resource which has a `spec.template` that looks like a Pod (aka PodSpecable). See the [SinkBinding](./sinkbinding/README.md) example for more details. |
| [WebSocket](https://github.com/knative/eventing/tree/main/cmd/websocketsource) | N/A | Knative | Opens a WebSocket to the specified source and packages each received message as a Knative event. | | [WebSocket](https://github.com/knative/eventing/tree/main/cmd/websocketsource) | N/A | Knative | Opens a WebSocket to the specified source and packages each received message as a Knative event. |
## Third-Party Sources ## Third-Party Sources
@ -66,10 +61,10 @@ All Sources are part of the `sources` category.
[Amazon SNS](https://github.com/triggermesh/aws-event-sources/tree/master/cmd/awssnssource/README.md) | Supported | TriggerMesh | Subscribes to messages from an [Amazon SNS](https://aws.amazon.com/sns/) topic. [Amazon SNS](https://github.com/triggermesh/aws-event-sources/tree/master/cmd/awssnssource/README.md) | Supported | TriggerMesh | Subscribes to messages from an [Amazon SNS](https://aws.amazon.com/sns/) topic.
[Amazon SQS](https://github.com/triggermesh/aws-event-sources/tree/master/cmd/awssqssource/README.md) | Supported | TriggerMesh | Consumes messages from an [Amazon SQS](https://aws.amazon.com/sqs/) queue. [Amazon SQS](https://github.com/triggermesh/aws-event-sources/tree/master/cmd/awssqssource/README.md) | Supported | TriggerMesh | Consumes messages from an [Amazon SQS](https://aws.amazon.com/sqs/) queue.
[BitBucket](https://github.com/nachocano/bitbucket-source) | Proof of Concept | None | Registers for events of the specified types on the specified BitBucket organization/repository. Brings those events into Knative. [BitBucket](https://github.com/nachocano/bitbucket-source) | Proof of Concept | None | Registers for events of the specified types on the specified BitBucket organization/repository. Brings those events into Knative.
[CloudAuditLogsSource](https://github.com/google/knative-gcp/blob/main/docs/examples/cloudauditlogssource/README.md) | v1 | Google | Registers for events of the specified types on the specified [Google Cloud Audit Logs](https://cloud.google.com/logging/docs/audit/). Brings those events into Knative. Refer to the [CloudAuditLogsSource](./cloud-audit-logs-source) example for more details. [CloudAuditLogsSource](https://github.com/google/knative-gcp/blob/main/docs/examples/cloudauditlogssource/README.md) | v1 | Google | Registers for events of the specified types on the specified [Google Cloud Audit Logs](https://cloud.google.com/logging/docs/audit/). Brings those events into Knative. Refer to the [CloudAuditLogsSource](../../../eventing/samples/cloud-audit-logs-source/README.md) example for more details.
[CloudPubSubSource](https://github.com/google/knative-gcp/blob/main/docs/examples/cloudpubsubsource/README.md) | v1 | Google | Brings [Cloud Pub/Sub](https://cloud.google.com/pubsub/) messages into Knative. The CloudPubSubSource fires a new event each time a message is published on a [Google Cloud Platform PubSub topic](https://cloud.google.com/pubsub/). See the [CloudPubSubSource](./cloud-pubsub-source) example for more details. [CloudPubSubSource](https://github.com/google/knative-gcp/blob/main/docs/examples/cloudpubsubsource/README.md) | v1 | Google | Brings [Cloud Pub/Sub](https://cloud.google.com/pubsub/) messages into Knative. The CloudPubSubSource fires a new event each time a message is published on a [Google Cloud Platform PubSub topic](https://cloud.google.com/pubsub/). See the [CloudPubSubSource](../../../eventing/samples/cloud-pubsub-source/README.md) example for more details.
[CloudSchedulerSource](https://github.com/google/knative-gcp/blob/main/docs/examples/cloudschedulersource/README.md) | v1 | Google | Create, update, and delete [Google Cloud Scheduler](https://cloud.google.com/scheduler/) Jobs. When those jobs are triggered, receive the event inside Knative. See the [CloudSchedulerSource](./cloud-scheduler-source) example for further details. [CloudSchedulerSource](https://github.com/google/knative-gcp/blob/main/docs/examples/cloudschedulersource/README.md) | v1 | Google | Create, update, and delete [Google Cloud Scheduler](https://cloud.google.com/scheduler/) Jobs. When those jobs are triggered, receive the event inside Knative. See the [CloudSchedulerSource](../../../eventing/samples/cloud-scheduler-source/README.md) example for further details.
[CloudStorageSource](https://github.com/google/knative-gcp/blob/main/docs/examples/cloudstoragesource/README.md) | v1 | Google | Registers for events of the specified types on the specified [Google Cloud Storage](https://cloud.google.com/storage/) bucket and optional object prefix. Brings those events into Knative. See the [CloudStorageSource](./cloud-storage-source) example. [CloudStorageSource](https://github.com/google/knative-gcp/blob/main/docs/examples/cloudstoragesource/README.md) | v1 | Google | Registers for events of the specified types on the specified [Google Cloud Storage](https://cloud.google.com/storage/) bucket and optional object prefix. Brings those events into Knative. See the [CloudStorageSource](../../../eventing/samples/cloud-storage-source/README.md) example.
[DockerHubSource](https://github.com/tom24d/eventing-dockerhub) | v1alpha1 | None | Retrieves events from [Docker Hub Webhooks](https://docs.docker.com/docker-hub/webhooks/) and transforms them into CloudEvents for consumption in Knative. [DockerHubSource](https://github.com/tom24d/eventing-dockerhub) | v1alpha1 | None | Retrieves events from [Docker Hub Webhooks](https://docs.docker.com/docker-hub/webhooks/) and transforms them into CloudEvents for consumption in Knative.
[FTP / SFTP](https://github.com/vaikas-google/ftp) | Proof of concept | None | Watches for files being uploaded into a FTP/SFTP and generates events for those. [FTP / SFTP](https://github.com/vaikas-google/ftp) | Proof of concept | None | Watches for files being uploaded into a FTP/SFTP and generates events for those.
[GitHub Issue Comments](https://github.com/BrianMMcClain/github-issue-comment-source)| Proof of Concept | None | Polls a specific GitHub issue for new comments. [GitHub Issue Comments](https://github.com/BrianMMcClain/github-issue-comment-source)| Proof of Concept | None | Polls a specific GitHub issue for new comments.
@ -83,6 +78,6 @@ All Sources are part of the `sources` category.
## Additional resources ## Additional resources
- For information about creating your own Source type, see the [tutorial on writing a Source with a Receive Adapter](./creating-event-sources/writing-event-source). - For information about creating your own Source type, see the [tutorial on writing a Source with a Receive Adapter](./creating-event-sources/writing-event-source/README.md).
- If your code needs to send events as part of its business logic and doesn't fit the model of a Source, consider [feeding events directly to a Broker](https://knative.dev/docs/eventing/broker/). - If your code needs to send events as part of its business logic and doesn't fit the model of a Source, consider [feeding events directly to a Broker](https://knative.dev/docs/eventing/broker/).
- For more information about using `kn` Source related commands, see the [`kn source` reference documentation](https://github.com/knative/client/blob/main/docs/cmd/kn_source.md). - For more information about using `kn` Source related commands, see the [`kn source` reference documentation](https://github.com/knative/client/blob/main/docs/cmd/kn_source.md).

View File

@ -1,8 +1,8 @@
# Knative Eventing # Knative Eventing
Knative Eventing enables developers to use an [event-driven architecture](https://en.wikipedia.org/wiki/Event-driven_architecture) with serverless applications. An event-driven architecture is based on the concept of decoupled relationships between event producers that create events, and event consumers, or [_sinks_](../../developer/eventing/sinks), that receive events. Knative Eventing enables developers to use an [event-driven architecture](https://en.wikipedia.org/wiki/Event-driven_architecture) with serverless applications. An event-driven architecture is based on the concept of decoupled relationships between event producers that create events, and event consumers, or [_sinks_](../developer/eventing/sinks/README.md), that receive events.
In a Knative Eventing deployment, event [Sources](../../eventing/sources) are the primary event producers, however you can also configure a sink or _subscriber_ to respond to HTTP requests by sending a response event. Examples of sinks in a Knative Eventing deployment include Knative Services, Channels and Brokers. In a Knative Eventing deployment, event [Sources](../developer/eventing/sources/README.md) are the primary event producers, however you can also configure a sink or _subscriber_ to respond to HTTP requests by sending a response event. Examples of sinks in a Knative Eventing deployment include Knative Services, Channels and Brokers.
<!--TODO: Add response / reply event information, maybe diagrams--> <!--TODO: Add response / reply event information, maybe diagrams-->
Knative Eventing uses standard HTTP POST requests to send and receive events between event producers and sinks. These events conform to the [CloudEvents specifications](https://cloudevents.io/), which enables creating, parsing, sending, and receiving events in any programming language. Knative Eventing uses standard HTTP POST requests to send and receive events between event producers and sinks. These events conform to the [CloudEvents specifications](https://cloudevents.io/), which enables creating, parsing, sending, and receiving events in any programming language.
@ -18,7 +18,7 @@ Consume an event without creating a publisher
: You can use a trigger to consume events from a broker based on event attributes. The application receives events as an HTTP POST. : You can use a trigger to consume events from a broker based on event attributes. The application receives events as an HTTP POST.
!!! tip !!! tip
Multiple event producers and sinks can be used together to create more advanced [Knative Eventing flows](../../eventing/flows/) to solve complex use cases. Multiple event producers and sinks can be used together to create more advanced [Knative Eventing flows](./flows/README.md) to solve complex use cases.
<!--TODO: What about channels?--> <!--TODO: What about channels?-->
@ -43,4 +43,4 @@ the registry contain (all) the required information for a consumer to create a
Trigger without resorting to some other out-of-band mechanism. Trigger without resorting to some other out-of-band mechanism.
To learn how to use the registry, see the To learn how to use the registry, see the
[Event Registry documentation](../../eventing/event-registry). [Event Registry documentation](./event-registry.md).

View File

@ -10,6 +10,6 @@ showlandingtoc: "true"
Use the following code samples to help you understand the various use cases for Use the following code samples to help you understand the various use cases for
Knative Eventing and Event Sources. Knative Eventing and Event Sources.
[Learn more about Knative Eventing and Eventing Sources](../). [Learn more about Knative Eventing and Eventing Sources](../README.md).
[**See all Knative code samples**](../../samples.md) [**See all Knative code samples**](../../samples.md)

View File

Before

Width:  |  Height:  |  Size: 59 KiB

After

Width:  |  Height:  |  Size: 59 KiB

View File

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View File

@ -1,224 +0,0 @@
# Creating a ContainerSource object
![API version v1](https://img.shields.io/badge/API_Version-v1-red?style=flat-square)
This topic describes how to configure ContainerSource as an event source for
functions.
The ContainerSource object starts a container image that generates events and
sends messages to a sink URI. You can also use ContainerSource to support your
own event sources in Knative.
In the examples below, the event source is a heartbeats container and the sink
is a Knative Service.
If you have an existing event source and sink, you can replace the examples with
your own values.
## Before you begin
Before you can create a ContainerSource object:
- You must have [Knative Eventing](../../../admin/install/install-eventing-with-yaml)
installed on your cluster.
- If you want to use the example heartbeats event source below, you must also:
- Install [ko](https://github.com/google/ko)
- Set `KO_DOCKER_REPO`. For example, `gcr.io/[gcloud-project]` or `docker.io/<username>`
- Authenticate with your `KO_DOCKER_REPO`
- Install [`docker`](https://docs.docker.com/install/)
## Create a ContainerSource object
1. Build an image of your event source and publish it to your image repository.
Your image must read the environment variable `K_SINK` and post messages to the
URL specified in `K_SINK`. If you do not already have an image, you can use
the following example heartbeats event source by running the commands:
```bash
git clone -b "{{ branch }}" https://github.com/knative/eventing.git
```
```bash
ko publish ko://knative.dev/eventing/cmd/heartbeats
```
1. Create a namespace for your ContainerSource by running the command:
```bash
kubectl create namespace <namespace>
```
Where `<namespace>` is the namespace that you want your ContainerSource to use.
For example, `containersource-example`.
1. Create a sink. If you do not already have a sink, you can use the following Knative
Service, which dumps incoming messages into its log, by running the command:
!!! note
To create a Knative service you must have Knative Serving installed on your cluster.
=== "kn"
```bash
kn service create event-display --port 8080 --image gcr.io/knative-releases/knative.dev/eventing/cmd/event_display
```
=== "YAML"
```yaml
kubectl -n containersource-example apply -f - <<EOF
apiVersion: apps/v1
kind: Deployment
metadata:
name: event-display
spec:
replicas: 1
selector:
matchLabels: &labels
app: event-display
template:
metadata:
labels: *labels
spec:
containers:
- name: event-display
image: gcr.io/knative-releases/knative.dev/eventing/cmd/event_display
---
kind: Service
apiVersion: v1
metadata:
name: event-display
spec:
selector:
app: event-display
ports:
- protocol: TCP
port: 80
targetPort: 8080
EOF
```
1. Create a concrete ContainerSource with specific arguments and environment
settings by running the command:
=== "kn"
```bash
kn source container create <name> --image <image-uri> --sink <sink>
```
Where:
- `<name>` is the name you want for your ContainerSource object,
for example, `test-heartbeats`.
- `<image-uri>` corresponds to the image URI you built and published
in step 1, for example, `gcr.io/[gcloud-project]/knative.dev/eventing/cmd/heartbeats`.
- `<sink>` is the name of your sink, for example `<event-display>`.
For a list of available options, see the [Knative client documentation](https://github.com/knative/client/blob/main/docs/cmd/kn_source_container_create.md#kn-source-container-create).
=== "YAML"
```yaml
kubectl -n <namespace> apply -f - <<EOF
apiVersion: sources.knative.dev/v1
kind: ContainerSource
metadata:
name: <containersource-name>
spec:
template:
spec:
containers:
- image: <event-source-image-uri>
name: <container-name>
env:
- name: POD_NAME
value: "<pod-name>"
- name: POD_NAMESPACE
value: "<pod-namespace>"
sink:
ref:
apiVersion: v1
kind: Service
name: <sink>
EOF
```
Where:
- `<namespace>` is the namespace you created for your ContainerSource,
for example, `containersource-example`.
- `<containersource-name>` is the name you want for your ContainerSource,
for example, `test-heartbeats`.
- `<event-source-image-uri>` corresponds to the image URI you built and published
in step 1, for example, `gcr.io/[gcloud-project]/knative.dev/eventing/cmd/heartbeats`.
- `<container-name>` is the name of your event source, for example, `heartbeats`.
- `<pod-name>` is the name of the Pod that the container runs in, for example, `mypod`.
- `<pod-namespace>` is the namespace that the Pod runs in, for example, `event-test`.
- `<sink>` is the name of your sink, for example, `event-display`.
For more information about the fields you can configure for the ContainerSource
object, see [ContainerSource Reference](reference.md).
!!! note
Arguments and environment variables are set and are passed to the container.
## Verify the ContainerSource object
1. View the logs for your event consumer by running the command:
```shell
kubectl -n <namespace> logs -l <pod-name> --tail=200
```
Where:
- `<namespace>` is the namespace that contains the ContainerSource object.
- `<pod-name>` is the name of the Pod that the container runs in.
For example:
```shell
$ kubectl -n containersource-example logs -l app=event-display --tail=200
```
1. Verify that the output returns the properties of the events that your
ContainerSource sent to your sink.
In the example below, the command has returned the `Attributes` and `Data` properties
of the events that the ContainerSource sent to the `event-display` Service:
```
☁️ cloudevents.Event
Validation: valid
Context Attributes,
specversion: 1.0
type: dev.knative.eventing.samples.heartbeat
source: https://knative.dev/eventing/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": 2,
"label": ""
}
```
## Cleanup
To delete the ContainerSource object and all of the related resources in the
namespace:
- Delete the namespace by running the command:
```shell
kubectl delete namespace <namespace>
```
Where `<namespace>` is the namespace that contains the ContainerSource object.
## Reference Documentation
See the [ContainerSource specification](../../../reference/api/eventing/eventing/#sources.knative.dev/v1.ContainerSource).

View File

@ -1,149 +0,0 @@
# ContainerSource reference
This topic provides reference information about the configurable fields for the
ContainerSource object.
## ContainerSource
A ContainerSource definition supports the following fields:
| Field | Description | Required or optional |
|-------|-------------|----------------------|
| [`apiVersion`][kubernetes-overview] | Specifies the API version, for example `sources.knative.dev/v1`. | Required |
| [`kind`][kubernetes-overview] | Identifies this resource object as a ContainerSource object. | Required |
| [`metadata`][kubernetes-overview] | Specifies metadata that uniquely identifies the ContainerSource object. For example, a `name`. | Required |
| [`spec`][kubernetes-overview] | Specifies the configuration information for this ContainerSource object. | Required |
| [`spec.sink`](#sink-parameter) | A reference to an object that resolves to a URI to use as the sink. | Required |
| [`spec.template`](#template-parameter) | A `template` in the shape of `Deployment.spec.template` to be used for this ContainerSource. | Required |
| [`spec.ceOverrides`](#cloudevent-overrides) | Defines overrides to control the output format and modifications to the event sent to the sink. | Optional |
### Sink parameter
The `sink` parameter is a reference to an object that resolves to a URI to use as the sink.
A `sink` definition supports the following fields:
| Field | Description | Required or optional |
|-------|-------------|----------------------|
| `ref` | This points to an Addressable. | Required if _not_ using `uri` |
| `ref.apiVersion` | API version of the referent. | Required if using `ref` |
| [`ref.kind`][kubernetes-kinds] | Kind of the referent. | Required if using `ref` |
| [`ref.name`][kubernetes-names] | Name of the referent. | Required if using `ref` |
| [`ref.namespace`][kubernetes-namespaces] | Namespace of the referent. If omitted this defaults to the object holding it. | Optional |
| `uri` | This can be an absolute URL with a non-empty scheme and non-empty host that points to the target or a relative URI. Relative URIs are resolved using the base URI retrieved from Ref. | Required if _not_ using `ref` |
!!! note
At least one of `ref` or `uri` is required. If both are specified, `uri` is
resolved into the URL from the Addressable `ref` result.
#### Example: sink parameter
Given the following YAML, if `ref` resolves into
`"http://mysink.default.svc.cluster.local"`, then `uri` is added to this
resulting in `"http://mysink.default.svc.cluster.local/extra/path"`.
<!-- TODO we should have a page to point to describing the ref+uri destinations and the rules we use to resolve those and reuse the page. -->
```yaml
apiVersion: sources.knative.dev/v1
kind: ContainerSource
metadata:
name: test-heartbeats
spec:
...
sink:
ref:
apiVersion: v1
kind: Service
namespace: default
name: mysink
uri: /extra/path
```
!!! contract
This results in the `K_SINK` environment variable being set as
`"http://mysink.default.svc.cluster.local/extra/path"`. <!-- unsure about this -->
### Template parameter
This is a `template` in the shape of `Deployment.spec.template` to use for the ContainerSource.
For more information, see the [Kubernetes Documentation](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/).
<!-- not sure what the required and optional fields are for this. -->
#### Example: template parameter
```yaml
apiVersion: sources.knative.dev/v1
kind: ContainerSource
metadata:
name: test-heartbeats
spec:
template:
spec:
containers:
- image: gcr.io/[gcloud-project]/knative.dev/eventing/cmd/heartbeats
name: heartbeats
args:
- --period=1
env:
- name: POD_NAME
value: "mypod"
- name: POD_NAMESPACE
value: "event-test"
...
```
### CloudEvent Overrides
CloudEvent Overrides defines overrides to control the output format and
modifications of the event sent to the sink.
A `ceOverrides` definition supports the following fields:
| Field | Description | Required or optional |
|-------|-------------|----------------------|
| `extensions` | Specifies which attributes are added or overridden on the outbound event. Each `extensions` key-value pair is set independently on the event as an attribute extension. | Optional |
!!! note
Only valid [CloudEvent attribute names][cloudevents-attribute-naming]
are allowed as extensions. You cannot set the spec defined attributes from
the extensions override configuration. For example, you can not modify the
`type` attribute.
#### Example: CloudEvent Overrides
```yaml
apiVersion: sources.knative.dev/v1
kind: ContainerSource
metadata:
name: test-heartbeats
spec:
...
ceOverrides:
extensions:
extra: this is an extra attribute
additional: 42
```
!!! contract
This results in the `K_CE_OVERRIDES` environment variable being set on the
`subject` as follows: <!-- unsure about this -->
```{ .json .no-copy }
{ "extensions": { "extra": "this is an extra attribute", "additional": "42" } }
```
[kubernetes-overview]:
https://kubernetes.io/docs/concepts/overview/working-with-objects/kubernetes-objects/#required-fields
[kubernetes-kinds]:
https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
[kubernetes-names]:
https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
[kubernetes-namespaces]:
https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/
[cloudevents-attribute-naming]:
https://github.com/cloudevents/spec/blob/v1.0.1/spec.md#attribute-naming-convention

View File

@ -10,7 +10,7 @@ With Knative Serving, we have a powerful tool which can take our containerized c
==**Knative Eventing acts as the "glue" between the disparate parts of your architecture**== and allows you to easily communicate between those parts in a fault-tolerant way. Some examples include: ==**Knative Eventing acts as the "glue" between the disparate parts of your architecture**== and allows you to easily communicate between those parts in a fault-tolerant way. Some examples include:
:material-file-document: [Creating and responding to Kubernetes API events](../../eventing/sources/apiserversource/){target=blank} :material-file-document: [Creating and responding to Kubernetes API events](../developer/eventing/sources/apiserversource/README.md){target=blank}
--8<-- "YouTube_icon.svg" --8<-- "YouTube_icon.svg"
[Creating an image processing pipeline](https://www.youtube.com/watch?v=DrmOpjAunlQ){target=blank} [Creating an image processing pipeline](https://www.youtube.com/watch?v=DrmOpjAunlQ){target=blank}