Skip to content

Commit 13414d2

Browse files
Flow v1beta1 (#2264)
* update example to use v1beta1 api * WIP: update flow doc to v1beta1 * update pictures * fix links
1 parent e144a1a commit 13414d2

24 files changed

+171
-209
lines changed

docs/eventing/samples/sequence/sequence-reply-to-event-display/README.md

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ type: "docs"
66
---
77

88
We are going to create the following logical configuration. We create a
9-
CronJobSource, feeding events to a [`Sequence`](../../../sequence.md), then
9+
PingSource, feeding events to a [`Sequence`](../../../flows/sequence.md), then
1010
taking the output of that `Sequence` and displaying the resulting output.
1111

1212
![Logical Configuration](./sequence-reply-to-event-display.png)
@@ -86,13 +86,13 @@ If you are using a different type of Channel, you need to change the
8686
spec.channelTemplate to point to your desired Channel.
8787

8888
```yaml
89-
apiVersion: flows.knative.dev/v1alpha1
89+
apiVersion: flows.knative.dev/v1beta1
9090
kind: Sequence
9191
metadata:
9292
name: sequence
9393
spec:
9494
channelTemplate:
95-
apiVersion: messaging.knative.dev/v1alpha1
95+
apiVersion: messaging.knative.dev/v1beta1
9696
kind: InMemoryChannel
9797
steps:
9898
- ref:
@@ -142,28 +142,28 @@ your resources to be created.
142142
kubectl -n default create -f ./event-display.yaml
143143
```
144144

145-
### Create the CronJobSource targeting the Sequence
145+
### Create the PingSource targeting the Sequence
146146

147-
This will create a CronJobSource which will send a CloudEvent with {"message":
147+
This will create a PingSource which will send a CloudEvent with {"message":
148148
"Hello world!"} as the data payload every 2 minutes.
149149

150150
```yaml
151-
apiVersion: sources.eventing.knative.dev/v1alpha1
152-
kind: CronJobSource
151+
apiVersion: sources.knative.dev/v1alpha1
152+
kind: PingSource
153153
metadata:
154-
name: cronjob-source
154+
name: ping-source
155155
spec:
156156
schedule: "*/2 * * * *"
157157
data: '{"message": "Hello world!"}'
158158
sink:
159159
ref:
160-
apiVersion: flows.knative.dev/v1alpha1
160+
apiVersion: flows.knative.dev/v1beta1
161161
kind: Sequence
162162
name: sequence
163163
```
164164

165165
```shell
166-
kubectl -n default create -f ./cron-source.yaml
166+
kubectl -n default create -f ./ping-source.yaml
167167
```
168168

169169
### Inspecting the results
@@ -175,25 +175,28 @@ pods.
175175
kubectl -n default get pods
176176
```
177177

178-
Then look at the logs for the event-display pod:
178+
Wait a bit and then look at the logs for the event-display pod:
179179

180180
```shell
181-
kubectl -n default logs -l serving.knative.dev/service=event-display -c user-container
181+
kubectl -n default logs -l serving.knative.dev/service=event-display -c user-container --tail=-1
182182
☁️ cloudevents.Event
183183
Validation: valid
184184
Context Attributes,
185-
cloudEventsVersion: 0.1
186-
eventType: samples.http.mod3
187-
source: /transformer/2
188-
eventID: df52b47e-02fd-45b2-8180-dabb572573f5
189-
eventTime: 2019-06-18T14:18:42.478140635Z
190-
contentType: application/json
185+
specversion: 1.0
186+
type: samples.http.mode3
187+
source: /apis/v1/namespaces/default/pingsources/ping-source
188+
id: e8fa7906-ab62-4e61-9c13-a9406e2130a9
189+
time: 2020-03-02T20:52:00.0004957Z
190+
datacontenttype: application/json
191+
Extensions,
192+
knativehistory: sequence-kn-sequence-0-kn-channel.default.svc.cluster.local; sequence-kn-sequence-1-kn-channel.default.svc.cluster.local; sequence-kn-sequence-2-kn-channel.default.svc.cluster.local
193+
traceparent: 00-6e2947379387f35ddc933b9190af16ad-de3db0bc4e442394-00
191194
Data,
192195
{
193196
"id": 0,
194197
"message": "Hello world! - Handled by 0 - Handled by 1 - Handled by 2"
195198
}
196199
```
197200

198-
And you can see that the initial Cron Source message ("Hello World!") has been
201+
And you can see that the initial PingSource message `("Hello World!")` has been
199202
appended to it by each of the steps in the Sequence.

docs/eventing/samples/sequence/sequence-reply-to-event-display/event-display.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ spec:
66
template:
77
spec:
88
containers:
9-
- image: gcr.io/knative-releases/knative.dev/eventing-sources/cmd/event_display
9+
- image: gcr.io/knative-releases/knative.dev/eventing-contrib/cmd/event_display
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
apiVersion: sources.eventing.knative.dev/v1alpha1
2-
kind: CronJobSource
1+
apiVersion: sources.knative.dev/v1alpha1
2+
kind: PingSource
33
metadata:
4-
name: cronjob-source
4+
name: ping-source
55
spec:
66
schedule: "*/2 * * * *"
77
data: '{"message": "Hello world!"}'
88
sink:
99
ref:
10-
apiVersion: flows.knative.dev/v1alpha1
10+
apiVersion: flows.knative.dev/v1beta1
1111
kind: Sequence
1212
name: sequence
6.63 KB
Loading

docs/eventing/samples/sequence/sequence-reply-to-event-display/sequence.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
apiVersion: flows.knative.dev/v1alpha1
1+
apiVersion: flows.knative.dev/v1beta1
22
kind: Sequence
33
metadata:
44
name: sequence
55
spec:
66
channelTemplate:
7-
apiVersion: messaging.knative.dev/v1alpha1
7+
apiVersion: messaging.knative.dev/v1beta1
88
kind: InMemoryChannel
99
steps:
1010
- ref:

docs/eventing/samples/sequence/sequence-reply-to-event-display/steps.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,6 @@ spec:
3737
env:
3838
- name: MESSAGE
3939
value: " - Handled by 2"
40+
- name: TYPE
41+
value: "samples.http.mod3"
4042
---

docs/eventing/samples/sequence/sequence-reply-to-sequence/README.md

Lines changed: 32 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ type: "docs"
66
---
77

88
We are going to create the following logical configuration. We create a
9-
CronJobSource, feeding events to a [`Sequence`](../../../sequence.md), then
9+
PingSource, feeding events to a [`Sequence`](../../../flows/sequence.md), then
1010
taking the output of that `Sequence` and sending it to a second `Sequence` and
1111
finally displaying the resulting output.
1212

@@ -17,9 +17,9 @@ The functions used in these examples live in
1717

1818
## Prerequisites
1919

20-
For this example, we'll assume you have set up a an `InMemoryChannel` as well as
20+
For this example, we'll assume you have set up an `InMemoryChannel` as well as
2121
Knative Serving (for our functions). The examples use `default` namespace,
22-
again, if you want to deploy to another Namespace, you will need to modify the
22+
again, if you want to deploy to another namespace, you will need to modify the
2323
examples to reflect this.
2424

2525
If you want to use different type of `Channel`, you will have to modify the
@@ -127,13 +127,13 @@ If you are using a different type of Channel, you need to change the
127127
spec.channelTemplate to point to your desired Channel.
128128

129129
```yaml
130-
apiVersion: flows.knative.dev/v1alpha1
130+
apiVersion: flows.knative.dev/v1beta1
131131
kind: Sequence
132132
metadata:
133133
name: first-sequence
134134
spec:
135135
channelTemplate:
136-
apiVersion: messaging.knative.dev/v1alpha1
136+
apiVersion: messaging.knative.dev/v1beta1
137137
kind: InMemoryChannel
138138
steps:
139139
- ref:
@@ -169,13 +169,13 @@ If you are using a different type of Channel, you need to change the
169169
spec.channelTemplate to point to your desired Channel.
170170

171171
```yaml
172-
apiVersion: flows.knative.dev/v1alpha1
172+
apiVersion: flows.knative.dev/v1beta1
173173
kind: Sequence
174174
metadata:
175175
name: second-sequence
176176
spec:
177177
channelTemplate:
178-
apiVersion: messaging.knative.dev/v1alpha1
178+
apiVersion: messaging.knative.dev/v1beta1
179179
kind: InMemoryChannel
180180
steps:
181181
- ref:
@@ -197,6 +197,11 @@ spec:
197197
name: event-display
198198
```
199199

200+
201+
```shell
202+
kubectl -n default create -f ./sequence2.yaml
203+
```
204+
200205
### Create the Service displaying the events created by Sequence
201206

202207
```yaml
@@ -208,7 +213,7 @@ spec:
208213
template:
209214
spec:
210215
containerers:
211-
- image: gcr.io/knative-releases/knative.dev/eventing-sources/cmd/event_display
216+
- image: gcr.io/knative-releases/knative.dev/eventing-contrib/cmd/event_display
212217
```
213218

214219
Change `default` below to create the `Sequence` in the Namespace where you want
@@ -218,28 +223,28 @@ your resources created.
218223
kubectl -n default create -f ./event-display.yaml
219224
```
220225

221-
### Create the CronJobSource targeting the first Sequence
226+
### Create the PingSource targeting the first Sequence
222227

223-
This will create a CronJobSource which will send a CloudEvent with {"message":
224-
"Hello world!"} as the data payload every 2 minutes.
228+
This will create a PingSource which will send a CloudEvent with `{"message":
229+
"Hello world!"}` as the data payload every 2 minutes.
225230

226231
```yaml
227-
apiVersion: sources.eventing.knative.dev/v1alpha1
228-
kind: CronJobSource
232+
apiVersion: sources.knative.dev/v1alpha1
233+
kind: PingSource
229234
metadata:
230-
name: cronjob-source
235+
name: ping-source
231236
spec:
232237
schedule: "*/2 * * * *"
233238
data: '{"message": "Hello world!"}'
234239
sink:
235240
ref:
236-
apiVersion: flows.knative.dev/v1alpha1
241+
apiVersion: flows.knative.dev/v1beta1
237242
kind: Sequence
238243
name: first-sequence
239244
```
240245

241246
```shell
242-
kubectl -n default create -f ./cron-source.yaml
247+
kubectl -n default create -f ./ping-source.yaml
243248
```
244249

245250
### Inspecting the results
@@ -254,22 +259,25 @@ kubectl -n default get pods
254259
Then look at the logs for the event-display pod:
255260

256261
```shell
257-
kubectl -n default logs -l serving.knative.dev/service=event-display -c user-container
262+
kubectl -n default logs -l serving.knative.dev/service=event-display -c user-container --tail=-1
258263
☁️ cloudevents.Event
259264
Validation: valid
260265
Context Attributes,
261-
cloudEventsVersion: 0.1
262-
eventType: samples.http.mod3
263-
source: /transformer/5
264-
eventID: 7628a147-ec74-43d5-a888-8384a1b6b005
265-
eventTime: 2019-06-18T13:57:20.279354375Z
266-
contentType: application/json
266+
specversion: 1.0
267+
type: dev.knative.sources.ping
268+
source: /apis/v1/namespaces/default/pingsources/ping-source
269+
id: 29d531df-78d8-4d11-9ffd-ba24045241a9
270+
time: 2020-03-02T21:18:00.0011708Z
271+
datacontenttype: application/json
272+
Extensions,
273+
knativehistory: first-sequence-kn-sequence-0-kn-channel.default.svc.cluster.local; first-sequence-kn-sequence-1-kn-channel.default.svc.cluster.local; first-sequence-kn-sequence-2-kn-channel.default.svc.cluster.local; second-sequence-kn-sequence-0-kn-channel.default.svc.cluster.local; second-sequence-kn-sequence-1-kn-channel.default.svc.cluster.local; second-sequence-kn-sequence-2-kn-channel.default.svc.cluster.local
274+
traceparent: 00-e5abc9de525a89ead80560b8f328de5c-fc12b64a6296f541-00
267275
Data,
268276
{
269277
"id": 0,
270278
"message": "Hello world! - Handled by 0 - Handled by 1 - Handled by 2 - Handled by 3 - Handled by 4 - Handled by 5"
271279
}
272280
```
273281

274-
And you can see that the initial Cron Source message ("Hello World!") has been
282+
And you can see that the initial PingSource message `("Hello World!")` has been
275283
appended to it by each of the steps in the Sequence.

docs/eventing/samples/sequence/sequence-reply-to-sequence/event-display.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ spec:
66
template:
77
spec:
88
containers:
9-
- image: gcr.io/knative-releases/knative.dev/eventing-sources/cmd/event_display
9+
- image: gcr.io/knative-releases/knative.dev/eventing-contrib/cmd/event_display
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
apiVersion: sources.eventing.knative.dev/v1alpha1
2-
kind: CronJobSource
1+
apiVersion: sources.knative.dev/v1alpha1
2+
kind: PingSource
33
metadata:
4-
name: cronjob-source
4+
name: ping-source
55
spec:
66
schedule: "*/2 * * * *"
77
data: '{"message": "Hello world!"}'
88
sink:
99
ref:
10-
apiVersion: flows.knative.dev/v1alpha1
10+
apiVersion: flows.knative.dev/v1beta1
1111
kind: Sequence
1212
name: first-sequence
7.85 KB
Loading

0 commit comments

Comments
 (0)