mirror of https://github.com/knative/docs.git
Format markdown (#1647)
Produced via: `prettier --write --prose-wrap=always $(find -name '*.md' | grep -v vendor | grep -v .github)` /assign @samodell
This commit is contained in:
parent
f8670df188
commit
772552dbb7
|
@ -16,24 +16,26 @@ Choice creates `Channel`s and `Subscription`s under the hood.
|
|||
|
||||
Choice has three parts for the Spec:
|
||||
|
||||
1. `cases` defines the list of `filter` and `subscriber` pairs, one per
|
||||
branch, and optionally a `reply` object. For each branch:
|
||||
1. the `filter` is evaluated and when it returns an event the `subscriber` is executed.
|
||||
Both `filter` and `subscriber` must be `Callable`.
|
||||
1. the event returned by the `subscriber` is sent to the branch `reply` object. When
|
||||
the `reply` is empty, the event is sent to the `spec.reply` object (see below).
|
||||
1. (optional) `channelTemplate` defines the Template which will be used to create
|
||||
`Channel`s.
|
||||
1. (optional) `reply` defines where the result of each branch is sent to when the branch does
|
||||
not have its own `reply` object.
|
||||
1. `cases` defines the list of `filter` and `subscriber` pairs, one per branch,
|
||||
and optionally a `reply` object. For each branch:
|
||||
1. the `filter` is evaluated and when it returns an event the `subscriber` is
|
||||
executed. Both `filter` and `subscriber` must be `Callable`.
|
||||
1. the event returned by the `subscriber` is sent to the branch `reply`
|
||||
object. When the `reply` is empty, the event is sent to the `spec.reply`
|
||||
object (see below).
|
||||
1. (optional) `channelTemplate` defines the Template which will be used to
|
||||
create `Channel`s.
|
||||
1. (optional) `reply` defines where the result of each branch is sent to when
|
||||
the branch does not have its own `reply` object.
|
||||
|
||||
### Choice Status
|
||||
|
||||
Choice has three parts for the Status:
|
||||
|
||||
1. Conditions which detail the overall Status of the Choice object
|
||||
1. IngressChannelStatus and CaseStatuses which convey the Status
|
||||
of underlying `Channel` and `Subscription` resource that are created as part of this Choice.
|
||||
1. IngressChannelStatus and CaseStatuses which convey the Status of underlying
|
||||
`Channel` and `Subscription` resource that are created as part of this
|
||||
Choice.
|
||||
1. AddressStatus which is exposed so that Choice can be used where Addressable
|
||||
can be used. Sending to this address will target the `Channel` which is
|
||||
fronting this Choice (same as `IngressChannelStatus`).
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
The following examples will help you understand how to use Choice
|
||||
to describe various flows.
|
||||
The following examples will help you understand how to use Choice to describe
|
||||
various flows.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
All examples require:
|
||||
- A Kubernetes cluster with
|
||||
- Knative Eventing v0.8+
|
||||
- Knative Service v0.8+
|
||||
|
||||
All examples are using the [default channel template](../../channels/default-channels.md).
|
||||
- A Kubernetes cluster with
|
||||
- Knative Eventing v0.8+
|
||||
- Knative Service v0.8+
|
||||
|
||||
All examples are using the
|
||||
[default channel template](../../channels/default-channels.md).
|
||||
|
||||
## Examples
|
||||
|
||||
|
@ -16,10 +18,10 @@ For each of these examples below, we'll use
|
|||
[`CronJobSource`](../cronjob-source/README.md) as the source of events.
|
||||
|
||||
We also use simple
|
||||
[functions](https://github.com/lionelvillard/knative-functions) to perform trivial filtering, transformation and routing of the incoming events.
|
||||
[functions](https://github.com/lionelvillard/knative-functions) to perform
|
||||
trivial filtering, transformation and routing of the incoming events.
|
||||
|
||||
The examples are:
|
||||
|
||||
- [Choice with multiple cases and global reply](./multiple-cases/README.md)
|
||||
- [Choice with mutually exclusive cases](./mutual-exclusivity/README.md)
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
We are going to create a Choice with two cases:
|
||||
|
||||
- the first case accepts events with a time that is is even
|
||||
- the second case accepts events with a time that is is odd
|
||||
|
||||
|
@ -10,7 +11,8 @@ Please refer to the sample overview for the [prerequisites](../README.md).
|
|||
|
||||
### Create the Knative Services
|
||||
|
||||
Let's first create the filter and transformer services that we will use in our Choice.
|
||||
Let's first create the filter and transformer services that we will use in our
|
||||
Choice.
|
||||
|
||||
```yaml
|
||||
apiVersion: serving.knative.dev/v1alpha1
|
||||
|
@ -90,26 +92,26 @@ spec:
|
|||
apiVersion: messaging.knative.dev/v1alpha1
|
||||
kind: InMemoryChannel
|
||||
cases:
|
||||
- filter:
|
||||
ref:
|
||||
apiVersion: serving.knative.dev/v1alpha1
|
||||
kind: Service
|
||||
name: even-filter
|
||||
subscriber:
|
||||
ref:
|
||||
apiVersion: serving.knative.dev/v1alpha1
|
||||
kind: Service
|
||||
name: even-transformer
|
||||
- filter:
|
||||
ref:
|
||||
apiVersion: serving.knative.dev/v1alpha1
|
||||
kind: Service
|
||||
name: odd-filter
|
||||
subscriber:
|
||||
ref:
|
||||
apiVersion: serving.knative.dev/v1alpha1
|
||||
kind: Service
|
||||
name: odd-transformer
|
||||
- filter:
|
||||
ref:
|
||||
apiVersion: serving.knative.dev/v1alpha1
|
||||
kind: Service
|
||||
name: even-filter
|
||||
subscriber:
|
||||
ref:
|
||||
apiVersion: serving.knative.dev/v1alpha1
|
||||
kind: Service
|
||||
name: even-transformer
|
||||
- filter:
|
||||
ref:
|
||||
apiVersion: serving.knative.dev/v1alpha1
|
||||
kind: Service
|
||||
name: odd-filter
|
||||
subscriber:
|
||||
ref:
|
||||
apiVersion: serving.knative.dev/v1alpha1
|
||||
kind: Service
|
||||
name: odd-transformer
|
||||
reply:
|
||||
apiVersion: serving.knative.dev/v1alpha1
|
||||
kind: Service
|
||||
|
@ -146,8 +148,8 @@ kubectl create -f ./cron-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 `CronJobSource` to emit every minute, it
|
||||
might take some time for the events to show up in the logs.
|
||||
pods. Note that since we set the `CronJobSource` to emit every minute, it might
|
||||
take some time for the events to show up in the logs.
|
||||
|
||||
Let's look at the `event-display` log:
|
||||
|
||||
|
@ -184,4 +186,4 @@ Data,
|
|||
{
|
||||
"message": "this is odd!"
|
||||
}
|
||||
```
|
||||
```
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
In this example, we are going to see how we can create a Choice
|
||||
with mutually exclusive cases.
|
||||
In this example, we are going to see how we can create a Choice with mutually
|
||||
exclusive cases.
|
||||
|
||||
This example is the same as the [multiple cases example](../multiple-cases/README.md) except
|
||||
that we are now going to rely on the Knative [switcher](https://github.com/lionelvillard/knative-functions#switcher) function to provide a soft mutual exclusivity guarantee.
|
||||
This example is the same as the
|
||||
[multiple cases example](../multiple-cases/README.md) except that we are now
|
||||
going to rely on the Knative
|
||||
[switcher](https://github.com/lionelvillard/knative-functions#switcher) function
|
||||
to provide a soft mutual exclusivity guarantee.
|
||||
|
||||
NOTE: this example has to be deployed in the default namespace.
|
||||
|
||||
|
@ -12,7 +15,8 @@ Please refer to the sample overview for the [prerequisites](../README.md).
|
|||
|
||||
### Create the Knative Services
|
||||
|
||||
Let's first create the switcher and transformer services that we will use in our Choice.
|
||||
Let's first create the switcher and transformer services that we will use in our
|
||||
Choice.
|
||||
|
||||
```yaml
|
||||
apiVersion: serving.knative.dev/v1alpha1
|
||||
|
@ -79,20 +83,20 @@ spec:
|
|||
apiVersion: messaging.knative.dev/v1alpha1
|
||||
kind: InMemoryChannel
|
||||
cases:
|
||||
- filter:
|
||||
uri: "http://me-even-odd-switcher.default.svc.cluster.local/0"
|
||||
subscriber:
|
||||
ref:
|
||||
apiVersion: serving.knative.dev/v1alpha1
|
||||
kind: Service
|
||||
name: me-even-transformer
|
||||
- filter:
|
||||
uri: "http://me-even-odd-switcher.default.svc.cluster.local/1"
|
||||
subscriber:
|
||||
ref:
|
||||
apiVersion: serving.knative.dev/v1alpha1
|
||||
kind: Service
|
||||
name: me-odd-transformer
|
||||
- filter:
|
||||
uri: "http://me-even-odd-switcher.default.svc.cluster.local/0"
|
||||
subscriber:
|
||||
ref:
|
||||
apiVersion: serving.knative.dev/v1alpha1
|
||||
kind: Service
|
||||
name: me-even-transformer
|
||||
- filter:
|
||||
uri: "http://me-even-odd-switcher.default.svc.cluster.local/1"
|
||||
subscriber:
|
||||
ref:
|
||||
apiVersion: serving.knative.dev/v1alpha1
|
||||
kind: Service
|
||||
name: me-odd-transformer
|
||||
reply:
|
||||
apiVersion: serving.knative.dev/v1alpha1
|
||||
kind: Service
|
||||
|
@ -128,9 +132,9 @@ kubectl create -f ./cron-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 `CronJobSource` to emit every minute, it
|
||||
might take some time for the events to show up in the logs.
|
||||
You can now see the final output by inspecting the logs of the
|
||||
`me-event-display` pods. Note that since we set the `CronJobSource` 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:
|
||||
|
||||
|
@ -168,4 +172,3 @@ Data,
|
|||
"message": "this is odd!"
|
||||
}
|
||||
```
|
||||
|
||||
|
|
|
@ -39,10 +39,10 @@ spec:
|
|||
template:
|
||||
spec:
|
||||
containers:
|
||||
- image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:2656f39a7fcb6afd9fc79e7a4e215d14d651dc674f38020d1d18c6f04b220700
|
||||
env:
|
||||
- name: STEP
|
||||
value: "0"
|
||||
- image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:2656f39a7fcb6afd9fc79e7a4e215d14d651dc674f38020d1d18c6f04b220700
|
||||
env:
|
||||
- name: STEP
|
||||
value: "0"
|
||||
|
||||
---
|
||||
apiVersion: serving.knative.dev/v1alpha1
|
||||
|
@ -53,10 +53,10 @@ spec:
|
|||
template:
|
||||
spec:
|
||||
containers:
|
||||
- image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:2656f39a7fcb6afd9fc79e7a4e215d14d651dc674f38020d1d18c6f04b220700
|
||||
env:
|
||||
- name: STEP
|
||||
value: "1"
|
||||
- image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:2656f39a7fcb6afd9fc79e7a4e215d14d651dc674f38020d1d18c6f04b220700
|
||||
env:
|
||||
- name: STEP
|
||||
value: "1"
|
||||
---
|
||||
apiVersion: serving.knative.dev/v1alpha1
|
||||
kind: Service
|
||||
|
@ -66,12 +66,13 @@ spec:
|
|||
template:
|
||||
spec:
|
||||
containers:
|
||||
- image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:2656f39a7fcb6afd9fc79e7a4e215d14d651dc674f38020d1d18c6f04b220700
|
||||
env:
|
||||
- name: STEP
|
||||
value: "2"
|
||||
- image: us.gcr.io/probable-summer-223122/cmd-03315b715ae8f3e08e3a9378df706fbb@sha256:2656f39a7fcb6afd9fc79e7a4e215d14d651dc674f38020d1d18c6f04b220700
|
||||
env:
|
||||
- name: STEP
|
||||
value: "2"
|
||||
|
||||
---
|
||||
|
||||
```
|
||||
|
||||
```shell
|
||||
|
|
|
@ -48,8 +48,8 @@ Kubernetes cluster has access to. See
|
|||
[Setting Up A Logging Plugin](./setting-up-a-logging-plugin.md) for details.
|
||||
|
||||
> **NOTE**: Operators must add the credentials file the Stackdriver agent needs
|
||||
> to the Docker image if their Knative Serving is not built on a
|
||||
> Google Cloud Platform-based cluster or if they want to send logs to another
|
||||
> Google Cloud Platform project. See
|
||||
> to the Docker image if their Knative Serving is not built on a Google Cloud
|
||||
> Platform-based cluster or if they want to send logs to another Google Cloud
|
||||
> Platform project. See
|
||||
> [here](https://cloud.google.com/logging/docs/agent/authorization) for more
|
||||
> information.
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -78,7 +78,8 @@ If you need a new TLS certificate, you can choose to use one of the following
|
|||
tools to obtain a certificate from Let's Encrypt:
|
||||
|
||||
- Setup Certbot to manually obtain Let's Encrypt certificates
|
||||
- Setup cert-manager to either manually obtain a certificate, or to automatically provision certificates
|
||||
- Setup cert-manager to either manually obtain a certificate, or to
|
||||
automatically provision certificates
|
||||
|
||||
This page covers details for both of the above options.
|
||||
|
||||
|
|
Loading…
Reference in New Issue