From 5b12a2343e94d67bc652d48e45ad836d07aadced Mon Sep 17 00:00:00 2001 From: Ville Aikas Date: Tue, 18 Jun 2019 15:51:20 +0300 Subject: [PATCH 01/12] sequence with broker --- .../sequence-with-broker-trigger/README.md | 224 ++++++++++++++++++ .../cron-source.yaml | 11 + .../display-trigger.yaml | 27 +++ .../sequence-with-broker-trigger.png | Bin 0 -> 16536 bytes .../sequence.yaml | 25 ++ .../sequence-with-broker-trigger/steps.yaml | 47 ++++ .../sequence-with-broker-trigger/trigger.yaml | 14 ++ docs/eventing/sequence.md | 78 ++++++ 8 files changed, 426 insertions(+) create mode 100644 docs/eventing/samples/sequence/sequence-with-broker-trigger/README.md create mode 100644 docs/eventing/samples/sequence/sequence-with-broker-trigger/cron-source.yaml create mode 100644 docs/eventing/samples/sequence/sequence-with-broker-trigger/display-trigger.yaml create mode 100644 docs/eventing/samples/sequence/sequence-with-broker-trigger/sequence-with-broker-trigger.png create mode 100644 docs/eventing/samples/sequence/sequence-with-broker-trigger/sequence.yaml create mode 100644 docs/eventing/samples/sequence/sequence-with-broker-trigger/steps.yaml create mode 100644 docs/eventing/samples/sequence/sequence-with-broker-trigger/trigger.yaml create mode 100644 docs/eventing/sequence.md diff --git a/docs/eventing/samples/sequence/sequence-with-broker-trigger/README.md b/docs/eventing/samples/sequence/sequence-with-broker-trigger/README.md new file mode 100644 index 00000000000..5f6c9db1b67 --- /dev/null +++ b/docs/eventing/samples/sequence/sequence-with-broker-trigger/README.md @@ -0,0 +1,224 @@ +--- +title: "Sequence with Broker and Trigger" +weight: 20 +type: "docs" +--- + +# Using Sequence with Broker and Trigger + +## Prerequisites + +For this example, we'll assume you have set up a `Broker` and an `InMemoryChannel` +as well as Knative Serving (for our functions). The examples use `newbroker` +namespace, again, if your broker lives in another Namespace, you will need to +modify the examples to reflect this. +If you want to use different type of `Channel`, you will have to modify the +`Sequence.Spec.ChannelTemplate` to create the appropriate Channel resources. + +## Overview + +We are going to create the following logical configuration. We create a CronJobSource, +feeding events into the Broker, then we create a `Filter` that wires those events +into a Sequence consisting of 3 steps. Then we take the end of the Sequence and +feed newly minted events back into the Broker and create another Trigger which +will then display those events. +**NOTE** [TODO: Fix this](https://github.com/knative/eventing/issues/1421) +So, currently as set up, the events emitted by the Sequence do not make it into +the Broker. + +![Logical Configuration](./sequence-with-broker-trigger.png) + + +## Setup + +### Create the Knative Services + +Change `newbroker` below to create the steps in the Namespace where you have configured your +`Broker` + +```yaml +apiVersion: serving.knative.dev/v1alpha1 +kind: Service +metadata: + name: first +spec: + runLatest: + configuration: + revisionTemplate: + spec: + container: + image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + env: + - name: STEP + value: "0" + +--- +apiVersion: serving.knative.dev/v1alpha1 +kind: Service +metadata: + name: second +spec: + runLatest: + configuration: + revisionTemplate: + spec: + container: + image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + env: + - name: STEP + value: "1" +--- +apiVersion: serving.knative.dev/v1alpha1 +kind: Service +metadata: + name: third +spec: + runLatest: + configuration: + revisionTemplate: + spec: + container: + image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + env: + - name: STEP + value: "2" + +--- +``` + + +```shell +kubectl -n newbroker create -f ./steps.yaml +``` + +### Create the Sequence + +Here, if you are using different type of Channel, you need to change the +spec.channelTemplate to point to your desired Channel. Also, change the +spec.reply.name to point to your `Broker` + +```yaml +apiVersion: messaging.knative.dev/v1alpha1 +kind: Sequence +metadata: + name: sequence +spec: + channelTemplate: + apiVersion: messaging.knative.dev/v1alpha1 + kind: InMemoryChannel + steps: + - ref: + apiVersion: serving.knative.dev/v1alpha1 + kind: Service + name: first + - ref: + apiVersion: serving.knative.dev/v1alpha1 + kind: Service + name: second + - ref: + apiVersion: serving.knative.dev/v1alpha1 + kind: Service + name: third + reply: + kind: Broker + apiVersion: eventing.knative.dev/v1alpha1 + name: broker-test +``` + +Change `newbroker` below to create the `Sequence` in the Namespace where you have configured your +`Broker`. +```shell +kubectl -n newbroker create -f ./sequence.yaml +``` + + +### Create the CronJobSource targeting the Broker + +```yaml +apiVersion: sources.eventing.knative.dev/v1alpha1 +kind: CronJobSource +metadata: + name: cronjob-source +spec: + schedule: "*/2 * * * *" + data: '{"message": "Hello world!"}' + sink: + apiVersion: eventing.knative.dev/v1alpha1 + kind: Broker + name: broker-test +``` + +Here, if you are using different type of Channel, you need to change the +spec.channelTemplate to point to your desired Channel. Also, change the +spec.reply.name to point to your `Broker` + +Change `newbroker` below to create the `Sequence` in the Namespace where you have configured your +`Broker`. +```shell +kubectl -n newbroker create -f ./cron-source.yaml +``` + +### Create the Trigger targeting the Sequence + +```yaml +apiVersion: eventing.knative.dev/v1alpha1 +kind: Trigger +metadata: + name: sequence-trigger +spec: + filter: + sourceAndType: + type: dev.knative.cronjob.event + subscriber: + ref: + apiVersion: messaging.knative.dev/v1alpha1 + kind: Sequence + name: sequence +``` + +Change `newbroker` below to create the `Sequence` in the Namespace where you have configured your +`Broker`. +```shell +kubectl -n newbroker create -f ./trigger.yaml + +``` + +### Create the Service and Trigger displaying the events created by Sequence + +**NOTE** This does not work yet because the events created by the Sequence in the last step +are filtered. [TODO: Fix this](https://github.com/knative/eventing/issues/1421) + +```yaml +apiVersion: serving.knative.dev/v1alpha1 +kind: Service +metadata: + name: sequence-display +spec: + runLatest: + configuration: + revisionTemplate: + spec: + container: + image: gcr.io/knative-releases/github.com/knative/eventing-sources/cmd/event_display +--- +apiVersion: eventing.knative.dev/v1alpha1 +kind: Trigger +metadata: + name: sequence-trigger +spec: + filter: + sourceAndType: + type: samples.http.mod3 + subscriber: + ref: + apiVersion: serving.knative.dev/v1alpha1 + kind: Service + name: sequence-display +--- +``` + +Change `newbroker` below to create the `Sequence` in the Namespace where you have configured your +`Broker`. +```shell +kubectl -n newbroker create -f ./display-trigger.yaml + diff --git a/docs/eventing/samples/sequence/sequence-with-broker-trigger/cron-source.yaml b/docs/eventing/samples/sequence/sequence-with-broker-trigger/cron-source.yaml new file mode 100644 index 00000000000..863ebc91555 --- /dev/null +++ b/docs/eventing/samples/sequence/sequence-with-broker-trigger/cron-source.yaml @@ -0,0 +1,11 @@ +apiVersion: sources.eventing.knative.dev/v1alpha1 +kind: CronJobSource +metadata: + name: cronjob-source +spec: + schedule: "*/2 * * * *" + data: '{"message": "Hello world!"}' + sink: + apiVersion: eventing.knative.dev/v1alpha1 + kind: Broker + name: broker-test diff --git a/docs/eventing/samples/sequence/sequence-with-broker-trigger/display-trigger.yaml b/docs/eventing/samples/sequence/sequence-with-broker-trigger/display-trigger.yaml new file mode 100644 index 00000000000..200996cf4ad --- /dev/null +++ b/docs/eventing/samples/sequence/sequence-with-broker-trigger/display-trigger.yaml @@ -0,0 +1,27 @@ +apiVersion: serving.knative.dev/v1alpha1 +kind: Service +metadata: + name: sequence-display +spec: + runLatest: + configuration: + revisionTemplate: + spec: + container: + image: gcr.io/knative-releases/github.com/knative/eventing-sources/cmd/event_display +--- +apiVersion: eventing.knative.dev/v1alpha1 +kind: Trigger +metadata: + name: display-trigger +spec: + broker: broker-test + filter: + sourceAndType: + type: samples.http.mod3 + subscriber: + ref: + apiVersion: serving.knative.dev/v1alpha1 + kind: Service + name: sequence-display +--- \ No newline at end of file diff --git a/docs/eventing/samples/sequence/sequence-with-broker-trigger/sequence-with-broker-trigger.png b/docs/eventing/samples/sequence/sequence-with-broker-trigger/sequence-with-broker-trigger.png new file mode 100644 index 0000000000000000000000000000000000000000..756cfdaa2d1084337052bad38251a94a62984cb9 GIT binary patch literal 16536 zcmeIZX*`?h+c$pMszyu8bX9c5t=cMDsCE$cp8vb&d3%5Eyvrrmc^>DnpWox_kMnNM z8-LjO0{{RU&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Hiq&w)3ArRa#OzL{aK&7w?9TWFG|2FVT*9nkV3353*JT;m@ z`opw;A?bzR9mqnfun-qR4)I?mFw~uvUl{p%5hZypyS^{D>k&9l8={)Ag}Bx`$rLPB zwv+1Ys|Y^e(te=CNi0E#y0&ls+ALl*oRL#N=7q!1&xDQx3L3{}1u4rO1gg9xiz9{K zV|qA^5T+Oop4!+l9GgrPuWX?WP|Ow-WBS+(Hy%TzfWk7I%t=rMOQ(>t;Hs#lM}dMt zfN(aIGPMz9ySsVMT}G~Bliqn<0;^l z=DE5m(XAo(5!qWLTYzuA%6WdJN$R+;458KO{aL5*$@MLdbW(NCg5*G`&F*G-KcD(x z-ngzDX~RUfDm!jc-$qN(;$O0ePc_y8e0D!z1|AJoHU8qAbpT za)O{#mk4_(etbi)GOCw(sfxOMkJB-p^eHwj^j}#X00d-5)=#$lbTJsM-etgIRfc^9=WddY~1(_{s=xyL0;+TGUDVY!jjAym#=g= z=%!(r#~3*CbXCPthS!Y06xY?kpTlJkBWn`#b$8HRonUcIVh$-@Co_-+L*rbyYk~1r8{zuNYW?umAHW1^EAcv46t}YU8#9D7}9D5mo4^4!-$6pa0Ro|7hTUH1Izf`0uHK*)@{7I#{#-;JBQI fJpJG1ke4-2b=pKaB;xZFM>=!T?HA(lfVBS)jn)JE literal 0 HcmV?d00001 diff --git a/docs/eventing/samples/sequence/sequence-with-broker-trigger/sequence.yaml b/docs/eventing/samples/sequence/sequence-with-broker-trigger/sequence.yaml new file mode 100644 index 00000000000..03f6d6328b4 --- /dev/null +++ b/docs/eventing/samples/sequence/sequence-with-broker-trigger/sequence.yaml @@ -0,0 +1,25 @@ +apiVersion: messaging.knative.dev/v1alpha1 +kind: Sequence +metadata: + name: sequence +spec: + channelTemplate: + apiVersion: messaging.knative.dev/v1alpha1 + kind: InMemoryChannel + steps: + - ref: + apiVersion: serving.knative.dev/v1alpha1 + kind: Service + name: first + - ref: + apiVersion: serving.knative.dev/v1alpha1 + kind: Service + name: second + - ref: + apiVersion: serving.knative.dev/v1alpha1 + kind: Service + name: third + reply: + kind: Broker + apiVersion: eventing.knative.dev/v1alpha1 + name: broker-test diff --git a/docs/eventing/samples/sequence/sequence-with-broker-trigger/steps.yaml b/docs/eventing/samples/sequence/sequence-with-broker-trigger/steps.yaml new file mode 100644 index 00000000000..54754068599 --- /dev/null +++ b/docs/eventing/samples/sequence/sequence-with-broker-trigger/steps.yaml @@ -0,0 +1,47 @@ +apiVersion: serving.knative.dev/v1alpha1 +kind: Service +metadata: + name: first +spec: + runLatest: + configuration: + revisionTemplate: + spec: + container: + image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + env: + - name: STEP + value: "0" + +--- +apiVersion: serving.knative.dev/v1alpha1 +kind: Service +metadata: + name: second +spec: + runLatest: + configuration: + revisionTemplate: + spec: + container: + image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + env: + - name: STEP + value: "1" +--- +apiVersion: serving.knative.dev/v1alpha1 +kind: Service +metadata: + name: third +spec: + runLatest: + configuration: + revisionTemplate: + spec: + container: + image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + env: + - name: STEP + value: "2" + +--- diff --git a/docs/eventing/samples/sequence/sequence-with-broker-trigger/trigger.yaml b/docs/eventing/samples/sequence/sequence-with-broker-trigger/trigger.yaml new file mode 100644 index 00000000000..78e3043d002 --- /dev/null +++ b/docs/eventing/samples/sequence/sequence-with-broker-trigger/trigger.yaml @@ -0,0 +1,14 @@ +apiVersion: eventing.knative.dev/v1alpha1 +kind: Trigger +metadata: + name: sequence-trigger +spec: + broker: broker-test + filter: + sourceAndType: + type: dev.knative.cronjob.event + subscriber: + ref: + apiVersion: messaging.knative.dev/v1alpha1 + kind: Sequence + name: sequence diff --git a/docs/eventing/sequence.md b/docs/eventing/sequence.md new file mode 100644 index 00000000000..78f843dd403 --- /dev/null +++ b/docs/eventing/sequence.md @@ -0,0 +1,78 @@ +--- +title: "Sequence" +weight: 20 +type: "docs" +--- + +Sequence CRD provides a way to define a an in-order list of functions that will +be invoked. Sequence creates `Channel`s and `Subscription`s under the hood. + +## Usage + +### Sequence Spec + +Sequence has three parts for the Spec: + +1. `Steps` which defines the in-order list of `Subscriber`s, aka, which functions +are executed in the listed order. These are specified using the +`eventingv1alpha1.SubscriberSpec` just like you would when creating `Subscription`. +Each step should be `Callable`. +1. `ChannelTemplate` defines the Template which will be used to create `Channel`s +between the steps. +1. `Reply` (Optional) Reference to where the results of the final step in the +sequence are sent to. + +### Sequence Status + +Sequence has four parts for the Status: + +1. Conditions which detail the overall Status of the Sequence object +1. ChannelStatuses which convey the Status of underlying `Channel` resources that +are created as part of this Sequence. It is an array and each Status corresponds to the Step number, +so the first entry in the array is the Status of the `Channel` before the first Step. +1. SubscriptionStatuses which convey the Status of underlying `Subscription` resources that +are created as part of this Sequence. It is an array and each Status corresponds to the Step number, so +the first entry in the array is the `Subscription` which is created to wire the first channel to the +first step in the `Steps` array. +1. AddressStatus which is exposed so that Sequence can be used where Addressable can be used. Sending +to this address will target the `Channel` which is fronting the first Step in the Sequence. + + +## Examples + +For each of these examples below, we'll use +[`CronJobSource`](https://knative.dev/v0.4-docs/reference/eventing/eventing-sources-api/#CronJobSource) +as the source of events. + +### Sequence with no reply (terminal last Step) + +For the first example, we'll use a 3 Step `Sequence` that is wired directly into the `CronJobSource`. +Each of the steps simply tacks on "- Handled by ", for example the first Step in the +`Sequence` will take the incoming message and append "- Handled by 0" to the incoming message. + +### Sequence with reply (last Step produces output) + +For the next example, we'll use the same 3 Step `Sequence` that is wired directly into the `CronJobSource`. +Each of the steps simply tacks on "- Handled by ", for example the first Step in the +`Sequence` will take the incoming message and append "- Handled by 0" to the incoming message. +The only difference is that we'll use the `Subscriber.Spec.Reply` field to wire the output of the +last Step to an event display pod. + +### Chaining Sequences together + +For the next example, we'll use the same 3 Step `Sequence` that is wired directly into the `CronJobSource`. +Each of the steps simply tacks on "- Handled by ", for example the first Step in the +`Sequence` will take the incoming message and append "- Handled by 0" to the incoming message. +The only difference is that we'll use the `Subscriber.Spec.Reply` field to wire the output of the +last Step to another `Sequence` that does the smae message modifications as the first pipeline (with +different steps however). + +### Using Sequence with Broker/Trigger model + +You can also create a Trigger which targets `Sequence`. This time we'll wire `CronJobSource` to send +events to a `Broker` and then we'll have the `Sequence` emit the resulting Events back into the Broker +so that the results of the `Sequence` can be observed by other `Trigger`s. + + + + From ac46e8ae6a14f6a03782ec86fa14ec7863b42bca Mon Sep 17 00:00:00 2001 From: Ville Aikas Date: Tue, 18 Jun 2019 17:01:50 +0300 Subject: [PATCH 02/12] add sequence -> sequence sample --- .../sequence-reply-to-sequence/README.md | 288 ++++++++++++++++++ .../cron-source.yaml | 11 + .../event-display.yaml | 11 + .../sequence-reply-to-sequence.png | Bin 0 -> 16955 bytes .../sequence-reply-to-sequence/sequence1.yaml | 25 ++ .../sequence-reply-to-sequence/sequence2.yaml | 25 ++ .../sequence-reply-to-sequence/steps.yaml | 92 ++++++ .../sequence-with-broker-trigger/README.md | 1 + docs/eventing/sequence.md | 4 +- 9 files changed, 455 insertions(+), 2 deletions(-) create mode 100644 docs/eventing/samples/sequence/sequence-reply-to-sequence/README.md create mode 100644 docs/eventing/samples/sequence/sequence-reply-to-sequence/cron-source.yaml create mode 100644 docs/eventing/samples/sequence/sequence-reply-to-sequence/event-display.yaml create mode 100644 docs/eventing/samples/sequence/sequence-reply-to-sequence/sequence-reply-to-sequence.png create mode 100644 docs/eventing/samples/sequence/sequence-reply-to-sequence/sequence1.yaml create mode 100644 docs/eventing/samples/sequence/sequence-reply-to-sequence/sequence2.yaml create mode 100644 docs/eventing/samples/sequence/sequence-reply-to-sequence/steps.yaml diff --git a/docs/eventing/samples/sequence/sequence-reply-to-sequence/README.md b/docs/eventing/samples/sequence/sequence-reply-to-sequence/README.md new file mode 100644 index 00000000000..08ec7edb535 --- /dev/null +++ b/docs/eventing/samples/sequence/sequence-reply-to-sequence/README.md @@ -0,0 +1,288 @@ +--- +title: "Sequence Wired to another Sequence" +weight: 20 +type: "docs" +--- + +# Using Sequences in series + +## Prerequisites + +For this example, we'll assume you have set up a `Broker` and an `InMemoryChannel` +as well as Knative Serving (for our functions). The examples use `newbroker` +namespace, again, if your broker lives in another Namespace, you will need to +modify the examples to reflect this. +If you want to use different type of `Channel`, you will have to modify the +`Sequence.Spec.ChannelTemplate` to create the appropriate Channel resources. + +## Overview + +We are going to create the following logical configuration. We create a CronJobSource, +feeding events to a `Sequence`, then taking the output of that `Sequence` and sending +it to a second `Sequence` and finally displaying the resulting output. + +![Logical Configuration](./sequence-reply-to-sequence.png) + + +## Setup + +### Create the Knative Services + +Change `newbroker` below to create the steps in the Namespace where you have configured your +`Broker` + +```yaml +apiVersion: serving.knative.dev/v1alpha1 +kind: Service +metadata: + name: first +spec: + runLatest: + configuration: + revisionTemplate: + spec: + container: + image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + env: + - name: STEP + value: "0" + +--- +apiVersion: serving.knative.dev/v1alpha1 +kind: Service +metadata: + name: second +spec: + runLatest: + configuration: + revisionTemplate: + spec: + container: + image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + env: + - name: STEP + value: "1" +--- +apiVersion: serving.knative.dev/v1alpha1 +kind: Service +metadata: + name: third +spec: + runLatest: + configuration: + revisionTemplate: + spec: + container: + image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + env: + - name: STEP + value: "2" +--- +apiVersion: serving.knative.dev/v1alpha1 +kind: Service +metadata: + name: fourth +spec: + runLatest: + configuration: + revisionTemplate: + spec: + container: + image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + env: + - name: STEP + value: "3" + +--- +apiVersion: serving.knative.dev/v1alpha1 +kind: Service +metadata: + name: fifth +spec: + runLatest: + configuration: + revisionTemplate: + spec: + container: + image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + env: + - name: STEP + value: "4" +--- +apiVersion: serving.knative.dev/v1alpha1 +kind: Service +metadata: + name: sixth +spec: + runLatest: + configuration: + revisionTemplate: + spec: + container: + image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + env: + - name: STEP + value: "5" +--- +``` + + +```shell +kubectl -n newbroker create -f ./steps.yaml +``` + +### Create the first Sequence + +Here, if you are using different type of Channel, you need to change the +spec.channelTemplate to point to your desired Channel. Also, change the +spec.reply.name to point to your `Broker` + +```yaml +apiVersion: messaging.knative.dev/v1alpha1 +kind: Sequence +metadata: + name: first-sequence +spec: + channelTemplate: + apiVersion: messaging.knative.dev/v1alpha1 + kind: InMemoryChannel + steps: + - ref: + apiVersion: serving.knative.dev/v1alpha1 + kind: Service + name: first + - ref: + apiVersion: serving.knative.dev/v1alpha1 + kind: Service + name: second + - ref: + apiVersion: serving.knative.dev/v1alpha1 + kind: Service + name: third + reply: + kind: Sequence + apiVersion: messaging.knative.dev/v1alpha1 + name: second-sequence +``` + +Change `newbroker` below to create the `Sequence` in the Namespace where you have configured your +`Broker`. +```shell +kubectl -n newbroker create -f ./sequence1.yaml +``` + + +### Create the second Sequence + +Here, again if you are using different type of Channel, you need to change the +spec.channelTemplate to point to your desired Channel. Also, change the +spec.reply.name to point to your `Broker` + +```yaml +apiVersion: messaging.knative.dev/v1alpha1 +kind: Sequence +metadata: + name: second-sequence +spec: + channelTemplate: + apiVersion: messaging.knative.dev/v1alpha1 + kind: InMemoryChannel + steps: + - ref: + apiVersion: serving.knative.dev/v1alpha1 + kind: Service + name: fourth + - ref: + apiVersion: serving.knative.dev/v1alpha1 + kind: Service + name: fifth + - ref: + apiVersion: serving.knative.dev/v1alpha1 + kind: Service + name: sixth + reply: + kind: Service + apiVersion: serving.knative.dev/v1alpha1 + name: event-display +``` + + +### Create the Service displaying the events created by Sequence + +**NOTE** This does not work yet because the events created by the Sequence in the last step +are filtered. [TODO: Fix this](https://github.com/knative/eventing/issues/1421) + +```yaml +apiVersion: serving.knative.dev/v1alpha1 +kind: Service +metadata: + name: event-display +spec: + runLatest: + configuration: + revisionTemplate: + spec: + container: + image: gcr.io/knative-releases/github.com/knative/eventing-sources/cmd/event_display +``` + +Change `newbroker` below to create the `Sequence` in the Namespace where you have configured your +`Broker`. +```shell +kubectl -n newbroker create -f ./event-display.yaml +``` + +### Create the CronJobSource targeting the first Sequence + +```yaml +apiVersion: sources.eventing.knative.dev/v1alpha1 +kind: CronJobSource +metadata: + name: cronjob-source +spec: + schedule: "*/2 * * * *" + data: '{"message": "Hello world!"}' + sink: + apiVersion: messaging.knative.dev/v1alpha1 + kind: Sequence + name: first-sequence +``` + +Here, if you are using different type of Channel, you need to change the +spec.channelTemplate to point to your desired Channel. Also, change the +spec.reply.name to point to your `Broker` + +```shell +kubectl -n newbroker create -f ./cron-source.yaml +``` + +### Inspecting the results + +You can now see the final output by inspecting the logs of the event-display pods. +```shell +kubectl -n newbroker get pods +``` + +Then grab the pod name for the event-display (in my case: "event-display-hw7r6-deployment-5555cf68db-bx4m2") + + +```shell +vaikas@penguin:~/projects/go/src/github.com/knative/docs$ kubectl -n newbroker logs event-display-hw7r6-deployment-5555cf68db-bx4m2 user-container +☁️ cloudevents.Event +Validation: valid +Context Attributes, + cloudEventsVersion: 0.1 + eventType: samples.http.mod3 + source: /transformer/5 + eventID: 7628a147-ec74-43d5-a888-8384a1b6b005 + eventTime: 2019-06-18T13:57:20.279354375Z + contentType: application/json +Data, + { + "id": 0, + "message": "Hello world! - Handled by 0 - Handled by 1 - Handled by 2 - Handled by 3 - Handled by 4 - Handled by 5" + } +``` + +And you can see that the initial Cron Source message ("Hello World!") has been appended to it by each +of the steps in the Sequence. diff --git a/docs/eventing/samples/sequence/sequence-reply-to-sequence/cron-source.yaml b/docs/eventing/samples/sequence/sequence-reply-to-sequence/cron-source.yaml new file mode 100644 index 00000000000..945f794849f --- /dev/null +++ b/docs/eventing/samples/sequence/sequence-reply-to-sequence/cron-source.yaml @@ -0,0 +1,11 @@ +apiVersion: sources.eventing.knative.dev/v1alpha1 +kind: CronJobSource +metadata: + name: cronjob-source +spec: + schedule: "*/2 * * * *" + data: '{"message": "Hello world!"}' + sink: + apiVersion: messaging.knative.dev/v1alpha1 + kind: Sequence + name: first-sequence diff --git a/docs/eventing/samples/sequence/sequence-reply-to-sequence/event-display.yaml b/docs/eventing/samples/sequence/sequence-reply-to-sequence/event-display.yaml new file mode 100644 index 00000000000..e7207408408 --- /dev/null +++ b/docs/eventing/samples/sequence/sequence-reply-to-sequence/event-display.yaml @@ -0,0 +1,11 @@ +apiVersion: serving.knative.dev/v1alpha1 +kind: Service +metadata: + name: event-display +spec: + runLatest: + configuration: + revisionTemplate: + spec: + container: + image: gcr.io/knative-releases/github.com/knative/eventing-sources/cmd/event_display diff --git a/docs/eventing/samples/sequence/sequence-reply-to-sequence/sequence-reply-to-sequence.png b/docs/eventing/samples/sequence/sequence-reply-to-sequence/sequence-reply-to-sequence.png new file mode 100644 index 0000000000000000000000000000000000000000..fc50cfbe2d91f95d68a22fe6e7ef210edd1eac6b GIT binary patch literal 16955 zcmeIacT|&G_bwW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zY(@*#A;b}vFPEM=g$6y(a4*t#pK^^|FHoSN#>J@^<7=X35@It z1sK0x%c%0-i2`IsHcfQMC{~r*85U*UGAY=*ZL6(^nR0X3cR$K`5E{TC#W5)ykNMXN z`3uP#9KX9kX0-h{n4q>^josIWqF1BT^g1QZ0b;DsKP12>FwVLeaSPam2& zuJq0&;vxUgn5Y(jGWqNUy5wp-_Je{591>J4qmrQG(LvS_X$>6D18_%2`J-9DUQ(7{ zWIs06h#=WPEQtAHNAm$@YG^6NFcTdwP3tk}WEA_WVl)VDf!T=fXV1c#*(j0j z0?U6T-kG8zWx3nl$TL?$WFJ5bKU6B1{La|`Y-<_6xWFW>dUinD%Bj>uEynBp{CylG z+VJn3y&qWr(;UtJJ3;NgYV", for example the The only difference is that we'll use the `Subscriber.Spec.Reply` field to wire the output of the last Step to an event display pod. -### Chaining Sequences together +### [Chaining Sequences together](./samples/sequence/sequence-reply-to-sequence/README.md) For the next example, we'll use the same 3 Step `Sequence` that is wired directly into the `CronJobSource`. Each of the steps simply tacks on "- Handled by ", for example the first Step in the @@ -67,7 +67,7 @@ The only difference is that we'll use the `Subscriber.Spec.Reply` field to wire last Step to another `Sequence` that does the smae message modifications as the first pipeline (with different steps however). -### Using Sequence with Broker/Trigger model +### [Using Sequence with Broker/Trigger model](./samples/sequence/sequence-with-broker-trigger/README.md) You can also create a Trigger which targets `Sequence`. This time we'll wire `CronJobSource` to send events to a `Broker` and then we'll have the `Sequence` emit the resulting Events back into the Broker From 298db19fd9d14d7f638ee302dbcc4bf17b35059c Mon Sep 17 00:00:00 2001 From: Ville Aikas Date: Tue, 18 Jun 2019 17:23:17 +0300 Subject: [PATCH 03/12] sequence wired to event display --- .../sequence-reply-to-event-display/README.md | 238 ++++++++++++++++++ .../cron-source.yaml | 11 + .../event-display.yaml | 11 + .../sequence-reply-to-event-display.png | Bin 0 -> 12218 bytes .../sequence.yaml | 25 ++ .../steps.yaml | 46 ++++ .../sequence-reply-to-sequence/README.md | 28 +-- docs/eventing/sequence.md | 2 +- 8 files changed, 343 insertions(+), 18 deletions(-) create mode 100644 docs/eventing/samples/sequence/sequence-reply-to-event-display/README.md create mode 100644 docs/eventing/samples/sequence/sequence-reply-to-event-display/cron-source.yaml create mode 100644 docs/eventing/samples/sequence/sequence-reply-to-event-display/event-display.yaml create mode 100644 docs/eventing/samples/sequence/sequence-reply-to-event-display/sequence-reply-to-event-display.png create mode 100644 docs/eventing/samples/sequence/sequence-reply-to-event-display/sequence.yaml create mode 100644 docs/eventing/samples/sequence/sequence-reply-to-event-display/steps.yaml diff --git a/docs/eventing/samples/sequence/sequence-reply-to-event-display/README.md b/docs/eventing/samples/sequence/sequence-reply-to-event-display/README.md new file mode 100644 index 00000000000..30bee3a1fd4 --- /dev/null +++ b/docs/eventing/samples/sequence/sequence-reply-to-event-display/README.md @@ -0,0 +1,238 @@ +--- +title: "Sequence Wired to another Sequence" +weight: 20 +type: "docs" +--- + +# Using Sequences in series + +## Prerequisites + +For this example, we'll assume you have set up an `InMemoryChannel` +as well as Knative Serving (for our functions). The examples use `newbroker` +namespace, again, if you want to deploy to another Namespace, you will need +to modify the examples to reflect this. +If you want to use different type of `Channel`, you will have to modify the +`Sequence.Spec.ChannelTemplate` to create the appropriate Channel resources. + +## Overview + +We are going to create the following logical configuration. We create a CronJobSource, +feeding events to a `Sequence`, then taking the output of that `Sequence` and +displaying the resulting output. + +![Logical Configuration](./sequence-reply-to-event-display.png) + + +## Setup + +### Create the Knative Services + +Change `newbroker` below to create the steps in the Namespace where you want resources +created. + +```yaml +apiVersion: serving.knative.dev/v1alpha1 +kind: Service +metadata: + name: first +spec: + runLatest: + configuration: + revisionTemplate: + spec: + container: + image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + env: + - name: STEP + value: "0" + +--- +apiVersion: serving.knative.dev/v1alpha1 +kind: Service +metadata: + name: second +spec: + runLatest: + configuration: + revisionTemplate: + spec: + container: + image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + env: + - name: STEP + value: "1" +--- +apiVersion: serving.knative.dev/v1alpha1 +kind: Service +metadata: + name: third +spec: + runLatest: + configuration: + revisionTemplate: + spec: + container: + image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + env: + - name: STEP + value: "2" +--- +``` + + +```shell +kubectl -n newbroker create -f ./steps.yaml +``` + +### Create the first Sequence + +Here, if you are using different type of Channel, you need to change the +spec.channelTemplate to point to your desired Channel. Also, change the +spec.reply.name to point to your `Broker` + +```yaml +apiVersion: messaging.knative.dev/v1alpha1 +kind: Sequence +metadata: + name: first-sequence +spec: + channelTemplate: + apiVersion: messaging.knative.dev/v1alpha1 + kind: InMemoryChannel + steps: + - ref: + apiVersion: serving.knative.dev/v1alpha1 + kind: Service + name: first + - ref: + apiVersion: serving.knative.dev/v1alpha1 + kind: Service + name: second + - ref: + apiVersion: serving.knative.dev/v1alpha1 + kind: Service + name: third + reply: + kind: Sequence + apiVersion: messaging.knative.dev/v1alpha1 + name: second-sequence +``` + +Change `newbroker` below to create the `Sequence` in the Namespace where you have configured your +`Broker`. +```shell +kubectl -n newbroker create -f ./sequence1.yaml +``` + + +### Create the second Sequence + +Here, again if you are using different type of Channel, you need to change the +spec.channelTemplate to point to your desired Channel. Also, change the +spec.reply.name to point to your `Broker` + +```yaml +apiVersion: messaging.knative.dev/v1alpha1 +kind: Sequence +metadata: + name: second-sequence +spec: + channelTemplate: + apiVersion: messaging.knative.dev/v1alpha1 + kind: InMemoryChannel + steps: + - ref: + apiVersion: serving.knative.dev/v1alpha1 + kind: Service + name: fourth + - ref: + apiVersion: serving.knative.dev/v1alpha1 + kind: Service + name: fifth + - ref: + apiVersion: serving.knative.dev/v1alpha1 + kind: Service + name: sixth + reply: + kind: Service + apiVersion: serving.knative.dev/v1alpha1 + name: event-display +``` + + +### Create the Service displaying the events created by Sequence + +```yaml +apiVersion: serving.knative.dev/v1alpha1 +kind: Service +metadata: + name: event-display +spec: + runLatest: + configuration: + revisionTemplate: + spec: + container: + image: gcr.io/knative-releases/github.com/knative/eventing-sources/cmd/event_display +``` + +Change `newbroker` below to create the `Sequence` in the Namespace where you want your resources +to be created. +```shell +kubectl -n newbroker create -f ./event-display.yaml +``` + +### Create the CronJobSource targeting the first Sequence + +```yaml +apiVersion: sources.eventing.knative.dev/v1alpha1 +kind: CronJobSource +metadata: + name: cronjob-source +spec: + schedule: "*/2 * * * *" + data: '{"message": "Hello world!"}' + sink: + apiVersion: messaging.knative.dev/v1alpha1 + kind: Sequence + name: first-sequence +``` + +Here, if you are using different type of Channel, you need to change the +spec.channelTemplate to point to your desired Channel. + +```shell +kubectl -n newbroker create -f ./cron-source.yaml +``` + +### Inspecting the results + +You can now see the final output by inspecting the logs of the event-display pods. +```shell +kubectl -n newbroker get pods +``` + +Then grab the pod name for the event-display (in my case: "event-display-sldk5-deployment-79b69bb4c9-djwj4") + + +```shell +vaikas@penguin:~/projects/go/src/github.com/knative/docs$ kubectl -n newbroker3 logs event-display-sldk5-deployment-79b69bb4c9-djwj4 user-container +☁️ cloudevents.Event +Validation: valid +Context Attributes, + cloudEventsVersion: 0.1 + eventType: samples.http.mod3 + source: /transformer/2 + eventID: df52b47e-02fd-45b2-8180-dabb572573f5 + eventTime: 2019-06-18T14:18:42.478140635Z + contentType: application/json +Data, + { + "id": 0, + "message": "Hello world! - Handled by 0 - Handled by 1 - Handled by 2" + } +``` + +And you can see that the initial Cron Source message ("Hello World!") has been appended to it by each +of the steps in the Sequence. diff --git a/docs/eventing/samples/sequence/sequence-reply-to-event-display/cron-source.yaml b/docs/eventing/samples/sequence/sequence-reply-to-event-display/cron-source.yaml new file mode 100644 index 00000000000..3b2d39aad2f --- /dev/null +++ b/docs/eventing/samples/sequence/sequence-reply-to-event-display/cron-source.yaml @@ -0,0 +1,11 @@ +apiVersion: sources.eventing.knative.dev/v1alpha1 +kind: CronJobSource +metadata: + name: cronjob-source +spec: + schedule: "*/2 * * * *" + data: '{"message": "Hello world!"}' + sink: + apiVersion: messaging.knative.dev/v1alpha1 + kind: Sequence + name: sequence diff --git a/docs/eventing/samples/sequence/sequence-reply-to-event-display/event-display.yaml b/docs/eventing/samples/sequence/sequence-reply-to-event-display/event-display.yaml new file mode 100644 index 00000000000..e7207408408 --- /dev/null +++ b/docs/eventing/samples/sequence/sequence-reply-to-event-display/event-display.yaml @@ -0,0 +1,11 @@ +apiVersion: serving.knative.dev/v1alpha1 +kind: Service +metadata: + name: event-display +spec: + runLatest: + configuration: + revisionTemplate: + spec: + container: + image: gcr.io/knative-releases/github.com/knative/eventing-sources/cmd/event_display diff --git a/docs/eventing/samples/sequence/sequence-reply-to-event-display/sequence-reply-to-event-display.png b/docs/eventing/samples/sequence/sequence-reply-to-event-display/sequence-reply-to-event-display.png new file mode 100644 index 0000000000000000000000000000000000000000..88e55b9b8525feb73abfa20b83cc1ee0be5ae2c0 GIT binary patch literal 12218 zcmeHt`Bziv(ry@RL=pPH=PaP@Kr53i0%8a_bc@KS%riCuGNTa!2?S8Ywp&C+K&H^B zh!P-7AxsGf3PK=Z3Nr~PA&?LP2}#I&gXf%Y-T&a;AA0|^*IsMy_kEwL+Ew*D_1M|b zX4j4bI{*N{F59cW-T(lUIsgF0!RcWWP4zs2^nYmL<4*I+Qyng-L<-VVG^|kyFcs=Mh zbD?vYPvyk0SytV(ljz&Eokre~A0O^MxqY{CDTD=K>sU0;sP^7^(LWAuuHy|f3E-E5lB_v(?B0{mo&HyxX%t%)JweOJ6<|b@6G)c>5ie#xer8< z`ZP243c2##NB#CGyXa2_ywZAtXn+Ae03c$y^Q|r z{EYRR8Ok!)oL|gtDJu&R#mJrW@cdaUHV?gx)Uu&TAx)gKhx#FPB6s#Qv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+yT2bXW2d@b44!ZiDFLfnreA?Tuk`6 z1m+{?&pAHlPHg^Q2~RQHr?=+sYo*to^&1r&U7bvLN4VLf@N*eMHHOE%^-Q64`>4YNaI9uFAi8L7zx;9YoMeHG~K2(P~L2@%XWfyiFlhbNrxY+d;&XuEX~tQ``ZpWyUQ=yNBvheAoHoXkRZ5)d zEHVOPY?QW1W*4(3WJPkkIv)@|-CZ{a3hK za>>Rq`9Mh%$}-+(8cfR?2B>Y#f`qH6%&F-)#)N0=qPSg(>0BtL;-CP3@B0x>-vl>@ zcVZ3$JQNz}y}e*$X|L1El<7woj89RH(*7lPE) zc34L>xyncI4g<3O0u=d=3aIgyZkm21{WP{(dC>|znK6Zc*tshKq6oEKzjt0Z4O z)|8nRHc}FK&L*m#l>S&N<@65slAQ-H6IbL%1Na@8=YQ<(J~Af1|L6J#fqxMA2Z4VO l_y>W15cq$Jz`aK@jV$-l+BCzRom(5R{mt>$>Pvz5{}1|C97_NI literal 0 HcmV?d00001 diff --git a/docs/eventing/samples/sequence/sequence-reply-to-event-display/sequence.yaml b/docs/eventing/samples/sequence/sequence-reply-to-event-display/sequence.yaml new file mode 100644 index 00000000000..b8b13077864 --- /dev/null +++ b/docs/eventing/samples/sequence/sequence-reply-to-event-display/sequence.yaml @@ -0,0 +1,25 @@ +apiVersion: messaging.knative.dev/v1alpha1 +kind: Sequence +metadata: + name: sequence +spec: + channelTemplate: + apiVersion: messaging.knative.dev/v1alpha1 + kind: InMemoryChannel + steps: + - ref: + apiVersion: serving.knative.dev/v1alpha1 + kind: Service + name: first + - ref: + apiVersion: serving.knative.dev/v1alpha1 + kind: Service + name: second + - ref: + apiVersion: serving.knative.dev/v1alpha1 + kind: Service + name: third + reply: + kind: Service + apiVersion: serving.knative.dev/v1alpha1 + name: event-display diff --git a/docs/eventing/samples/sequence/sequence-reply-to-event-display/steps.yaml b/docs/eventing/samples/sequence/sequence-reply-to-event-display/steps.yaml new file mode 100644 index 00000000000..4bd0ebc6735 --- /dev/null +++ b/docs/eventing/samples/sequence/sequence-reply-to-event-display/steps.yaml @@ -0,0 +1,46 @@ +apiVersion: serving.knative.dev/v1alpha1 +kind: Service +metadata: + name: first +spec: + runLatest: + configuration: + revisionTemplate: + spec: + container: + image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + env: + - name: STEP + value: "0" + +--- +apiVersion: serving.knative.dev/v1alpha1 +kind: Service +metadata: + name: second +spec: + runLatest: + configuration: + revisionTemplate: + spec: + container: + image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + env: + - name: STEP + value: "1" +--- +apiVersion: serving.knative.dev/v1alpha1 +kind: Service +metadata: + name: third +spec: + runLatest: + configuration: + revisionTemplate: + spec: + container: + image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + env: + - name: STEP + value: "2" +--- diff --git a/docs/eventing/samples/sequence/sequence-reply-to-sequence/README.md b/docs/eventing/samples/sequence/sequence-reply-to-sequence/README.md index 08ec7edb535..37297bea038 100644 --- a/docs/eventing/samples/sequence/sequence-reply-to-sequence/README.md +++ b/docs/eventing/samples/sequence/sequence-reply-to-sequence/README.md @@ -8,9 +8,9 @@ type: "docs" ## Prerequisites -For this example, we'll assume you have set up a `Broker` and an `InMemoryChannel` +For this example, we'll assume you have set up a an `InMemoryChannel` as well as Knative Serving (for our functions). The examples use `newbroker` -namespace, again, if your broker lives in another Namespace, you will need to +namespace, again, if you want to deploy to another Namespace, you will need to modify the examples to reflect this. If you want to use different type of `Channel`, you will have to modify the `Sequence.Spec.ChannelTemplate` to create the appropriate Channel resources. @@ -28,8 +28,8 @@ it to a second `Sequence` and finally displaying the resulting output. ### Create the Knative Services -Change `newbroker` below to create the steps in the Namespace where you have configured your -`Broker` +Change `newbroker` below to create the steps in the Namespace where you want resources +created. ```yaml apiVersion: serving.knative.dev/v1alpha1 @@ -134,8 +134,7 @@ kubectl -n newbroker create -f ./steps.yaml ### Create the first Sequence Here, if you are using different type of Channel, you need to change the -spec.channelTemplate to point to your desired Channel. Also, change the -spec.reply.name to point to your `Broker` +spec.channelTemplate to point to your desired Channel. ```yaml apiVersion: messaging.knative.dev/v1alpha1 @@ -165,8 +164,8 @@ spec: name: second-sequence ``` -Change `newbroker` below to create the `Sequence` in the Namespace where you have configured your -`Broker`. +Change `newbroker` below to create the `Sequence` in the Namespace where you want +your resources created. ```shell kubectl -n newbroker create -f ./sequence1.yaml ``` @@ -175,8 +174,7 @@ kubectl -n newbroker create -f ./sequence1.yaml ### Create the second Sequence Here, again if you are using different type of Channel, you need to change the -spec.channelTemplate to point to your desired Channel. Also, change the -spec.reply.name to point to your `Broker` +spec.channelTemplate to point to your desired Channel. ```yaml apiVersion: messaging.knative.dev/v1alpha1 @@ -209,9 +207,6 @@ spec: ### Create the Service displaying the events created by Sequence -**NOTE** This does not work yet because the events created by the Sequence in the last step -are filtered. [TODO: Fix this](https://github.com/knative/eventing/issues/1421) - ```yaml apiVersion: serving.knative.dev/v1alpha1 kind: Service @@ -226,8 +221,8 @@ spec: image: gcr.io/knative-releases/github.com/knative/eventing-sources/cmd/event_display ``` -Change `newbroker` below to create the `Sequence` in the Namespace where you have configured your -`Broker`. +Change `newbroker` below to create the `Sequence` in the Namespace where you want your resources +created. ```shell kubectl -n newbroker create -f ./event-display.yaml ``` @@ -249,8 +244,7 @@ spec: ``` Here, if you are using different type of Channel, you need to change the -spec.channelTemplate to point to your desired Channel. Also, change the -spec.reply.name to point to your `Broker` +spec.channelTemplate to point to your desired Channel. ```shell kubectl -n newbroker create -f ./cron-source.yaml diff --git a/docs/eventing/sequence.md b/docs/eventing/sequence.md index 20d8c1dfa21..ed424151df8 100644 --- a/docs/eventing/sequence.md +++ b/docs/eventing/sequence.md @@ -50,7 +50,7 @@ For the first example, we'll use a 3 Step `Sequence` that is wired directly into Each of the steps simply tacks on "- Handled by ", for example the first Step in the `Sequence` will take the incoming message and append "- Handled by 0" to the incoming message. -### Sequence with reply (last Step produces output) +### [Sequence with reply (last Step produces output)](./samples/sequence/sequence-reply-to-event-display/README.md) For the next example, we'll use the same 3 Step `Sequence` that is wired directly into the `CronJobSource`. Each of the steps simply tacks on "- Handled by ", for example the first Step in the From 6702e4040746c2e5dd5aab02087e84eca227a51e Mon Sep 17 00:00:00 2001 From: Ville Aikas Date: Tue, 18 Jun 2019 17:43:59 +0300 Subject: [PATCH 04/12] terminal sequence --- .../sequence-reply-to-event-display/README.md | 60 +--- .../sequence/sequence-terminal/README.md | 257 ++++++++++++++++++ .../sequence-terminal/cron-source.yaml | 11 + .../sequence-terminal/sequence-terminal.png | Bin 0 -> 10308 bytes .../sequence/sequence-terminal/sequence.yaml | 21 ++ .../sequence/sequence-terminal/steps.yaml | 46 ++++ docs/eventing/sequence.md | 2 +- 7 files changed, 348 insertions(+), 49 deletions(-) create mode 100644 docs/eventing/samples/sequence/sequence-terminal/README.md create mode 100644 docs/eventing/samples/sequence/sequence-terminal/cron-source.yaml create mode 100644 docs/eventing/samples/sequence/sequence-terminal/sequence-terminal.png create mode 100644 docs/eventing/samples/sequence/sequence-terminal/sequence.yaml create mode 100644 docs/eventing/samples/sequence/sequence-terminal/steps.yaml diff --git a/docs/eventing/samples/sequence/sequence-reply-to-event-display/README.md b/docs/eventing/samples/sequence/sequence-reply-to-event-display/README.md index 30bee3a1fd4..c82354f55ce 100644 --- a/docs/eventing/samples/sequence/sequence-reply-to-event-display/README.md +++ b/docs/eventing/samples/sequence/sequence-reply-to-event-display/README.md @@ -1,5 +1,5 @@ --- -title: "Sequence Wired to another Sequence" +title: "Sequence Wired to event-display" weight: 20 type: "docs" --- @@ -85,17 +85,16 @@ spec: kubectl -n newbroker create -f ./steps.yaml ``` -### Create the first Sequence +### Create the Sequence Here, if you are using different type of Channel, you need to change the -spec.channelTemplate to point to your desired Channel. Also, change the -spec.reply.name to point to your `Broker` +spec.channelTemplate to point to your desired Channel. ```yaml apiVersion: messaging.knative.dev/v1alpha1 kind: Sequence metadata: - name: first-sequence + name: sequence spec: channelTemplate: apiVersion: messaging.knative.dev/v1alpha1 @@ -113,53 +112,18 @@ spec: apiVersion: serving.knative.dev/v1alpha1 kind: Service name: third - reply: - kind: Sequence - apiVersion: messaging.knative.dev/v1alpha1 - name: second-sequence -``` - -Change `newbroker` below to create the `Sequence` in the Namespace where you have configured your -`Broker`. -```shell -kubectl -n newbroker create -f ./sequence1.yaml -``` - - -### Create the second Sequence - -Here, again if you are using different type of Channel, you need to change the -spec.channelTemplate to point to your desired Channel. Also, change the -spec.reply.name to point to your `Broker` - -```yaml -apiVersion: messaging.knative.dev/v1alpha1 -kind: Sequence -metadata: - name: second-sequence -spec: - channelTemplate: - apiVersion: messaging.knative.dev/v1alpha1 - kind: InMemoryChannel - steps: - - ref: - apiVersion: serving.knative.dev/v1alpha1 - kind: Service - name: fourth - - ref: - apiVersion: serving.knative.dev/v1alpha1 - kind: Service - name: fifth - - ref: - apiVersion: serving.knative.dev/v1alpha1 - kind: Service - name: sixth reply: kind: Service apiVersion: serving.knative.dev/v1alpha1 name: event-display ``` +Change `newbroker` below to create the `Sequence` in the Namespace where you want the +resources to be created. +```shell +kubectl -n newbroker create -f ./sequence.yaml +``` + ### Create the Service displaying the events created by Sequence @@ -183,7 +147,7 @@ to be created. kubectl -n newbroker create -f ./event-display.yaml ``` -### Create the CronJobSource targeting the first Sequence +### Create the CronJobSource targeting the Sequence ```yaml apiVersion: sources.eventing.knative.dev/v1alpha1 @@ -196,7 +160,7 @@ spec: sink: apiVersion: messaging.knative.dev/v1alpha1 kind: Sequence - name: first-sequence + name: sequence ``` Here, if you are using different type of Channel, you need to change the diff --git a/docs/eventing/samples/sequence/sequence-terminal/README.md b/docs/eventing/samples/sequence/sequence-terminal/README.md new file mode 100644 index 00000000000..b324fada79e --- /dev/null +++ b/docs/eventing/samples/sequence/sequence-terminal/README.md @@ -0,0 +1,257 @@ +title: "Sequence terminal" +weight: 20 +type: "docs" +--- + +# Using Sequences in series + +## Prerequisites + +For this example, we'll assume you have set up an `InMemoryChannel` +as well as Knative Serving (for our functions). The examples use `newbroker` +namespace, again, if you want to deploy to another Namespace, you will need +to modify the examples to reflect this. +If you want to use different type of `Channel`, you will have to modify the +`Sequence.Spec.ChannelTemplate` to create the appropriate Channel resources. + +## Overview + +We are going to create the following logical configuration. We create a CronJobSource, +feeding events to a `Sequence`. Sequence can then do either external work, or +out of band create additional events. + +![Logical Configuration](./sequence-terminal.png) + + +## Setup + +### Create the Knative Services + +Change `newbroker` below to create the steps in the Namespace where you want resources +created. + +```yaml +apiVersion: serving.knative.dev/v1alpha1 +kind: Service +metadata: + name: first +spec: + runLatest: + configuration: + revisionTemplate: + spec: + container: + image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + env: + - name: STEP + value: "0" + +--- +apiVersion: serving.knative.dev/v1alpha1 +kind: Service +metadata: + name: second +spec: + runLatest: + configuration: + revisionTemplate: + spec: + container: + image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + env: + - name: STEP + value: "1" +--- +apiVersion: serving.knative.dev/v1alpha1 +kind: Service +metadata: + name: third +spec: + runLatest: + configuration: + revisionTemplate: + spec: + container: + image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + env: + - name: STEP + value: "2" +--- +``` + + +```shell +kubectl -n newbroker create -f ./steps.yaml +``` + +### Create the Sequence + +Here, if you are using different type of Channel, you need to change the +spec.channelTemplate to point to your desired Channel. + +```yaml +apiVersion: messaging.knative.dev/v1alpha1 +kind: Sequence +metadata: + name: sequence +spec: + channelTemplate: + apiVersion: messaging.knative.dev/v1alpha1 + kind: InMemoryChannel + steps: + - ref: + apiVersion: serving.knative.dev/v1alpha1 + kind: Service + name: first + - ref: + apiVersion: serving.knative.dev/v1alpha1 + kind: Service + name: second + - ref: + apiVersion: serving.knative.dev/v1alpha1 + kind: Service + name: third +``` + +Change `newbroker` below to create the `Sequence` in the Namespace where you want the +resources to be created. +```shell +kubectl -n newbroker create -f ./sequence.yaml +``` + + +### Create the CronJobSource targeting the Sequence + +```yaml +apiVersion: sources.eventing.knative.dev/v1alpha1 +kind: CronJobSource +metadata: + name: cronjob-source +spec: + schedule: "*/2 * * * *" + data: '{"message": "Hello world!"}' + sink: + apiVersion: messaging.knative.dev/v1alpha1 + kind: Sequence + name: sequence +``` + +Here, if you are using different type of Channel, you need to change the +spec.channelTemplate to point to your desired Channel. + +```shell +kubectl -n newbroker create -f ./cron-source.yaml +``` + +### Inspecting the results + +You can now see the final output by inspecting the logs of the event-display pods. +```shell +kubectl -n newbroker get pods +``` + +Then grab the pod name for the first step in the `Sequence` (in my case: "first-bx2w9-deployment-599866bc88-rfqvz") + + +```shell +vaikas@penguin:~/projects/go/src/github.com/knative/docs$ kubectl -n newbroker4 logs first-bx2w9-deployment-599866bc88-rfqvz user-container +Got Event Context: Context Attributes, + specversion: 0.2 + type: dev.knative.cronjob.event + source: /apis/v1/namespaces/newbroker4/cronjobsources/cronjob-source + id: 2fdf69ec-0480-463a-92fb-8d1259550f32 + time: 2019-06-18T14:38:00.000379084Z + contenttype: application/json +Extensions, + knativehistory: sequence-kn-sequence-0-kn-channel.newbroker4.svc.cluster.local +2019/06/18 14:38:14 http: superfluous response.WriteHeader call from github.com/vaikas-google/transformer/vendor/github.com/cloudevents/sdk-go/pkg/cloudevents/transport/http.(*Transport).ServeHTTP (transport.go:446) + +Got Data: &{Sequence:0 Message:Hello world!} +Got Transport Context: Transport Context, + URI: / + Host: first.newbroker4.svc.cluster.local + Method: POST + Header: + X-Request-Id: 9b51bcaa-10bc-97a5-a288-dde9b97f6e1e + Content-Length: 26 + K-Proxy-Request: activator + X-Forwarded-For: 10.16.3.77, 127.0.0.1, 127.0.0.1 + X-Forwarded-Proto: http + Ce-Knativehistory: sequence-kn-sequence-0-kn-channel.newbroker4.svc.cluster.local + X-B3-Spanid: 42bcd58bd1ea8191 + X-B3-Parentspanid: c63efd989dcf5dc5 + X-B3-Sampled: 0 + X-B3-Traceid: 4a1da6622ecbbdea0c75ae32e065cfcb + +---------------------------- +``` + + +Then we can look at the output of the second Step in the `Sequence`: +```shell +vaikas@penguin:~/projects/go/src/github.com/knative/docs$ kubectl -n newbroker4 logs second-w9vbk-deployment-68b946f49b-2rv95 user-container +Got Event Context: Context Attributes, + cloudEventsVersion: 0.1 + eventType: samples.http.mod3 + source: /transformer/0 + eventID: 5a9ec173-5224-41a2-9c83-50786651bcd5 + eventTime: 2019-06-18T14:38:14.657008072Z + contentType: application/json + +Got Data: &{Sequence:0 Message:Hello world! - Handled by 0} +Got Transport Context: Transport Context, + URI: / + Host: second.newbroker4.svc.cluster.local + Method: POST + Header: + X-Forwarded-For: 10.16.3.77, 127.0.0.1, 127.0.0.1 + X-Forwarded-Proto: http + Content-Length: 48 + X-B3-Sampled: 0 + Ce-Knativehistory: sequence-kn-sequence-1-kn-channel.newbroker4.svc.cluster.local + X-B3-Parentspanid: 4fba491a605b2391 + K-Proxy-Request: activator + X-B3-Spanid: 56e4150c4e1d679b + X-B3-Traceid: fb468aa8ec035a66153ce3f4929aa2fe + X-Request-Id: d60e7109-3853-9ca1-83e2-c70f8cbfbb93 + +---------------------------- +``` + +And you can see that the initial Cron Source message ("Hello World!") has now been modified by the +first step in the Sequence to include " - Handled by 0". Exciting :) + +Then we can look at the output of the last Step in the `Sequence`: + +```shell +vaikas@penguin:~/projects/go/src/github.com/knative/docs$ kubectl -n newbroker4 logs third-wxt9q-deployment-7f6d4b9d89-56cqc user-container +Got Event Context: Context Attributes, + cloudEventsVersion: 0.1 + eventType: samples.http.mod3 + source: /transformer/1 + eventID: 5747fb77-66a2-4e78-944b-43192aa879fb + eventTime: 2019-06-18T14:38:32.688345694Z + contentType: application/json + +Got Data: &{Sequence:0 Message:Hello world! - Handled by 0 - Handled by 1} +Got Transport Context: Transport Context, + URI: / + Host: third.newbroker4.svc.cluster.local + Method: POST + Header: + X-B3-Sampled: 0 + X-B3-Traceid: 64a9c48c219375476ffcdd5eb14ec6e0 + X-Forwarded-For: 10.16.3.77, 127.0.0.1, 127.0.0.1 + X-Forwarded-Proto: http + Ce-Knativehistory: sequence-kn-sequence-2-kn-channel.newbroker4.svc.cluster.local + K-Proxy-Request: activator + X-Request-Id: 505ff620-2822-9e7d-8855-53d02a2e36e2 + Content-Length: 63 + X-B3-Parentspanid: 9e822f378ead293c + X-B3-Spanid: a56ee81909c767e6 + +---------------------------- +``` + +And as expected it's now been handled by both the first and second Step as reflected by +the Message being now: "Hello world! - Handled by 0 - Handled by 1" diff --git a/docs/eventing/samples/sequence/sequence-terminal/cron-source.yaml b/docs/eventing/samples/sequence/sequence-terminal/cron-source.yaml new file mode 100644 index 00000000000..3b2d39aad2f --- /dev/null +++ b/docs/eventing/samples/sequence/sequence-terminal/cron-source.yaml @@ -0,0 +1,11 @@ +apiVersion: sources.eventing.knative.dev/v1alpha1 +kind: CronJobSource +metadata: + name: cronjob-source +spec: + schedule: "*/2 * * * *" + data: '{"message": "Hello world!"}' + sink: + apiVersion: messaging.knative.dev/v1alpha1 + kind: Sequence + name: sequence diff --git a/docs/eventing/samples/sequence/sequence-terminal/sequence-terminal.png b/docs/eventing/samples/sequence/sequence-terminal/sequence-terminal.png new file mode 100644 index 0000000000000000000000000000000000000000..5cb9d52649a691abd261e6dcbc93f411b978d869 GIT binary patch literal 10308 zcmeHt=UY?h7i~Zp5JnkBDbg~^C`w0%-W&_4G!+F&2vHbn=qKErBgdD?k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%|{ws?{}xBee0JT~q9`&seVBY^y=X4ubF8i>2CGkW3f%hYm@zd+tjNAxSY703rN z-%S)&Zz8;kIpta-JFOXx)G;il>zf(8oCCHIiiAX`ZNZ%lCeooV3}XneGV@i+v--ej zMtJpRipnEs=0a5n`6Z+2FTA};p>(v%_;4he_@r%yYHPYtDJm03OO%}C;p5{vbW0ba z4t~$lfeC!Bo2{$nbk@ZDJ;U}f{t(q=qvpa%U_C+b(IT$*&EKeZy(Sedg}Vj^1*b-M zmGuiPv18MFM`z3#^U&cOLPMmjk-MDStyv!&2cS`iZ;-F@ja&6ABiOXfvt$yw3xf8p&u0?!UCmiOR$ zFutdO&EbCpj0N?+`?e_Huv54JN_fvc32Ji~xqn(cK7yPXz@IK1VsqQ0KbPjUOE`&6 zHO96Z&8Ab>_atuxq+kXN;x;k;{_qOTTfhma>}Ek(?J{<>@0ZDLxOWvu(kFE&dFp~z@7aNfFNRa$^PAP2 zt}EwaN$*T5$hts7gm9dF4ofb#8?l4yq0AfRHp-vAxKOW zC2JnOq1h$USA^xbyjFf8Lenu|Pi}uJc{{O^JHO*`>zHv2dG`x=n{#Bqef`DVw))A} zzPH4C+{MB6VRdgRJxX4BLtIx#ih{oi!VW1BO75hB$U}nTLS-d>_PSEQd6g>!0K7SN zaSQRb5}TqY2;{%(KLq|m;6DWZL*PFI{zKsZDFSKV`TM#K+=#lVUoZGc3IMor$?hWN I{GI#%2liZ0*#H0l literal 0 HcmV?d00001 diff --git a/docs/eventing/samples/sequence/sequence-terminal/sequence.yaml b/docs/eventing/samples/sequence/sequence-terminal/sequence.yaml new file mode 100644 index 00000000000..bbb384aa3a9 --- /dev/null +++ b/docs/eventing/samples/sequence/sequence-terminal/sequence.yaml @@ -0,0 +1,21 @@ +apiVersion: messaging.knative.dev/v1alpha1 +kind: Sequence +metadata: + name: sequence +spec: + channelTemplate: + apiVersion: messaging.knative.dev/v1alpha1 + kind: InMemoryChannel + steps: + - ref: + apiVersion: serving.knative.dev/v1alpha1 + kind: Service + name: first + - ref: + apiVersion: serving.knative.dev/v1alpha1 + kind: Service + name: second + - ref: + apiVersion: serving.knative.dev/v1alpha1 + kind: Service + name: third diff --git a/docs/eventing/samples/sequence/sequence-terminal/steps.yaml b/docs/eventing/samples/sequence/sequence-terminal/steps.yaml new file mode 100644 index 00000000000..4bd0ebc6735 --- /dev/null +++ b/docs/eventing/samples/sequence/sequence-terminal/steps.yaml @@ -0,0 +1,46 @@ +apiVersion: serving.knative.dev/v1alpha1 +kind: Service +metadata: + name: first +spec: + runLatest: + configuration: + revisionTemplate: + spec: + container: + image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + env: + - name: STEP + value: "0" + +--- +apiVersion: serving.knative.dev/v1alpha1 +kind: Service +metadata: + name: second +spec: + runLatest: + configuration: + revisionTemplate: + spec: + container: + image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + env: + - name: STEP + value: "1" +--- +apiVersion: serving.knative.dev/v1alpha1 +kind: Service +metadata: + name: third +spec: + runLatest: + configuration: + revisionTemplate: + spec: + container: + image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + env: + - name: STEP + value: "2" +--- diff --git a/docs/eventing/sequence.md b/docs/eventing/sequence.md index ed424151df8..3714aefb4e1 100644 --- a/docs/eventing/sequence.md +++ b/docs/eventing/sequence.md @@ -44,7 +44,7 @@ For each of these examples below, we'll use [`CronJobSource`](https://knative.dev/v0.4-docs/reference/eventing/eventing-sources-api/#CronJobSource) as the source of events. -### Sequence with no reply (terminal last Step) +### (Sequence with no reply (terminal last Step))[./samples/sequence/sequence-terminal/README.md) For the first example, we'll use a 3 Step `Sequence` that is wired directly into the `CronJobSource`. Each of the steps simply tacks on "- Handled by ", for example the first Step in the From c36d9811f19921464f9c1ec677411c83b4bad3d2 Mon Sep 17 00:00:00 2001 From: Ville Aikas Date: Tue, 18 Jun 2019 21:13:36 +0300 Subject: [PATCH 05/12] first two examples moved to new v1beta1 services + cascading changes --- .../sequence-reply-to-event-display/README.md | 94 ++++++++---------- .../event-display.yaml | 12 +-- .../sequence.yaml | 8 +- .../steps.yaml | 48 ++++----- .../sequence/sequence-terminal/README.md | 97 +++++++++---------- .../sequence/sequence-terminal/sequence.yaml | 6 +- .../sequence/sequence-terminal/steps.yaml | 54 +++++------ 7 files changed, 145 insertions(+), 174 deletions(-) diff --git a/docs/eventing/samples/sequence/sequence-reply-to-event-display/README.md b/docs/eventing/samples/sequence/sequence-reply-to-event-display/README.md index c82354f55ce..f9a55a2443a 100644 --- a/docs/eventing/samples/sequence/sequence-reply-to-event-display/README.md +++ b/docs/eventing/samples/sequence/sequence-reply-to-event-display/README.md @@ -9,7 +9,7 @@ type: "docs" ## Prerequisites For this example, we'll assume you have set up an `InMemoryChannel` -as well as Knative Serving (for our functions). The examples use `newbroker` +as well as Knative Serving (for our functions). The examples use `default` namespace, again, if you want to deploy to another Namespace, you will need to modify the examples to reflect this. If you want to use different type of `Channel`, you will have to modify the @@ -28,61 +28,55 @@ displaying the resulting output. ### Create the Knative Services -Change `newbroker` below to create the steps in the Namespace where you want resources +Change `default` below to create the steps in the Namespace where you want resources created. ```yaml -apiVersion: serving.knative.dev/v1alpha1 +apiVersion: serving.knative.dev/v1beta1 kind: Service metadata: name: first spec: - runLatest: - configuration: - revisionTemplate: - spec: - container: - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 - env: - - name: STEP - value: "0" + template: + spec: + containers: + image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + env: + - name: STEP + value: "0" --- -apiVersion: serving.knative.dev/v1alpha1 +apiVersion: serving.knative.dev/v1beta1 kind: Service metadata: name: second spec: - runLatest: - configuration: - revisionTemplate: - spec: - container: - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 - env: - - name: STEP - value: "1" + template: + spec: + containers: + image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + env: + - name: STEP + value: "1" --- -apiVersion: serving.knative.dev/v1alpha1 +apiVersion: serving.knative.dev/v1beta1 kind: Service metadata: name: third spec: - runLatest: - configuration: - revisionTemplate: - spec: - container: - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 - env: - - name: STEP - value: "2" + template: + spec: + containers: + - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + env: + - name: STEP + value: "2" --- ``` ```shell -kubectl -n newbroker create -f ./steps.yaml +kubectl -n default create -f ./steps.yaml ``` ### Create the Sequence @@ -101,50 +95,48 @@ spec: kind: InMemoryChannel steps: - ref: - apiVersion: serving.knative.dev/v1alpha1 + apiVersion: serving.knative.dev/v1beta1 kind: Service name: first - ref: - apiVersion: serving.knative.dev/v1alpha1 + apiVersion: serving.knative.dev/v1beta1 kind: Service name: second - ref: - apiVersion: serving.knative.dev/v1alpha1 + apiVersion: serving.knative.dev/v1beta1 kind: Service name: third reply: kind: Service - apiVersion: serving.knative.dev/v1alpha1 + apiVersion: serving.knative.dev/v1beta1 name: event-display ``` -Change `newbroker` below to create the `Sequence` in the Namespace where you want the +Change `default` below to create the `Sequence` in the Namespace where you want the resources to be created. ```shell -kubectl -n newbroker create -f ./sequence.yaml +kubectl -n default create -f ./sequence.yaml ``` ### Create the Service displaying the events created by Sequence ```yaml -apiVersion: serving.knative.dev/v1alpha1 +apiVersion: serving.knative.dev/v1beta1 kind: Service metadata: name: event-display spec: - runLatest: - configuration: - revisionTemplate: - spec: - container: - image: gcr.io/knative-releases/github.com/knative/eventing-sources/cmd/event_display + template: + spec: + containers: + - image: gcr.io/knative-releases/github.com/knative/eventing-sources/cmd/event_display ``` -Change `newbroker` below to create the `Sequence` in the Namespace where you want your resources +Change `default` below to create the `Sequence` in the Namespace where you want your resources to be created. ```shell -kubectl -n newbroker create -f ./event-display.yaml +kubectl -n default create -f ./event-display.yaml ``` ### Create the CronJobSource targeting the Sequence @@ -167,21 +159,21 @@ Here, if you are using different type of Channel, you need to change the spec.channelTemplate to point to your desired Channel. ```shell -kubectl -n newbroker create -f ./cron-source.yaml +kubectl -n default create -f ./cron-source.yaml ``` ### Inspecting the results You can now see the final output by inspecting the logs of the event-display pods. ```shell -kubectl -n newbroker get pods +kubectl -n default get pods ``` Then grab the pod name for the event-display (in my case: "event-display-sldk5-deployment-79b69bb4c9-djwj4") ```shell -vaikas@penguin:~/projects/go/src/github.com/knative/docs$ kubectl -n newbroker3 logs event-display-sldk5-deployment-79b69bb4c9-djwj4 user-container +vaikas@penguin:~/projects/go/src/github.com/knative/docs$ kubectl -n default logs event-display-sldk5-deployment-79b69bb4c9-djwj4 user-container ☁️ cloudevents.Event Validation: valid Context Attributes, diff --git a/docs/eventing/samples/sequence/sequence-reply-to-event-display/event-display.yaml b/docs/eventing/samples/sequence/sequence-reply-to-event-display/event-display.yaml index e7207408408..3bd671bdf82 100644 --- a/docs/eventing/samples/sequence/sequence-reply-to-event-display/event-display.yaml +++ b/docs/eventing/samples/sequence/sequence-reply-to-event-display/event-display.yaml @@ -1,11 +1,9 @@ -apiVersion: serving.knative.dev/v1alpha1 +apiVersion: serving.knative.dev/v1beta1 kind: Service metadata: name: event-display spec: - runLatest: - configuration: - revisionTemplate: - spec: - container: - image: gcr.io/knative-releases/github.com/knative/eventing-sources/cmd/event_display + template: + spec: + containers: + - image: gcr.io/knative-releases/github.com/knative/eventing-sources/cmd/event_display diff --git a/docs/eventing/samples/sequence/sequence-reply-to-event-display/sequence.yaml b/docs/eventing/samples/sequence/sequence-reply-to-event-display/sequence.yaml index b8b13077864..9cb97e8da19 100644 --- a/docs/eventing/samples/sequence/sequence-reply-to-event-display/sequence.yaml +++ b/docs/eventing/samples/sequence/sequence-reply-to-event-display/sequence.yaml @@ -8,18 +8,18 @@ spec: kind: InMemoryChannel steps: - ref: - apiVersion: serving.knative.dev/v1alpha1 + apiVersion: serving.knative.dev/v1beta1 kind: Service name: first - ref: - apiVersion: serving.knative.dev/v1alpha1 + apiVersion: serving.knative.dev/v1beta1 kind: Service name: second - ref: - apiVersion: serving.knative.dev/v1alpha1 + apiVersion: serving.knative.dev/v1beta1 kind: Service name: third reply: kind: Service - apiVersion: serving.knative.dev/v1alpha1 + apiVersion: serving.knative.dev/v1beta1 name: event-display diff --git a/docs/eventing/samples/sequence/sequence-reply-to-event-display/steps.yaml b/docs/eventing/samples/sequence/sequence-reply-to-event-display/steps.yaml index 4bd0ebc6735..e8f054d55d0 100644 --- a/docs/eventing/samples/sequence/sequence-reply-to-event-display/steps.yaml +++ b/docs/eventing/samples/sequence/sequence-reply-to-event-display/steps.yaml @@ -3,15 +3,13 @@ kind: Service metadata: name: first spec: - runLatest: - configuration: - revisionTemplate: - spec: - container: - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 - env: - - name: STEP - value: "0" + template: + spec: + containers: + - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + env: + - name: STEP + value: "0" --- apiVersion: serving.knative.dev/v1alpha1 @@ -19,28 +17,24 @@ kind: Service metadata: name: second spec: - runLatest: - configuration: - revisionTemplate: - spec: - container: - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 - env: - - name: STEP - value: "1" + template: + spec: + containers: + - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + env: + - name: STEP + value: "1" --- apiVersion: serving.knative.dev/v1alpha1 kind: Service metadata: name: third spec: - runLatest: - configuration: - revisionTemplate: - spec: - container: - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 - env: - - name: STEP - value: "2" + template: + spec: + containers: + - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + env: + - name: STEP + value: "2" --- diff --git a/docs/eventing/samples/sequence/sequence-terminal/README.md b/docs/eventing/samples/sequence/sequence-terminal/README.md index b324fada79e..def6b1e297e 100644 --- a/docs/eventing/samples/sequence/sequence-terminal/README.md +++ b/docs/eventing/samples/sequence/sequence-terminal/README.md @@ -8,7 +8,7 @@ type: "docs" ## Prerequisites For this example, we'll assume you have set up an `InMemoryChannel` -as well as Knative Serving (for our functions). The examples use `newbroker` +as well as Knative Serving (for our functions). The examples use `default` namespace, again, if you want to deploy to another Namespace, you will need to modify the examples to reflect this. If you want to use different type of `Channel`, you will have to modify the @@ -27,61 +27,54 @@ out of band create additional events. ### Create the Knative Services -Change `newbroker` below to create the steps in the Namespace where you want resources -created. +First create the 3 steps that will be referenced in the Steps. ```yaml -apiVersion: serving.knative.dev/v1alpha1 +apiVersion: serving.knative.dev/v1beta1 kind: Service metadata: name: first spec: - runLatest: - configuration: - revisionTemplate: - spec: - container: - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 - env: - - name: STEP - value: "0" + template: + spec: + containers: + - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + env: + - name: STEP + value: "0" --- -apiVersion: serving.knative.dev/v1alpha1 +apiVersion: serving.knative.dev/v1beta1 kind: Service metadata: name: second spec: - runLatest: - configuration: - revisionTemplate: - spec: - container: - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 - env: - - name: STEP - value: "1" + template: + spec: + containers: + - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + env: + - name: STEP + value: "1" --- -apiVersion: serving.knative.dev/v1alpha1 +apiVersion: serving.knative.dev/v1beta1 kind: Service metadata: name: third spec: - runLatest: - configuration: - revisionTemplate: - spec: - container: - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 - env: - - name: STEP - value: "2" + template: + spec: + containers: + - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + env: + - name: STEP + value: "2" --- ``` ```shell -kubectl -n newbroker create -f ./steps.yaml +kubectl -n default create -f ./steps.yaml ``` ### Create the Sequence @@ -100,23 +93,23 @@ spec: kind: InMemoryChannel steps: - ref: - apiVersion: serving.knative.dev/v1alpha1 + apiVersion: serving.knative.dev/v1beta1 kind: Service name: first - ref: - apiVersion: serving.knative.dev/v1alpha1 + apiVersion: serving.knative.dev/v1beta1 kind: Service name: second - ref: - apiVersion: serving.knative.dev/v1alpha1 + apiVersion: serving.knative.dev/v1beta1 kind: Service name: third ``` -Change `newbroker` below to create the `Sequence` in the Namespace where you want the +Change `default` below to create the `Sequence` in the Namespace where you want the resources to be created. ```shell -kubectl -n newbroker create -f ./sequence.yaml +kubectl -n default create -f ./sequence.yaml ``` @@ -140,36 +133,36 @@ Here, if you are using different type of Channel, you need to change the spec.channelTemplate to point to your desired Channel. ```shell -kubectl -n newbroker create -f ./cron-source.yaml +kubectl -n default create -f ./cron-source.yaml ``` ### Inspecting the results You can now see the final output by inspecting the logs of the event-display pods. ```shell -kubectl -n newbroker get pods +kubectl -n default get pods ``` Then grab the pod name for the first step in the `Sequence` (in my case: "first-bx2w9-deployment-599866bc88-rfqvz") ```shell -vaikas@penguin:~/projects/go/src/github.com/knative/docs$ kubectl -n newbroker4 logs first-bx2w9-deployment-599866bc88-rfqvz user-container +vaikas@penguin:~/projects/go/src/github.com/knative/docs$ kubectl -n default logs first-bx2w9-deployment-599866bc88-rfqvz user-container Got Event Context: Context Attributes, specversion: 0.2 type: dev.knative.cronjob.event - source: /apis/v1/namespaces/newbroker4/cronjobsources/cronjob-source + source: /apis/v1/namespaces/default/cronjobsources/cronjob-source id: 2fdf69ec-0480-463a-92fb-8d1259550f32 time: 2019-06-18T14:38:00.000379084Z contenttype: application/json Extensions, - knativehistory: sequence-kn-sequence-0-kn-channel.newbroker4.svc.cluster.local + knativehistory: sequence-kn-sequence-0-kn-channel.default.svc.cluster.local 2019/06/18 14:38:14 http: superfluous response.WriteHeader call from github.com/vaikas-google/transformer/vendor/github.com/cloudevents/sdk-go/pkg/cloudevents/transport/http.(*Transport).ServeHTTP (transport.go:446) Got Data: &{Sequence:0 Message:Hello world!} Got Transport Context: Transport Context, URI: / - Host: first.newbroker4.svc.cluster.local + Host: first.default.svc.cluster.local Method: POST Header: X-Request-Id: 9b51bcaa-10bc-97a5-a288-dde9b97f6e1e @@ -177,7 +170,7 @@ Got Transport Context: Transport Context, K-Proxy-Request: activator X-Forwarded-For: 10.16.3.77, 127.0.0.1, 127.0.0.1 X-Forwarded-Proto: http - Ce-Knativehistory: sequence-kn-sequence-0-kn-channel.newbroker4.svc.cluster.local + Ce-Knativehistory: sequence-kn-sequence-0-kn-channel.default.svc.cluster.local X-B3-Spanid: 42bcd58bd1ea8191 X-B3-Parentspanid: c63efd989dcf5dc5 X-B3-Sampled: 0 @@ -189,7 +182,7 @@ Got Transport Context: Transport Context, Then we can look at the output of the second Step in the `Sequence`: ```shell -vaikas@penguin:~/projects/go/src/github.com/knative/docs$ kubectl -n newbroker4 logs second-w9vbk-deployment-68b946f49b-2rv95 user-container +vaikas@penguin:~/projects/go/src/github.com/knative/docs$ kubectl -n default logs second-w9vbk-deployment-68b946f49b-2rv95 user-container Got Event Context: Context Attributes, cloudEventsVersion: 0.1 eventType: samples.http.mod3 @@ -201,14 +194,14 @@ Got Event Context: Context Attributes, Got Data: &{Sequence:0 Message:Hello world! - Handled by 0} Got Transport Context: Transport Context, URI: / - Host: second.newbroker4.svc.cluster.local + Host: second.default.svc.cluster.local Method: POST Header: X-Forwarded-For: 10.16.3.77, 127.0.0.1, 127.0.0.1 X-Forwarded-Proto: http Content-Length: 48 X-B3-Sampled: 0 - Ce-Knativehistory: sequence-kn-sequence-1-kn-channel.newbroker4.svc.cluster.local + Ce-Knativehistory: sequence-kn-sequence-1-kn-channel.default.svc.cluster.local X-B3-Parentspanid: 4fba491a605b2391 K-Proxy-Request: activator X-B3-Spanid: 56e4150c4e1d679b @@ -224,7 +217,7 @@ first step in the Sequence to include " - Handled by 0". Exciting :) Then we can look at the output of the last Step in the `Sequence`: ```shell -vaikas@penguin:~/projects/go/src/github.com/knative/docs$ kubectl -n newbroker4 logs third-wxt9q-deployment-7f6d4b9d89-56cqc user-container +vaikas@penguin:~/projects/go/src/github.com/knative/docs$ kubectl -n default logs third-wxt9q-deployment-7f6d4b9d89-56cqc user-container Got Event Context: Context Attributes, cloudEventsVersion: 0.1 eventType: samples.http.mod3 @@ -236,14 +229,14 @@ Got Event Context: Context Attributes, Got Data: &{Sequence:0 Message:Hello world! - Handled by 0 - Handled by 1} Got Transport Context: Transport Context, URI: / - Host: third.newbroker4.svc.cluster.local + Host: third.default.svc.cluster.local Method: POST Header: X-B3-Sampled: 0 X-B3-Traceid: 64a9c48c219375476ffcdd5eb14ec6e0 X-Forwarded-For: 10.16.3.77, 127.0.0.1, 127.0.0.1 X-Forwarded-Proto: http - Ce-Knativehistory: sequence-kn-sequence-2-kn-channel.newbroker4.svc.cluster.local + Ce-Knativehistory: sequence-kn-sequence-2-kn-channel.default.svc.cluster.local K-Proxy-Request: activator X-Request-Id: 505ff620-2822-9e7d-8855-53d02a2e36e2 Content-Length: 63 diff --git a/docs/eventing/samples/sequence/sequence-terminal/sequence.yaml b/docs/eventing/samples/sequence/sequence-terminal/sequence.yaml index bbb384aa3a9..8ba67673a4d 100644 --- a/docs/eventing/samples/sequence/sequence-terminal/sequence.yaml +++ b/docs/eventing/samples/sequence/sequence-terminal/sequence.yaml @@ -8,14 +8,14 @@ spec: kind: InMemoryChannel steps: - ref: - apiVersion: serving.knative.dev/v1alpha1 + apiVersion: serving.knative.dev/v1beta1 kind: Service name: first - ref: - apiVersion: serving.knative.dev/v1alpha1 + apiVersion: serving.knative.dev/v1beta1 kind: Service name: second - ref: - apiVersion: serving.knative.dev/v1alpha1 + apiVersion: serving.knative.dev/v1beta1 kind: Service name: third diff --git a/docs/eventing/samples/sequence/sequence-terminal/steps.yaml b/docs/eventing/samples/sequence/sequence-terminal/steps.yaml index 4bd0ebc6735..aa65d4e1561 100644 --- a/docs/eventing/samples/sequence/sequence-terminal/steps.yaml +++ b/docs/eventing/samples/sequence/sequence-terminal/steps.yaml @@ -1,46 +1,40 @@ -apiVersion: serving.knative.dev/v1alpha1 +apiVersion: serving.knative.dev/v1beta1 kind: Service metadata: name: first spec: - runLatest: - configuration: - revisionTemplate: - spec: - container: - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 - env: - - name: STEP - value: "0" + template: + spec: + containers: + - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + env: + - name: STEP + value: "0" --- -apiVersion: serving.knative.dev/v1alpha1 +apiVersion: serving.knative.dev/v1beta1 kind: Service metadata: name: second spec: - runLatest: - configuration: - revisionTemplate: - spec: - container: - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 - env: - - name: STEP - value: "1" + template: + spec: + containers: + - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + env: + - name: STEP + value: "1" --- -apiVersion: serving.knative.dev/v1alpha1 +apiVersion: serving.knative.dev/v1beta1 kind: Service metadata: name: third spec: - runLatest: - configuration: - revisionTemplate: - spec: - container: - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 - env: - - name: STEP - value: "2" + template: + spec: + containers: + - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + env: + - name: STEP + value: "2" --- From bb5c7c0f1e48d082ca9d382de011b2252ab1617a Mon Sep 17 00:00:00 2001 From: Ville Aikas Date: Tue, 18 Jun 2019 22:02:25 +0300 Subject: [PATCH 06/12] fix sequence2sequence to use v1beta services / default ns --- .../sequence-reply-to-sequence/README.md | 154 ++++++++---------- .../event-display.yaml | 12 +- .../sequence-reply-to-sequence/sequence1.yaml | 6 +- .../sequence-reply-to-sequence/sequence2.yaml | 6 +- .../sequence-reply-to-sequence/steps.yaml | 108 ++++++------ 5 files changed, 129 insertions(+), 157 deletions(-) diff --git a/docs/eventing/samples/sequence/sequence-reply-to-sequence/README.md b/docs/eventing/samples/sequence/sequence-reply-to-sequence/README.md index 37297bea038..cad9fc68106 100644 --- a/docs/eventing/samples/sequence/sequence-reply-to-sequence/README.md +++ b/docs/eventing/samples/sequence/sequence-reply-to-sequence/README.md @@ -9,7 +9,7 @@ type: "docs" ## Prerequisites For this example, we'll assume you have set up a an `InMemoryChannel` -as well as Knative Serving (for our functions). The examples use `newbroker` +as well as Knative Serving (for our functions). The examples use `default` namespace, again, if you want to deploy to another Namespace, you will need to modify the examples to reflect this. If you want to use different type of `Channel`, you will have to modify the @@ -28,107 +28,95 @@ it to a second `Sequence` and finally displaying the resulting output. ### Create the Knative Services -Change `newbroker` below to create the steps in the Namespace where you want resources +Change `default` below to create the steps in the Namespace where you want resources created. ```yaml -apiVersion: serving.knative.dev/v1alpha1 +apiVersion: serving.knative.dev/v1beta1 kind: Service metadata: name: first spec: - runLatest: - configuration: - revisionTemplate: - spec: - container: - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 - env: - - name: STEP - value: "0" + template: + spec: + containers: + - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + env: + - name: STEP + value: "0" --- -apiVersion: serving.knative.dev/v1alpha1 +apiVersion: serving.knative.dev/v1beta1 kind: Service metadata: name: second spec: - runLatest: - configuration: - revisionTemplate: - spec: - container: - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 - env: - - name: STEP - value: "1" + template: + spec: + containers: + - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + env: + - name: STEP + value: "1" --- -apiVersion: serving.knative.dev/v1alpha1 +apiVersion: serving.knative.dev/v1beta1 kind: Service metadata: name: third spec: - runLatest: - configuration: - revisionTemplate: - spec: - container: - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 - env: - - name: STEP - value: "2" + template: + spec: + containers: + - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + env: + - name: STEP + value: "2" --- -apiVersion: serving.knative.dev/v1alpha1 +apiVersion: serving.knative.dev/v1beta1 kind: Service metadata: name: fourth spec: - runLatest: - configuration: - revisionTemplate: - spec: - container: - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 - env: - - name: STEP - value: "3" + template: + spec: + containers: + - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + env: + - name: STEP + value: "3" --- -apiVersion: serving.knative.dev/v1alpha1 +apiVersion: serving.knative.dev/v1beta1 kind: Service metadata: name: fifth spec: - runLatest: - configuration: - revisionTemplate: - spec: - container: - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 - env: - - name: STEP - value: "4" + template: + spec: + containers: + - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + env: + - name: STEP + value: "4" --- -apiVersion: serving.knative.dev/v1alpha1 +apiVersion: serving.knative.dev/v1beta1 kind: Service metadata: name: sixth spec: - runLatest: - configuration: - revisionTemplate: - spec: - container: - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 - env: - - name: STEP - value: "5" + template: + spec: + containers: + - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + env: + - name: STEP + value: "5" --- ``` ```shell -kubectl -n newbroker create -f ./steps.yaml +kubectl -n default create -f ./steps.yaml ``` ### Create the first Sequence @@ -147,15 +135,15 @@ spec: kind: InMemoryChannel steps: - ref: - apiVersion: serving.knative.dev/v1alpha1 + apiVersion: serving.knative.dev/v1beta1 kind: Service name: first - ref: - apiVersion: serving.knative.dev/v1alpha1 + apiVersion: serving.knative.dev/v1beta1 kind: Service name: second - ref: - apiVersion: serving.knative.dev/v1alpha1 + apiVersion: serving.knative.dev/v1beta1 kind: Service name: third reply: @@ -164,10 +152,10 @@ spec: name: second-sequence ``` -Change `newbroker` below to create the `Sequence` in the Namespace where you want +Change `default` below to create the `Sequence` in the Namespace where you want your resources created. ```shell -kubectl -n newbroker create -f ./sequence1.yaml +kubectl -n default create -f ./sequence1.yaml ``` @@ -187,20 +175,20 @@ spec: kind: InMemoryChannel steps: - ref: - apiVersion: serving.knative.dev/v1alpha1 + apiVersion: serving.knative.dev/v1beta1 kind: Service name: fourth - ref: - apiVersion: serving.knative.dev/v1alpha1 + apiVersion: serving.knative.dev/v1beta1 kind: Service name: fifth - ref: - apiVersion: serving.knative.dev/v1alpha1 + apiVersion: serving.knative.dev/v1beta1 kind: Service name: sixth reply: kind: Service - apiVersion: serving.knative.dev/v1alpha1 + apiVersion: serving.knative.dev/v1beta1 name: event-display ``` @@ -208,23 +196,21 @@ spec: ### Create the Service displaying the events created by Sequence ```yaml -apiVersion: serving.knative.dev/v1alpha1 +apiVersion: serving.knative.dev/v1beta1 kind: Service metadata: name: event-display spec: - runLatest: - configuration: - revisionTemplate: - spec: - container: - image: gcr.io/knative-releases/github.com/knative/eventing-sources/cmd/event_display + template: + spec: + containerers: + - image: gcr.io/knative-releases/github.com/knative/eventing-sources/cmd/event_display ``` -Change `newbroker` below to create the `Sequence` in the Namespace where you want your resources +Change `default` below to create the `Sequence` in the Namespace where you want your resources created. ```shell -kubectl -n newbroker create -f ./event-display.yaml +kubectl -n default create -f ./event-display.yaml ``` ### Create the CronJobSource targeting the first Sequence @@ -247,21 +233,21 @@ Here, if you are using different type of Channel, you need to change the spec.channelTemplate to point to your desired Channel. ```shell -kubectl -n newbroker create -f ./cron-source.yaml +kubectl -n default create -f ./cron-source.yaml ``` ### Inspecting the results You can now see the final output by inspecting the logs of the event-display pods. ```shell -kubectl -n newbroker get pods +kubectl -n default get pods ``` Then grab the pod name for the event-display (in my case: "event-display-hw7r6-deployment-5555cf68db-bx4m2") ```shell -vaikas@penguin:~/projects/go/src/github.com/knative/docs$ kubectl -n newbroker logs event-display-hw7r6-deployment-5555cf68db-bx4m2 user-container +vaikas@penguin:~/projects/go/src/github.com/knative/docs$ kubectl -n default logs event-display-hw7r6-deployment-5555cf68db-bx4m2 user-container ☁️ cloudevents.Event Validation: valid Context Attributes, diff --git a/docs/eventing/samples/sequence/sequence-reply-to-sequence/event-display.yaml b/docs/eventing/samples/sequence/sequence-reply-to-sequence/event-display.yaml index e7207408408..3bd671bdf82 100644 --- a/docs/eventing/samples/sequence/sequence-reply-to-sequence/event-display.yaml +++ b/docs/eventing/samples/sequence/sequence-reply-to-sequence/event-display.yaml @@ -1,11 +1,9 @@ -apiVersion: serving.knative.dev/v1alpha1 +apiVersion: serving.knative.dev/v1beta1 kind: Service metadata: name: event-display spec: - runLatest: - configuration: - revisionTemplate: - spec: - container: - image: gcr.io/knative-releases/github.com/knative/eventing-sources/cmd/event_display + template: + spec: + containers: + - image: gcr.io/knative-releases/github.com/knative/eventing-sources/cmd/event_display diff --git a/docs/eventing/samples/sequence/sequence-reply-to-sequence/sequence1.yaml b/docs/eventing/samples/sequence/sequence-reply-to-sequence/sequence1.yaml index be4214f841d..f8d1686ce7e 100644 --- a/docs/eventing/samples/sequence/sequence-reply-to-sequence/sequence1.yaml +++ b/docs/eventing/samples/sequence/sequence-reply-to-sequence/sequence1.yaml @@ -8,15 +8,15 @@ spec: kind: InMemoryChannel steps: - ref: - apiVersion: serving.knative.dev/v1alpha1 + apiVersion: serving.knative.dev/v1beta1 kind: Service name: first - ref: - apiVersion: serving.knative.dev/v1alpha1 + apiVersion: serving.knative.dev/v1beta1 kind: Service name: second - ref: - apiVersion: serving.knative.dev/v1alpha1 + apiVersion: serving.knative.dev/v1beta1 kind: Service name: third reply: diff --git a/docs/eventing/samples/sequence/sequence-reply-to-sequence/sequence2.yaml b/docs/eventing/samples/sequence/sequence-reply-to-sequence/sequence2.yaml index 670146620e0..126a243aa40 100644 --- a/docs/eventing/samples/sequence/sequence-reply-to-sequence/sequence2.yaml +++ b/docs/eventing/samples/sequence/sequence-reply-to-sequence/sequence2.yaml @@ -8,15 +8,15 @@ spec: kind: InMemoryChannel steps: - ref: - apiVersion: serving.knative.dev/v1alpha1 + apiVersion: serving.knative.dev/v1beta1 kind: Service name: fourth - ref: - apiVersion: serving.knative.dev/v1alpha1 + apiVersion: serving.knative.dev/v1beta1 kind: Service name: fifth - ref: - apiVersion: serving.knative.dev/v1alpha1 + apiVersion: serving.knative.dev/v1beta1 kind: Service name: sixth reply: diff --git a/docs/eventing/samples/sequence/sequence-reply-to-sequence/steps.yaml b/docs/eventing/samples/sequence/sequence-reply-to-sequence/steps.yaml index 87a3749dbf5..cd0948bb955 100644 --- a/docs/eventing/samples/sequence/sequence-reply-to-sequence/steps.yaml +++ b/docs/eventing/samples/sequence/sequence-reply-to-sequence/steps.yaml @@ -1,92 +1,80 @@ -apiVersion: serving.knative.dev/v1alpha1 +apiVersion: serving.knative.dev/v1beta1 kind: Service metadata: name: first spec: - runLatest: - configuration: - revisionTemplate: - spec: - container: - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 - env: - - name: STEP - value: "0" + template: + spec: + containers: + - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + env: + - name: STEP + value: "0" --- -apiVersion: serving.knative.dev/v1alpha1 +apiVersion: serving.knative.dev/v1beta1 kind: Service metadata: name: second spec: - runLatest: - configuration: - revisionTemplate: - spec: - container: - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 - env: - - name: STEP - value: "1" + template: + spec: + containers: + - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + env: + - name: STEP + value: "1" --- -apiVersion: serving.knative.dev/v1alpha1 +apiVersion: serving.knative.dev/v1beta1 kind: Service metadata: name: third spec: - runLatest: - configuration: - revisionTemplate: - spec: - container: - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 - env: - - name: STEP - value: "2" + template: + spec: + containers: + - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + env: + - name: STEP + value: "2" --- -apiVersion: serving.knative.dev/v1alpha1 +apiVersion: serving.knative.dev/v1beta1 kind: Service metadata: name: fourth spec: - runLatest: - configuration: - revisionTemplate: - spec: - container: - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 - env: - - name: STEP - value: "3" + template: + spec: + containers: + - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + env: + - name: STEP + value: "3" --- -apiVersion: serving.knative.dev/v1alpha1 +apiVersion: serving.knative.dev/v1beta1 kind: Service metadata: name: fifth spec: - runLatest: - configuration: - revisionTemplate: - spec: - container: - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 - env: - - name: STEP - value: "4" + template: + spec: + containers: + - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + env: + - name: STEP + value: "4" --- -apiVersion: serving.knative.dev/v1alpha1 +apiVersion: serving.knative.dev/v1beta1 kind: Service metadata: name: sixth spec: - runLatest: - configuration: - revisionTemplate: - spec: - container: - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 - env: - - name: STEP - value: "5" + template: + spec: + containers: + - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + env: + - name: STEP + value: "5" --- From 2ad2d1aa65f38cdd31b59536f086d36363e3ad7d Mon Sep 17 00:00:00 2001 From: Ville Aikas Date: Tue, 18 Jun 2019 22:13:16 +0300 Subject: [PATCH 07/12] fix broker example to use v1beta1 service + default ns --- .../sequence-with-broker-trigger/README.md | 78 +++++++++---------- .../sequence.yaml | 6 +- .../sequence-with-broker-trigger/steps.yaml | 54 ++++++------- 3 files changed, 62 insertions(+), 76 deletions(-) diff --git a/docs/eventing/samples/sequence/sequence-with-broker-trigger/README.md b/docs/eventing/samples/sequence/sequence-with-broker-trigger/README.md index 70b9552842a..a03f1415cfb 100644 --- a/docs/eventing/samples/sequence/sequence-with-broker-trigger/README.md +++ b/docs/eventing/samples/sequence/sequence-with-broker-trigger/README.md @@ -9,7 +9,7 @@ type: "docs" ## Prerequisites For this example, we'll assume you have set up a `Broker` and an `InMemoryChannel` -as well as Knative Serving (for our functions). The examples use `newbroker` +as well as Knative Serving (for our functions). The examples use `default` namespace, again, if your broker lives in another Namespace, you will need to modify the examples to reflect this. If you want to use different type of `Channel`, you will have to modify the @@ -33,52 +33,46 @@ the Broker. ### Create the Knative Services -Change `newbroker` below to create the steps in the Namespace where you have configured your +Change `default` below to create the steps in the Namespace where you have configured your `Broker` ```yaml -apiVersion: serving.knative.dev/v1alpha1 +apiVersion: serving.knative.dev/v1beta1 kind: Service metadata: name: first spec: - runLatest: - configuration: - revisionTemplate: - spec: - container: - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + template: + spec: + containers: + - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 env: - name: STEP value: "0" --- -apiVersion: serving.knative.dev/v1alpha1 +apiVersion: serving.knative.dev/v1beta1 kind: Service metadata: name: second spec: - runLatest: - configuration: - revisionTemplate: - spec: - container: - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + template: + spec: + containers: + - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 env: - name: STEP value: "1" --- -apiVersion: serving.knative.dev/v1alpha1 +apiVersion: serving.knative.dev/v1beta1 kind: Service metadata: name: third spec: - runLatest: - configuration: - revisionTemplate: - spec: - container: - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + template: + spec: + containers: + - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 env: - name: STEP value: "2" @@ -88,7 +82,7 @@ spec: ```shell -kubectl -n newbroker create -f ./steps.yaml +kubectl -n default create -f ./steps.yaml ``` ### Create the Sequence @@ -108,15 +102,15 @@ spec: kind: InMemoryChannel steps: - ref: - apiVersion: serving.knative.dev/v1alpha1 + apiVersion: serving.knative.dev/v1beta1 kind: Service name: first - ref: - apiVersion: serving.knative.dev/v1alpha1 + apiVersion: serving.knative.dev/v1beta1 kind: Service name: second - ref: - apiVersion: serving.knative.dev/v1alpha1 + apiVersion: serving.knative.dev/v1beta1 kind: Service name: third reply: @@ -125,10 +119,10 @@ spec: name: broker-test ``` -Change `newbroker` below to create the `Sequence` in the Namespace where you have configured your +Change `default` below to create the `Sequence` in the Namespace where you have configured your `Broker`. ```shell -kubectl -n newbroker create -f ./sequence.yaml +kubectl -n default create -f ./sequence.yaml ``` @@ -152,10 +146,10 @@ Here, if you are using different type of Channel, you need to change the spec.channelTemplate to point to your desired Channel. Also, change the spec.reply.name to point to your `Broker` -Change `newbroker` below to create the `Sequence` in the Namespace where you have configured your +Change `default` below to create the `Sequence` in the Namespace where you have configured your `Broker`. ```shell -kubectl -n newbroker create -f ./cron-source.yaml +kubectl -n default create -f ./cron-source.yaml ``` ### Create the Trigger targeting the Sequence @@ -176,10 +170,10 @@ spec: name: sequence ``` -Change `newbroker` below to create the `Sequence` in the Namespace where you have configured your +Change `default` below to create the `Sequence` in the Namespace where you have configured your `Broker`. ```shell -kubectl -n newbroker create -f ./trigger.yaml +kubectl -n default create -f ./trigger.yaml ``` @@ -189,17 +183,15 @@ kubectl -n newbroker create -f ./trigger.yaml are filtered. [TODO: Fix this](https://github.com/knative/eventing/issues/1421) ```yaml -apiVersion: serving.knative.dev/v1alpha1 +apiVersion: serving.knative.dev/v1beta1 kind: Service metadata: name: sequence-display spec: - runLatest: - configuration: - revisionTemplate: - spec: - container: - image: gcr.io/knative-releases/github.com/knative/eventing-sources/cmd/event_display + template: + spec: + containers: + - image: gcr.io/knative-releases/github.com/knative/eventing-sources/cmd/event_display --- apiVersion: eventing.knative.dev/v1alpha1 kind: Trigger @@ -211,15 +203,15 @@ spec: type: samples.http.mod3 subscriber: ref: - apiVersion: serving.knative.dev/v1alpha1 + apiVersion: serving.knative.dev/v1beta1 kind: Service name: sequence-display --- ``` -Change `newbroker` below to create the `Sequence` in the Namespace where you have configured your +Change `default` below to create the `Sequence` in the Namespace where you have configured your `Broker`. ```shell -kubectl -n newbroker create -f ./display-trigger.yaml +kubectl -n default create -f ./display-trigger.yaml ``` diff --git a/docs/eventing/samples/sequence/sequence-with-broker-trigger/sequence.yaml b/docs/eventing/samples/sequence/sequence-with-broker-trigger/sequence.yaml index 03f6d6328b4..1cfccd654a6 100644 --- a/docs/eventing/samples/sequence/sequence-with-broker-trigger/sequence.yaml +++ b/docs/eventing/samples/sequence/sequence-with-broker-trigger/sequence.yaml @@ -8,15 +8,15 @@ spec: kind: InMemoryChannel steps: - ref: - apiVersion: serving.knative.dev/v1alpha1 + apiVersion: serving.knative.dev/v1beta1 kind: Service name: first - ref: - apiVersion: serving.knative.dev/v1alpha1 + apiVersion: serving.knative.dev/v1beta1 kind: Service name: second - ref: - apiVersion: serving.knative.dev/v1alpha1 + apiVersion: serving.knative.dev/v1beta1 kind: Service name: third reply: diff --git a/docs/eventing/samples/sequence/sequence-with-broker-trigger/steps.yaml b/docs/eventing/samples/sequence/sequence-with-broker-trigger/steps.yaml index 54754068599..95b24b2c4d1 100644 --- a/docs/eventing/samples/sequence/sequence-with-broker-trigger/steps.yaml +++ b/docs/eventing/samples/sequence/sequence-with-broker-trigger/steps.yaml @@ -1,47 +1,41 @@ -apiVersion: serving.knative.dev/v1alpha1 +apiVersion: serving.knative.dev/v1beta1 kind: Service metadata: name: first spec: - runLatest: - configuration: - revisionTemplate: - spec: - container: - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 - env: - - name: STEP - value: "0" + template: + spec: + containers: + - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + env: + - name: STEP + value: "0" --- -apiVersion: serving.knative.dev/v1alpha1 +apiVersion: serving.knative.dev/v1beta1 kind: Service metadata: name: second spec: - runLatest: - configuration: - revisionTemplate: - spec: - container: - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 - env: - - name: STEP - value: "1" + template: + spec: + containers: + - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + env: + - name: STEP + value: "1" --- -apiVersion: serving.knative.dev/v1alpha1 +apiVersion: serving.knative.dev/v1beta1 kind: Service metadata: name: third spec: - runLatest: - configuration: - revisionTemplate: - spec: - container: - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 - env: - - name: STEP - value: "2" + template: + spec: + containers: + - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + env: + - name: STEP + value: "2" --- From 39b6f04531e76e794d3eae255ffc3fe402456d2b Mon Sep 17 00:00:00 2001 From: Ville Aikas Date: Wed, 19 Jun 2019 08:35:05 +0300 Subject: [PATCH 08/12] Address PR feedback --- .../sequence-reply-to-event-display/README.md | 10 +++++----- .../sequence-reply-to-sequence/README.md | 12 ++++++------ .../samples/sequence/sequence-terminal/README.md | 16 ++++++++++------ .../sequence-with-broker-trigger/README.md | 6 ++++++ .../display-trigger.yaml | 2 +- docs/eventing/sequence.md | 2 ++ 6 files changed, 30 insertions(+), 18 deletions(-) diff --git a/docs/eventing/samples/sequence/sequence-reply-to-event-display/README.md b/docs/eventing/samples/sequence/sequence-reply-to-event-display/README.md index f9a55a2443a..2f81f6dd1ee 100644 --- a/docs/eventing/samples/sequence/sequence-reply-to-event-display/README.md +++ b/docs/eventing/samples/sequence/sequence-reply-to-event-display/README.md @@ -12,6 +12,7 @@ For this example, we'll assume you have set up an `InMemoryChannel` as well as Knative Serving (for our functions). The examples use `default` namespace, again, if you want to deploy to another Namespace, you will need to modify the examples to reflect this. + If you want to use different type of `Channel`, you will have to modify the `Sequence.Spec.ChannelTemplate` to create the appropriate Channel resources. @@ -135,6 +136,7 @@ spec: Change `default` below to create the `Sequence` in the Namespace where you want your resources to be created. + ```shell kubectl -n default create -f ./event-display.yaml ``` @@ -155,9 +157,6 @@ spec: name: sequence ``` -Here, if you are using different type of Channel, you need to change the -spec.channelTemplate to point to your desired Channel. - ```shell kubectl -n default create -f ./cron-source.yaml ``` @@ -165,15 +164,16 @@ kubectl -n default create -f ./cron-source.yaml ### Inspecting the results You can now see the final output by inspecting the logs of the event-display pods. + ```shell kubectl -n default get pods ``` -Then grab the pod name for the event-display (in my case: "event-display-sldk5-deployment-79b69bb4c9-djwj4") +Then look at the logs for the event-display pod: ```shell -vaikas@penguin:~/projects/go/src/github.com/knative/docs$ kubectl -n default logs event-display-sldk5-deployment-79b69bb4c9-djwj4 user-container +kubectl -n default logs -l serving.knative.dev/service=event-display -c user-container ☁️ cloudevents.Event Validation: valid Context Attributes, diff --git a/docs/eventing/samples/sequence/sequence-reply-to-sequence/README.md b/docs/eventing/samples/sequence/sequence-reply-to-sequence/README.md index cad9fc68106..0b9b69b3c59 100644 --- a/docs/eventing/samples/sequence/sequence-reply-to-sequence/README.md +++ b/docs/eventing/samples/sequence/sequence-reply-to-sequence/README.md @@ -12,6 +12,7 @@ For this example, we'll assume you have set up a an `InMemoryChannel` as well as Knative Serving (for our functions). The examples use `default` namespace, again, if you want to deploy to another Namespace, you will need to modify the examples to reflect this. + If you want to use different type of `Channel`, you will have to modify the `Sequence.Spec.ChannelTemplate` to create the appropriate Channel resources. @@ -154,6 +155,7 @@ spec: Change `default` below to create the `Sequence` in the Namespace where you want your resources created. + ```shell kubectl -n default create -f ./sequence1.yaml ``` @@ -209,6 +211,7 @@ spec: Change `default` below to create the `Sequence` in the Namespace where you want your resources created. + ```shell kubectl -n default create -f ./event-display.yaml ``` @@ -229,9 +232,6 @@ spec: name: first-sequence ``` -Here, if you are using different type of Channel, you need to change the -spec.channelTemplate to point to your desired Channel. - ```shell kubectl -n default create -f ./cron-source.yaml ``` @@ -239,15 +239,15 @@ kubectl -n default create -f ./cron-source.yaml ### Inspecting the results You can now see the final output by inspecting the logs of the event-display pods. + ```shell kubectl -n default get pods ``` -Then grab the pod name for the event-display (in my case: "event-display-hw7r6-deployment-5555cf68db-bx4m2") - +Then look at the logs for the event-display pod: ```shell -vaikas@penguin:~/projects/go/src/github.com/knative/docs$ kubectl -n default logs event-display-hw7r6-deployment-5555cf68db-bx4m2 user-container +kubectl -n default logs -l serving.knative.dev/service=event-display -c user-container ☁️ cloudevents.Event Validation: valid Context Attributes, diff --git a/docs/eventing/samples/sequence/sequence-terminal/README.md b/docs/eventing/samples/sequence/sequence-terminal/README.md index def6b1e297e..679515d856b 100644 --- a/docs/eventing/samples/sequence/sequence-terminal/README.md +++ b/docs/eventing/samples/sequence/sequence-terminal/README.md @@ -11,6 +11,7 @@ For this example, we'll assume you have set up an `InMemoryChannel` as well as Knative Serving (for our functions). The examples use `default` namespace, again, if you want to deploy to another Namespace, you will need to modify the examples to reflect this. + If you want to use different type of `Channel`, you will have to modify the `Sequence.Spec.ChannelTemplate` to create the appropriate Channel resources. @@ -138,16 +139,18 @@ kubectl -n default create -f ./cron-source.yaml ### Inspecting the results -You can now see the final output by inspecting the logs of the event-display pods. +You can now see the final output by inspecting the logs of the event-display pods. Note that since +we set the `CronJobSource` to emit every 2 minutes, it might take some time for the events to show +up in the logs. + ```shell kubectl -n default get pods ``` -Then grab the pod name for the first step in the `Sequence` (in my case: "first-bx2w9-deployment-599866bc88-rfqvz") - +Let's look at the logs for the first `Step` in the `Sequence`: ```shell -vaikas@penguin:~/projects/go/src/github.com/knative/docs$ kubectl -n default logs first-bx2w9-deployment-599866bc88-rfqvz user-container +kubectl -n default logs -l serving.knative.dev/service=first -c user-container Got Event Context: Context Attributes, specversion: 0.2 type: dev.knative.cronjob.event @@ -181,8 +184,9 @@ Got Transport Context: Transport Context, Then we can look at the output of the second Step in the `Sequence`: + ```shell -vaikas@penguin:~/projects/go/src/github.com/knative/docs$ kubectl -n default logs second-w9vbk-deployment-68b946f49b-2rv95 user-container +kubectl -n default logs -l serving.knative.dev/service=second -c user-container Got Event Context: Context Attributes, cloudEventsVersion: 0.1 eventType: samples.http.mod3 @@ -217,7 +221,7 @@ first step in the Sequence to include " - Handled by 0". Exciting :) Then we can look at the output of the last Step in the `Sequence`: ```shell -vaikas@penguin:~/projects/go/src/github.com/knative/docs$ kubectl -n default logs third-wxt9q-deployment-7f6d4b9d89-56cqc user-container +kubectl -n default logs -l serving.knative.dev/service=third -c user-container Got Event Context: Context Attributes, cloudEventsVersion: 0.1 eventType: samples.http.mod3 diff --git a/docs/eventing/samples/sequence/sequence-with-broker-trigger/README.md b/docs/eventing/samples/sequence/sequence-with-broker-trigger/README.md index a03f1415cfb..fd9db0337c2 100644 --- a/docs/eventing/samples/sequence/sequence-with-broker-trigger/README.md +++ b/docs/eventing/samples/sequence/sequence-with-broker-trigger/README.md @@ -12,6 +12,7 @@ For this example, we'll assume you have set up a `Broker` and an `InMemoryChanne as well as Knative Serving (for our functions). The examples use `default` namespace, again, if your broker lives in another Namespace, you will need to modify the examples to reflect this. + If you want to use different type of `Channel`, you will have to modify the `Sequence.Spec.ChannelTemplate` to create the appropriate Channel resources. @@ -22,6 +23,7 @@ feeding events into the Broker, then we create a `Filter` that wires those event into a Sequence consisting of 3 steps. Then we take the end of the Sequence and feed newly minted events back into the Broker and create another Trigger which will then display those events. + **NOTE** [TODO: Fix this](https://github.com/knative/eventing/issues/1421) So, currently as set up, the events emitted by the Sequence do not make it into the Broker. @@ -121,6 +123,7 @@ spec: Change `default` below to create the `Sequence` in the Namespace where you have configured your `Broker`. + ```shell kubectl -n default create -f ./sequence.yaml ``` @@ -148,6 +151,7 @@ spec.reply.name to point to your `Broker` Change `default` below to create the `Sequence` in the Namespace where you have configured your `Broker`. + ```shell kubectl -n default create -f ./cron-source.yaml ``` @@ -172,6 +176,7 @@ spec: Change `default` below to create the `Sequence` in the Namespace where you have configured your `Broker`. + ```shell kubectl -n default create -f ./trigger.yaml @@ -211,6 +216,7 @@ spec: Change `default` below to create the `Sequence` in the Namespace where you have configured your `Broker`. + ```shell kubectl -n default create -f ./display-trigger.yaml ``` diff --git a/docs/eventing/samples/sequence/sequence-with-broker-trigger/display-trigger.yaml b/docs/eventing/samples/sequence/sequence-with-broker-trigger/display-trigger.yaml index 200996cf4ad..a33239a324e 100644 --- a/docs/eventing/samples/sequence/sequence-with-broker-trigger/display-trigger.yaml +++ b/docs/eventing/samples/sequence/sequence-with-broker-trigger/display-trigger.yaml @@ -24,4 +24,4 @@ spec: apiVersion: serving.knative.dev/v1alpha1 kind: Service name: sequence-display ---- \ No newline at end of file +--- diff --git a/docs/eventing/sequence.md b/docs/eventing/sequence.md index 3714aefb4e1..4c82404ebe5 100644 --- a/docs/eventing/sequence.md +++ b/docs/eventing/sequence.md @@ -55,6 +55,7 @@ Each of the steps simply tacks on "- Handled by ", for example the For the next example, we'll use the same 3 Step `Sequence` that is wired directly into the `CronJobSource`. Each of the steps simply tacks on "- Handled by ", for example the first Step in the `Sequence` will take the incoming message and append "- Handled by 0" to the incoming message. + The only difference is that we'll use the `Subscriber.Spec.Reply` field to wire the output of the last Step to an event display pod. @@ -63,6 +64,7 @@ last Step to an event display pod. For the next example, we'll use the same 3 Step `Sequence` that is wired directly into the `CronJobSource`. Each of the steps simply tacks on "- Handled by ", for example the first Step in the `Sequence` will take the incoming message and append "- Handled by 0" to the incoming message. + The only difference is that we'll use the `Subscriber.Spec.Reply` field to wire the output of the last Step to another `Sequence` that does the smae message modifications as the first pipeline (with different steps however). From bdf7d93b6304a6d688a9c0f530c9d56089302572 Mon Sep 17 00:00:00 2001 From: Ville Aikas Date: Wed, 19 Jun 2019 09:30:05 +0300 Subject: [PATCH 09/12] add a pointer to vaikas-google/transformer sample --- docs/eventing/sequence.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/eventing/sequence.md b/docs/eventing/sequence.md index 4c82404ebe5..104820d4130 100644 --- a/docs/eventing/sequence.md +++ b/docs/eventing/sequence.md @@ -44,6 +44,10 @@ For each of these examples below, we'll use [`CronJobSource`](https://knative.dev/v0.4-docs/reference/eventing/eventing-sources-api/#CronJobSource) as the source of events. +We also use a very simple [transformer](https://github.com/vaikas-google/transformer) which +performs very trivial transformation of the incoming events to demonstrate they have passed +through each stage. + ### (Sequence with no reply (terminal last Step))[./samples/sequence/sequence-terminal/README.md) For the first example, we'll use a 3 Step `Sequence` that is wired directly into the `CronJobSource`. From a45d70ea924b7bec69b95183fa00c3e5cb3d5545 Mon Sep 17 00:00:00 2001 From: Ville Aikas Date: Wed, 19 Jun 2019 10:13:42 +0300 Subject: [PATCH 10/12] update transformer image refs to latest --- .../sequence-reply-to-event-display/README.md | 6 +++--- .../sequence-reply-to-event-display/steps.yaml | 6 +++--- .../sequence/sequence-reply-to-sequence/README.md | 12 ++++++------ .../sequence/sequence-reply-to-sequence/steps.yaml | 12 ++++++------ .../samples/sequence/sequence-terminal/README.md | 6 +++--- .../samples/sequence/sequence-terminal/steps.yaml | 6 +++--- .../sequence/sequence-with-broker-trigger/README.md | 6 +++--- .../sequence/sequence-with-broker-trigger/steps.yaml | 6 +++--- 8 files changed, 30 insertions(+), 30 deletions(-) diff --git a/docs/eventing/samples/sequence/sequence-reply-to-event-display/README.md b/docs/eventing/samples/sequence/sequence-reply-to-event-display/README.md index 2f81f6dd1ee..02215948bf7 100644 --- a/docs/eventing/samples/sequence/sequence-reply-to-event-display/README.md +++ b/docs/eventing/samples/sequence/sequence-reply-to-event-display/README.md @@ -41,7 +41,7 @@ spec: template: spec: containers: - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:2656f39a7fcb6afd9fc79e7a4e215d14d651dc674f38020d1d18c6f04b220700 env: - name: STEP value: "0" @@ -55,7 +55,7 @@ spec: template: spec: containers: - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:2656f39a7fcb6afd9fc79e7a4e215d14d651dc674f38020d1d18c6f04b220700 env: - name: STEP value: "1" @@ -68,7 +68,7 @@ spec: template: spec: containers: - - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:2656f39a7fcb6afd9fc79e7a4e215d14d651dc674f38020d1d18c6f04b220700 env: - name: STEP value: "2" diff --git a/docs/eventing/samples/sequence/sequence-reply-to-event-display/steps.yaml b/docs/eventing/samples/sequence/sequence-reply-to-event-display/steps.yaml index e8f054d55d0..c67a8041a68 100644 --- a/docs/eventing/samples/sequence/sequence-reply-to-event-display/steps.yaml +++ b/docs/eventing/samples/sequence/sequence-reply-to-event-display/steps.yaml @@ -6,7 +6,7 @@ spec: template: spec: containers: - - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:2656f39a7fcb6afd9fc79e7a4e215d14d651dc674f38020d1d18c6f04b220700 env: - name: STEP value: "0" @@ -20,7 +20,7 @@ spec: template: spec: containers: - - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:2656f39a7fcb6afd9fc79e7a4e215d14d651dc674f38020d1d18c6f04b220700 env: - name: STEP value: "1" @@ -33,7 +33,7 @@ spec: template: spec: containers: - - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:2656f39a7fcb6afd9fc79e7a4e215d14d651dc674f38020d1d18c6f04b220700 env: - name: STEP value: "2" diff --git a/docs/eventing/samples/sequence/sequence-reply-to-sequence/README.md b/docs/eventing/samples/sequence/sequence-reply-to-sequence/README.md index 0b9b69b3c59..a14b306b8a7 100644 --- a/docs/eventing/samples/sequence/sequence-reply-to-sequence/README.md +++ b/docs/eventing/samples/sequence/sequence-reply-to-sequence/README.md @@ -41,7 +41,7 @@ spec: template: spec: containers: - - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:2656f39a7fcb6afd9fc79e7a4e215d14d651dc674f38020d1d18c6f04b220700 env: - name: STEP value: "0" @@ -55,7 +55,7 @@ spec: template: spec: containers: - - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:2656f39a7fcb6afd9fc79e7a4e215d14d651dc674f38020d1d18c6f04b220700 env: - name: STEP value: "1" @@ -68,7 +68,7 @@ spec: template: spec: containers: - - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:2656f39a7fcb6afd9fc79e7a4e215d14d651dc674f38020d1d18c6f04b220700 env: - name: STEP value: "2" @@ -81,7 +81,7 @@ spec: template: spec: containers: - - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:2656f39a7fcb6afd9fc79e7a4e215d14d651dc674f38020d1d18c6f04b220700 env: - name: STEP value: "3" @@ -95,7 +95,7 @@ spec: template: spec: containers: - - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:2656f39a7fcb6afd9fc79e7a4e215d14d651dc674f38020d1d18c6f04b220700 env: - name: STEP value: "4" @@ -108,7 +108,7 @@ spec: template: spec: containers: - - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:2656f39a7fcb6afd9fc79e7a4e215d14d651dc674f38020d1d18c6f04b220700 env: - name: STEP value: "5" diff --git a/docs/eventing/samples/sequence/sequence-reply-to-sequence/steps.yaml b/docs/eventing/samples/sequence/sequence-reply-to-sequence/steps.yaml index cd0948bb955..e04ed19e43d 100644 --- a/docs/eventing/samples/sequence/sequence-reply-to-sequence/steps.yaml +++ b/docs/eventing/samples/sequence/sequence-reply-to-sequence/steps.yaml @@ -6,7 +6,7 @@ spec: template: spec: containers: - - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:2656f39a7fcb6afd9fc79e7a4e215d14d651dc674f38020d1d18c6f04b220700 env: - name: STEP value: "0" @@ -20,7 +20,7 @@ spec: template: spec: containers: - - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:2656f39a7fcb6afd9fc79e7a4e215d14d651dc674f38020d1d18c6f04b220700 env: - name: STEP value: "1" @@ -33,7 +33,7 @@ spec: template: spec: containers: - - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:2656f39a7fcb6afd9fc79e7a4e215d14d651dc674f38020d1d18c6f04b220700 env: - name: STEP value: "2" @@ -47,7 +47,7 @@ spec: template: spec: containers: - - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:2656f39a7fcb6afd9fc79e7a4e215d14d651dc674f38020d1d18c6f04b220700 env: - name: STEP value: "3" @@ -60,7 +60,7 @@ spec: template: spec: containers: - - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:2656f39a7fcb6afd9fc79e7a4e215d14d651dc674f38020d1d18c6f04b220700 env: - name: STEP value: "4" @@ -73,7 +73,7 @@ spec: template: spec: containers: - - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:2656f39a7fcb6afd9fc79e7a4e215d14d651dc674f38020d1d18c6f04b220700 env: - name: STEP value: "5" diff --git a/docs/eventing/samples/sequence/sequence-terminal/README.md b/docs/eventing/samples/sequence/sequence-terminal/README.md index 679515d856b..a1e65c5cdb7 100644 --- a/docs/eventing/samples/sequence/sequence-terminal/README.md +++ b/docs/eventing/samples/sequence/sequence-terminal/README.md @@ -39,7 +39,7 @@ spec: template: spec: containers: - - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:2656f39a7fcb6afd9fc79e7a4e215d14d651dc674f38020d1d18c6f04b220700 env: - name: STEP value: "0" @@ -53,7 +53,7 @@ spec: template: spec: containers: - - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:2656f39a7fcb6afd9fc79e7a4e215d14d651dc674f38020d1d18c6f04b220700 env: - name: STEP value: "1" @@ -66,7 +66,7 @@ spec: template: spec: containers: - - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:2656f39a7fcb6afd9fc79e7a4e215d14d651dc674f38020d1d18c6f04b220700 env: - name: STEP value: "2" diff --git a/docs/eventing/samples/sequence/sequence-terminal/steps.yaml b/docs/eventing/samples/sequence/sequence-terminal/steps.yaml index aa65d4e1561..7857be0bb66 100644 --- a/docs/eventing/samples/sequence/sequence-terminal/steps.yaml +++ b/docs/eventing/samples/sequence/sequence-terminal/steps.yaml @@ -6,7 +6,7 @@ spec: template: spec: containers: - - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:2656f39a7fcb6afd9fc79e7a4e215d14d651dc674f38020d1d18c6f04b220700 env: - name: STEP value: "0" @@ -20,7 +20,7 @@ spec: template: spec: containers: - - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:2656f39a7fcb6afd9fc79e7a4e215d14d651dc674f38020d1d18c6f04b220700 env: - name: STEP value: "1" @@ -33,7 +33,7 @@ spec: template: spec: containers: - - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:2656f39a7fcb6afd9fc79e7a4e215d14d651dc674f38020d1d18c6f04b220700 env: - name: STEP value: "2" diff --git a/docs/eventing/samples/sequence/sequence-with-broker-trigger/README.md b/docs/eventing/samples/sequence/sequence-with-broker-trigger/README.md index fd9db0337c2..5bc5b15d401 100644 --- a/docs/eventing/samples/sequence/sequence-with-broker-trigger/README.md +++ b/docs/eventing/samples/sequence/sequence-with-broker-trigger/README.md @@ -47,7 +47,7 @@ spec: template: spec: containers: - - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:2656f39a7fcb6afd9fc79e7a4e215d14d651dc674f38020d1d18c6f04b220700 env: - name: STEP value: "0" @@ -61,7 +61,7 @@ spec: template: spec: containers: - - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:2656f39a7fcb6afd9fc79e7a4e215d14d651dc674f38020d1d18c6f04b220700 env: - name: STEP value: "1" @@ -74,7 +74,7 @@ spec: template: spec: containers: - - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:2656f39a7fcb6afd9fc79e7a4e215d14d651dc674f38020d1d18c6f04b220700 env: - name: STEP value: "2" diff --git a/docs/eventing/samples/sequence/sequence-with-broker-trigger/steps.yaml b/docs/eventing/samples/sequence/sequence-with-broker-trigger/steps.yaml index 95b24b2c4d1..95b23ff8ece 100644 --- a/docs/eventing/samples/sequence/sequence-with-broker-trigger/steps.yaml +++ b/docs/eventing/samples/sequence/sequence-with-broker-trigger/steps.yaml @@ -6,7 +6,7 @@ spec: template: spec: containers: - - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:2656f39a7fcb6afd9fc79e7a4e215d14d651dc674f38020d1d18c6f04b220700 env: - name: STEP value: "0" @@ -20,7 +20,7 @@ spec: template: spec: containers: - - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:2656f39a7fcb6afd9fc79e7a4e215d14d651dc674f38020d1d18c6f04b220700 env: - name: STEP value: "1" @@ -33,7 +33,7 @@ spec: template: spec: containers: - - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:17f0bb4c6ee5b1e5580966aa705a51f1b54adc794356f14c9d441d91a26412a3 + - image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:2656f39a7fcb6afd9fc79e7a4e215d14d651dc674f38020d1d18c6f04b220700 env: - name: STEP value: "2" From 1f9ba7fa06f9dfe389b4b0bc5523df0f1e1cab80 Mon Sep 17 00:00:00 2001 From: Ville Aikas Date: Thu, 20 Jun 2019 12:28:48 +0300 Subject: [PATCH 11/12] address PR feedback --- .../sequence-reply-to-event-display/README.md | 5 ++++- .../sequence/sequence-reply-to-sequence/README.md | 11 +++++++---- .../samples/sequence/sequence-terminal/README.md | 5 ++++- .../sequence/sequence-with-broker-trigger/README.md | 10 +++++++--- docs/eventing/sequence.md | 7 ++++--- 5 files changed, 26 insertions(+), 12 deletions(-) diff --git a/docs/eventing/samples/sequence/sequence-reply-to-event-display/README.md b/docs/eventing/samples/sequence/sequence-reply-to-event-display/README.md index 02215948bf7..2944e87dc47 100644 --- a/docs/eventing/samples/sequence/sequence-reply-to-event-display/README.md +++ b/docs/eventing/samples/sequence/sequence-reply-to-event-display/README.md @@ -82,7 +82,7 @@ kubectl -n default create -f ./steps.yaml ### Create the Sequence -Here, if you are using different type of Channel, you need to change the +The `sequence.yaml` file contains the specifications for creating the Sequence. If you are using a different type of Channel, you need to change the spec.channelTemplate to point to your desired Channel. ```yaml @@ -143,6 +143,9 @@ kubectl -n default create -f ./event-display.yaml ### Create the CronJobSource targeting the Sequence +This will create a CronJobSource which will send a CloudEvent with {"message": "Hello world!"} as +the data payload every 2 minutes. + ```yaml apiVersion: sources.eventing.knative.dev/v1alpha1 kind: CronJobSource diff --git a/docs/eventing/samples/sequence/sequence-reply-to-sequence/README.md b/docs/eventing/samples/sequence/sequence-reply-to-sequence/README.md index a14b306b8a7..85e6d9d1009 100644 --- a/docs/eventing/samples/sequence/sequence-reply-to-sequence/README.md +++ b/docs/eventing/samples/sequence/sequence-reply-to-sequence/README.md @@ -122,8 +122,8 @@ kubectl -n default create -f ./steps.yaml ### Create the first Sequence -Here, if you are using different type of Channel, you need to change the -spec.channelTemplate to point to your desired Channel. +The `sequence1.yaml` file contains the specifications for creating the Sequence. If you are using a different type of +Channel, you need to change the spec.channelTemplate to point to your desired Channel. ```yaml apiVersion: messaging.knative.dev/v1alpha1 @@ -163,8 +163,8 @@ kubectl -n default create -f ./sequence1.yaml ### Create the second Sequence -Here, again if you are using different type of Channel, you need to change the -spec.channelTemplate to point to your desired Channel. +The `sequence2.yaml` file contains the specifications for creating the Sequence. If you are using a different type of +Channel, you need to change the spec.channelTemplate to point to your desired Channel. ```yaml apiVersion: messaging.knative.dev/v1alpha1 @@ -218,6 +218,9 @@ kubectl -n default create -f ./event-display.yaml ### Create the CronJobSource targeting the first Sequence +This will create a CronJobSource which will send a CloudEvent with {"message": "Hello world!"} as +the data payload every 2 minutes. + ```yaml apiVersion: sources.eventing.knative.dev/v1alpha1 kind: CronJobSource diff --git a/docs/eventing/samples/sequence/sequence-terminal/README.md b/docs/eventing/samples/sequence/sequence-terminal/README.md index a1e65c5cdb7..b63dbdf06d5 100644 --- a/docs/eventing/samples/sequence/sequence-terminal/README.md +++ b/docs/eventing/samples/sequence/sequence-terminal/README.md @@ -80,7 +80,7 @@ kubectl -n default create -f ./steps.yaml ### Create the Sequence -Here, if you are using different type of Channel, you need to change the +The `sequence.yaml` file contains the specifications for creating the Sequence. If you are using a different type of Channel, you need to change the spec.channelTemplate to point to your desired Channel. ```yaml @@ -116,6 +116,9 @@ kubectl -n default create -f ./sequence.yaml ### Create the CronJobSource targeting the Sequence +This will create a CronJobSource which will send a CloudEvent with {"message": "Hello world!"} as +the data payload every 2 minutes. + ```yaml apiVersion: sources.eventing.knative.dev/v1alpha1 kind: CronJobSource diff --git a/docs/eventing/samples/sequence/sequence-with-broker-trigger/README.md b/docs/eventing/samples/sequence/sequence-with-broker-trigger/README.md index 5bc5b15d401..b8bc7282c31 100644 --- a/docs/eventing/samples/sequence/sequence-with-broker-trigger/README.md +++ b/docs/eventing/samples/sequence/sequence-with-broker-trigger/README.md @@ -89,9 +89,10 @@ kubectl -n default create -f ./steps.yaml ### Create the Sequence -Here, if you are using different type of Channel, you need to change the -spec.channelTemplate to point to your desired Channel. Also, change the -spec.reply.name to point to your `Broker` +The `sequence.yaml` file contains the specifications for creating the Sequence. If you are using a different type of Channel, +you need to change the spec.channelTemplate to point to your desired Channel. + +Also, change the spec.reply.name to point to your `Broker` ```yaml apiVersion: messaging.knative.dev/v1alpha1 @@ -131,6 +132,9 @@ kubectl -n default create -f ./sequence.yaml ### Create the CronJobSource targeting the Broker +This will create a CronJobSource which will send a CloudEvent with {"message": "Hello world!"} as +the data payload every 2 minutes. + ```yaml apiVersion: sources.eventing.knative.dev/v1alpha1 kind: CronJobSource diff --git a/docs/eventing/sequence.md b/docs/eventing/sequence.md index 104820d4130..9a1c1d788be 100644 --- a/docs/eventing/sequence.md +++ b/docs/eventing/sequence.md @@ -4,8 +4,9 @@ weight: 20 type: "docs" --- -Sequence CRD provides a way to define a an in-order list of functions that will -be invoked. Sequence creates `Channel`s and `Subscription`s under the hood. +Sequence CRD provides a way to define an in-order list of functions that will +be invoked. Each step can modify, filter or create a new kind of an event. +Sequence creates `Channel`s and `Subscription`s under the hood. ## Usage @@ -41,7 +42,7 @@ to this address will target the `Channel` which is fronting the first Step in th ## Examples For each of these examples below, we'll use -[`CronJobSource`](https://knative.dev/v0.4-docs/reference/eventing/eventing-sources-api/#CronJobSource) +[`CronJobSource`](https://knative.dev/docs/eventing/samples/cronjob-source/) as the source of events. We also use a very simple [transformer](https://github.com/vaikas-google/transformer) which From ab11ab04428e3ae4c003110b01dd3595bcfc942a Mon Sep 17 00:00:00 2001 From: Ville Aikas Date: Tue, 25 Jun 2019 14:42:34 +0300 Subject: [PATCH 12/12] move overview before prerequisites, add link to main sequence page --- .../sequence-reply-to-event-display/README.md | 16 +++++++------- .../sequence-reply-to-sequence/README.md | 16 +++++++------- .../sequence/sequence-terminal/README.md | 16 +++++++------- .../sequence-with-broker-trigger/README.md | 22 +++++++++---------- 4 files changed, 35 insertions(+), 35 deletions(-) diff --git a/docs/eventing/samples/sequence/sequence-reply-to-event-display/README.md b/docs/eventing/samples/sequence/sequence-reply-to-event-display/README.md index 2944e87dc47..22f34ef52b9 100644 --- a/docs/eventing/samples/sequence/sequence-reply-to-event-display/README.md +++ b/docs/eventing/samples/sequence/sequence-reply-to-event-display/README.md @@ -6,6 +6,14 @@ type: "docs" # Using Sequences in series +## Overview + +We are going to create the following logical configuration. We create a CronJobSource, +feeding events to a (`Sequence`)[../../../sequence.md], then taking the output of that `Sequence` and +displaying the resulting output. + +![Logical Configuration](./sequence-reply-to-event-display.png) + ## Prerequisites For this example, we'll assume you have set up an `InMemoryChannel` @@ -16,14 +24,6 @@ to modify the examples to reflect this. If you want to use different type of `Channel`, you will have to modify the `Sequence.Spec.ChannelTemplate` to create the appropriate Channel resources. -## Overview - -We are going to create the following logical configuration. We create a CronJobSource, -feeding events to a `Sequence`, then taking the output of that `Sequence` and -displaying the resulting output. - -![Logical Configuration](./sequence-reply-to-event-display.png) - ## Setup diff --git a/docs/eventing/samples/sequence/sequence-reply-to-sequence/README.md b/docs/eventing/samples/sequence/sequence-reply-to-sequence/README.md index 85e6d9d1009..c8df7864239 100644 --- a/docs/eventing/samples/sequence/sequence-reply-to-sequence/README.md +++ b/docs/eventing/samples/sequence/sequence-reply-to-sequence/README.md @@ -6,6 +6,14 @@ type: "docs" # Using Sequences in series +## Overview + +We are going to create the following logical configuration. We create a CronJobSource, +feeding events to a (`Sequence`)[../../../sequence.md], then taking the output of that `Sequence` and sending +it to a second `Sequence` and finally displaying the resulting output. + +![Logical Configuration](./sequence-reply-to-sequence.png) + ## Prerequisites For this example, we'll assume you have set up a an `InMemoryChannel` @@ -16,14 +24,6 @@ modify the examples to reflect this. If you want to use different type of `Channel`, you will have to modify the `Sequence.Spec.ChannelTemplate` to create the appropriate Channel resources. -## Overview - -We are going to create the following logical configuration. We create a CronJobSource, -feeding events to a `Sequence`, then taking the output of that `Sequence` and sending -it to a second `Sequence` and finally displaying the resulting output. - -![Logical Configuration](./sequence-reply-to-sequence.png) - ## Setup diff --git a/docs/eventing/samples/sequence/sequence-terminal/README.md b/docs/eventing/samples/sequence/sequence-terminal/README.md index b63dbdf06d5..480ba84f356 100644 --- a/docs/eventing/samples/sequence/sequence-terminal/README.md +++ b/docs/eventing/samples/sequence/sequence-terminal/README.md @@ -5,6 +5,14 @@ type: "docs" # Using Sequences in series +## Overview + +We are going to create the following logical configuration. We create a CronJobSource, +feeding events to a (`Sequence`)[../../../sequence.md]. Sequence can then do either external work, or +out of band create additional events. + +![Logical Configuration](./sequence-terminal.png) + ## Prerequisites For this example, we'll assume you have set up an `InMemoryChannel` @@ -15,14 +23,6 @@ to modify the examples to reflect this. If you want to use different type of `Channel`, you will have to modify the `Sequence.Spec.ChannelTemplate` to create the appropriate Channel resources. -## Overview - -We are going to create the following logical configuration. We create a CronJobSource, -feeding events to a `Sequence`. Sequence can then do either external work, or -out of band create additional events. - -![Logical Configuration](./sequence-terminal.png) - ## Setup diff --git a/docs/eventing/samples/sequence/sequence-with-broker-trigger/README.md b/docs/eventing/samples/sequence/sequence-with-broker-trigger/README.md index b8bc7282c31..b139c185de9 100644 --- a/docs/eventing/samples/sequence/sequence-with-broker-trigger/README.md +++ b/docs/eventing/samples/sequence/sequence-with-broker-trigger/README.md @@ -6,21 +6,11 @@ type: "docs" # Using Sequence with Broker and Trigger -## Prerequisites - -For this example, we'll assume you have set up a `Broker` and an `InMemoryChannel` -as well as Knative Serving (for our functions). The examples use `default` -namespace, again, if your broker lives in another Namespace, you will need to -modify the examples to reflect this. - -If you want to use different type of `Channel`, you will have to modify the -`Sequence.Spec.ChannelTemplate` to create the appropriate Channel resources. - ## Overview We are going to create the following logical configuration. We create a CronJobSource, feeding events into the Broker, then we create a `Filter` that wires those events -into a Sequence consisting of 3 steps. Then we take the end of the Sequence and +into a (`Sequence`)[../../../sequence.md] consisting of 3 steps. Then we take the end of the Sequence and feed newly minted events back into the Broker and create another Trigger which will then display those events. @@ -28,6 +18,16 @@ will then display those events. So, currently as set up, the events emitted by the Sequence do not make it into the Broker. +## Prerequisites + +For this example, we'll assume you have set up a `Broker` and an `InMemoryChannel` +as well as Knative Serving (for our functions). The examples use `default` +namespace, again, if your broker lives in another Namespace, you will need to +modify the examples to reflect this. + +If you want to use different type of `Channel`, you will have to modify the +`Sequence.Spec.ChannelTemplate` to create the appropriate Channel resources. + ![Logical Configuration](./sequence-with-broker-trigger.png)