update flows samples to use v1 API (#2633)

This commit is contained in:
Lionel Villard 2020-07-09 10:00:07 -04:00 committed by GitHub
parent abebf6c447
commit a1fa60bdf5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 51 additions and 50 deletions

View File

@ -161,7 +161,7 @@ In addition to the sources explained below, there are
[other sources](./sources/README.md) that you can install.
If you need a Source not covered by the ones mentioned below nor by the other
[available implementations](./sources/README.md), there is a
[tutorial on writing a Source with a Receive Adapter](./samples/writing-receive-adapter-source/).
[tutorial on writing a Source with a Receive Adapter](./samples/writing-event-source).
If your code needs to send events as part of its business logic and doesn't fit
the model of a Source, consider

View File

@ -104,7 +104,7 @@ kubectl -n default create -f ./event-display.yaml
The `parallel.yaml` file contains the specifications for creating the Parallel.
```yaml
apiVersion: flows.knative.dev/v1beta1
apiVersion: flows.knative.dev/v1
kind: Parallel
metadata:
name: odd-even-parallel
@ -146,8 +146,8 @@ kubectl create -f ./parallel.yaml
### Create the PingSource targeting the Parallel
This will create a PingSource which will send a CloudEvent with `{"message":
"Even or odd?"}` as the data payload every minute.
This will create a PingSource which will send a CloudEvent with
`{"message": "Even or odd?"}` as the data payload every minute.
```yaml
apiVersion: sources.knative.dev/v1alpha2
@ -159,7 +159,7 @@ spec:
data: '{"message": "Even or odd?"}'
sink:
ref:
apiVersion: flows.knative.dev/v1alpha2
apiVersion: flows.knative.dev/v1
kind: Parallel
name: odd-even-parallel
```

View File

@ -1,4 +1,4 @@
apiVersion: flows.knative.dev/v1beta1
apiVersion: flows.knative.dev/v1
kind: Parallel
metadata:
name: odd-even-parallel

View File

@ -7,6 +7,6 @@ spec:
jsonData: '{"message": "Even or odd?"}'
sink:
ref:
apiVersion: flows.knative.dev/v1beta1
apiVersion: flows.knative.dev/v1
kind: Parallel
name: odd-even-parallel

View File

@ -2,10 +2,10 @@ In this example, we are going to see how we can create a Parallel with mutually
exclusive branches.
This example is the same as the
[multiple branches example](../multiple-branches/README.md) except that we are now
going to rely on the Knative
[switch](https://github.com/lionelvillard/knative-functions#switch) function
to provide a soft mutual exclusivity guarantee.
[multiple branches example](../multiple-branches/README.md) except that we are
now going to rely on the Knative
[switch](https://github.com/lionelvillard/knative-functions#switch) function to
provide a soft mutual exclusivity guarantee.
NOTE: this example must be deployed in the default namespace.
@ -89,10 +89,11 @@ kubectl -n default create -f ./event-display.yaml
### Create the Parallel object
The `parallel.yaml` file contains the specifications for creating the Parallel object.
The `parallel.yaml` file contains the specifications for creating the Parallel
object.
```yaml
apiVersion: flows.knative.dev/v1beta1
apiVersion: flows.knative.dev/v1
kind: Parallel
metadata:
name: me-odd-even-parallel
@ -128,8 +129,8 @@ kubectl create -f ./parallel.yaml
### Create the PingSource targeting the Parallel object
This will create a PingSource which will send a CloudEvent with `{"message":
"Even or odd?"}` as the data payload every minute.
This will create a PingSource which will send a CloudEvent with
`{"message": "Even or odd?"}` as the data payload every minute.
```yaml
apiVersion: sources.knative.dev/v1alpha2
@ -141,7 +142,7 @@ spec:
jsonData: '{"message": "Even or odd?"}'
sink:
ref:
apiVersion: flows.knative.dev/v1beta1
apiVersion: flows.knative.dev/v1
kind: Parallel
name: me-odd-even-parallel
```
@ -153,8 +154,8 @@ kubectl create -f ./ping-source.yaml
### Inspecting the results
You can now see the final output by inspecting the logs of the
`me-event-display` pods. Note that since we set the `PingSource` to emit
every minute, it might take some time for the events to show up in the logs.
`me-event-display` pods. Note that since we set the `PingSource` to emit every
minute, it might take some time for the events to show up in the logs.
Let's look at the `me-event-display` log:

View File

@ -7,6 +7,6 @@ spec:
jsonData: '{"message": "Even or odd?"}'
sink:
ref:
apiVersion: flows.knative.dev/v1beta1
apiVersion: flows.knative.dev/v1
kind: Parallel
name: me-odd-even-parallel

View File

@ -79,7 +79,7 @@ If you are using a different type of Channel, you need to change the
spec.channelTemplate to point to your desired Channel.
```yaml
apiVersion: flows.knative.dev/v1beta1
apiVersion: flows.knative.dev/v1
kind: Sequence
metadata:
name: sequence
@ -150,7 +150,7 @@ spec:
jsonData: '{"message": "Hello world!"}'
sink:
ref:
apiVersion: flows.knative.dev/v1beta1
apiVersion: flows.knative.dev/v1
kind: Sequence
name: sequence
```

View File

@ -7,6 +7,6 @@ spec:
jsonData: '{"message": "Hello world!"}'
sink:
ref:
apiVersion: flows.knative.dev/v1beta1
apiVersion: flows.knative.dev/v1
kind: Sequence
name: sequence

View File

@ -1,4 +1,4 @@
apiVersion: flows.knative.dev/v1beta1
apiVersion: flows.knative.dev/v1
kind: Sequence
metadata:
name: sequence

View File

@ -120,7 +120,7 @@ If you are using a different type of Channel, you need to change the
spec.channelTemplate to point to your desired Channel.
```yaml
apiVersion: flows.knative.dev/v1beta1
apiVersion: flows.knative.dev/v1
kind: Sequence
metadata:
name: first-sequence
@ -144,7 +144,7 @@ spec:
reply:
ref:
kind: Sequence
apiVersion: flows.knative.dev/v1beta1
apiVersion: flows.knative.dev/v1
name: second-sequence
```
@ -162,7 +162,7 @@ If you are using a different type of Channel, you need to change the
spec.channelTemplate to point to your desired Channel.
```yaml
apiVersion: flows.knative.dev/v1beta1
apiVersion: flows.knative.dev/v1
kind: Sequence
metadata:
name: second-sequence
@ -190,7 +190,6 @@ spec:
name: event-display
```
```shell
kubectl -n default create -f ./sequence2.yaml
```
@ -218,8 +217,8 @@ kubectl -n default create -f ./event-display.yaml
### Create the PingSource targeting the first Sequence
This will create a PingSource which will send a CloudEvent with `{"message":
"Hello world!"}` as the data payload every 2 minutes.
This will create a PingSource which will send a CloudEvent with
`{"message": "Hello world!"}` as the data payload every 2 minutes.
```yaml
apiVersion: sources.knative.dev/v1alpha2

View File

@ -7,6 +7,6 @@ spec:
jsonData: '{"message": "Hello world!"}'
sink:
ref:
apiVersion: flows.knative.dev/v1beta1
apiVersion: flows.knative.dev/v1
kind: Sequence
name: first-sequence

View File

@ -1,4 +1,4 @@
apiVersion: flows.knative.dev/v1beta1
apiVersion: flows.knative.dev/v1
kind: Sequence
metadata:
name: first-sequence

View File

@ -1,4 +1,4 @@
apiVersion: flows.knative.dev/v1beta1
apiVersion: flows.knative.dev/v1
kind: Sequence
metadata:
name: second-sequence

View File

@ -1,6 +1,7 @@
We are going to create the following logical configuration. We create a
CronJobSource, feeding events to a [`Sequence`](../../../flows/sequence.md). Sequence
can then do either external work, or out of band create additional events.
PingSource, feeding events to a [`Sequence`](../../../flows/sequence.md).
Sequence can then do either external work, or out of band create additional
events.
![Logical Configuration](./sequence-terminal.png)
@ -78,7 +79,7 @@ If you are using a different type of Channel, you need to change the
spec.channelTemplate to point to your desired Channel.
```yaml
apiVersion: flows.knative.dev/v1beta1
apiVersion: flows.knative.dev/v1
kind: Sequence
metadata:
name: sequence
@ -110,8 +111,8 @@ kubectl -n default create -f ./sequence.yaml
### Create the PingSource targeting the Sequence
This will create a PingSource which will send a CloudEvent with `{"message":
"Hello world!"}` as the data payload every 2 minutes.
This will create a PingSource which will send a CloudEvent with
`{"message": "Hello world!"}` as the data payload every 2 minutes.
```yaml
apiVersion: sources.knative.dev/v1alpha2
@ -123,7 +124,7 @@ spec:
jsonData: '{"message": "Hello world!"}'
sink:
ref:
apiVersion: flows.knative.dev/v1beta1
apiVersion: flows.knative.dev/v1
kind: Sequence
name: sequence
```
@ -138,8 +139,8 @@ kubectl -n default create -f ./ping-source.yaml
### Inspecting the results
You can now see the final output by inspecting the logs of the event-display
pods. Note that since we set the `PingSource` to emit every 2 minutes, it
might take some time for the events to show up in the logs.
pods. Note that since we set the `PingSource` 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

View File

@ -7,6 +7,6 @@ spec:
jsonData: '{"message": "Hello world!"}'
sink:
ref:
apiVersion: flows.knative.dev/v1beta1
apiVersion: flows.knative.dev/v1
kind: Sequence
name: sequence

View File

@ -1,4 +1,4 @@
apiVersion: flows.knative.dev/v1beta1
apiVersion: flows.knative.dev/v1
kind: Sequence
metadata:
name: sequence

View File

@ -6,10 +6,10 @@ into the Broker and create another Trigger which will then display those events.
## Prerequisites
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 your broker lives in another Namespace, you will need to modify the
examples to reflect this.
- Knative Serving
- `InMemoryChannel`
**NOTE:** The examples use the `default` namespace.
If you want to use different type of `Channel`, you will have to modify the
`Sequence.Spec.ChannelTemplate` to create the appropriate Channel resources.
@ -97,7 +97,7 @@ spec.channelTemplate to point to your desired Channel.
Also, change the spec.reply.name to point to your `Broker`
```yaml
apiVersion: flows.knative.dev/v1beta1
apiVersion: flows.knative.dev/v1
kind: Sequence
metadata:
name: sequence
@ -177,7 +177,7 @@ spec:
type: dev.knative.sources.ping
subscriber:
ref:
apiVersion: flows.knative.dev/v1beta1
apiVersion: flows.knative.dev/v1
kind: Sequence
name: sequence
```

View File

@ -1,4 +1,4 @@
apiVersion: flows.knative.dev/v1beta1
apiVersion: flows.knative.dev/v1
kind: Sequence
metadata:
name: sequence

View File

@ -9,6 +9,6 @@ spec:
type: dev.knative.sources.ping
subscriber:
ref:
apiVersion: flows.knative.dev/v1beta1
apiVersion: flows.knative.dev/v1
kind: Sequence
name: sequence