Skip to content

Commit

Permalink
docs: Fixed markdown (#2047)
Browse files Browse the repository at this point in the history
Signed-off-by: koki-develop <[email protected]>
  • Loading branch information
koki-develop authored and whynowy committed Sep 10, 2022
1 parent d7d86ba commit 730b2e0
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 74 deletions.
26 changes: 10 additions & 16 deletions docs/eventsources/setup/gcp-pub-sub.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,32 +40,26 @@ GCP Pub/Sub event-source specification is available [here](https://github.com/ar

1. Create a K8s secret called `gcp-credentials` to store the credentials file.

```yaml
apiVersion: v1
data:
key.json: <YOUR_CREDENTIALS_STRING_FROM_JSON_FILE>
kind: Secret
metadata:
name: gcp-credentials
namespace: argo-events
type: Opaque
```
apiVersion: v1
data:
key.json: <YOUR_CREDENTIALS_STRING_FROM_JSON_FILE>
kind: Secret
metadata:
name: gcp-credentials
namespace: argo-events
type: Opaque

1. Create the event source by running the following command.

```sh
kubectl apply -n argo-events -f https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/event-sources/gcp-pubsub.yaml
```
kubectl apply -n argo-events -f https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/event-sources/gcp-pubsub.yaml

If you use Workload Identity, omit `credentialSecret` field. Instead don't forget to configure appropriate service account (see [example](https://github.com/argoproj/argo-events/blob/stable/examples/event-sources/gcp-pubsub.yaml)).

1. Inspect the event-source pod logs to make sure it was able to subscribe to the topic.

1. Create the sensor by running the following command.

```sh
kubectl apply -n argo-events -f https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/sensors/gcp-pubsub.yaml
```
kubectl apply -n argo-events -f https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/sensors/gcp-pubsub.yaml

1. Publish a message from GCP Pub/Sub console.

Expand Down
3 changes: 2 additions & 1 deletion docs/eventsources/setup/redis-streams.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ The structure of an event dispatched by the event-source over the eventbus looks
}

Example:

{
"context": {
"id": "64313638396337352d623565612d343639302d383262362d306630333562333437363637",
Expand Down Expand Up @@ -77,4 +78,4 @@ Redis stream event-source specification is available [here](https://github.com/a

Redis stream event source expects all the streams to be present on redis server. It only starts pulling messages from the streams when all of the specified streams exist on the redis server.

Please read the [FAQ](https://argoproj.github.io/argo-events/FAQ/).
Please read the [FAQ](https://argoproj.github.io/argo-events/FAQ/).
12 changes: 3 additions & 9 deletions docs/sensors/filters/ctx.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,21 +67,15 @@ spec:

1. Create a webhook event-source

```bash
kubectl -n argo-events apply -f https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/event-sources/webhook.yaml
```
kubectl -n argo-events apply -f https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/event-sources/webhook.yaml

1. Create a webhook sensor with context filter

```bash
kubectl -n argo-events apply -f https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/sensors/filter-with-context.yaml
```
kubectl -n argo-events apply -f https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/sensors/filter-with-context.yaml

1. Send an HTTP request to event-source

```bash
curl -d '{"message":"this is my first webhook"}' -H "Content-Type: application/json" -X POST http://localhost:12000/example
```
curl -d '{"message":"this is my first webhook"}' -H "Content-Type: application/json" -X POST http://localhost:12000/example

1. You will notice in sensor logs that the event is invalid as the sensor expects `custom-webhook` as the value of the `source`

Expand Down
16 changes: 4 additions & 12 deletions docs/sensors/filters/data.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,29 +177,21 @@ The message `'{"message":"aGVsbG8gd29ybGQ="}'` will match with the above filter

1. Create a webhook event-source

```bash
kubectl -n argo-events apply -f https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/event-sources/webhook.yaml
```
kubectl -n argo-events apply -f https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/event-sources/webhook.yaml

1. Create a webhook sensor with data filter

```bash
kubectl -n argo-events apply -f https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/sensors/filter-with-data-simple-1.yaml
```
kubectl -n argo-events apply -f https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/sensors/filter-with-data-simple-1.yaml

1. Send an HTTP request to event-source

```bash
curl -d '{"message":"this is my first webhook"}' -H "Content-Type: application/json" -X POST http://localhost:12000/example
```
curl -d '{"message":"this is my first webhook"}' -H "Content-Type: application/json" -X POST http://localhost:12000/example

1. You will notice in sensor logs that the event is invalid as it expects for either `hello` or `hey` as the value of `body.message`

1. Send another HTTP request to event-source

```bash
curl -d '{"message":"hello"}' -H "Content-Type: application/json" -X POST http://localhost:12000/example
```
curl -d '{"message":"hello"}' -H "Content-Type: application/json" -X POST http://localhost:12000/example

1. Look for a workflow with name starting with `data-workflow-`

Expand Down
16 changes: 4 additions & 12 deletions docs/sensors/filters/expr.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,29 +107,21 @@ To discover all options offered by govaluate, take a look at its [manual](https:

1. Create a webhook event-source

```bash
kubectl -n argo-events apply -f https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/event-sources/webhook.yaml
```
kubectl -n argo-events apply -f https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/event-sources/webhook.yaml

1. Create a webhook sensor with expr filter

```bash
kubectl -n argo-events apply -f https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/sensors/filter-with-expressions.yaml
```
kubectl -n argo-events apply -f https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/sensors/filter-with-expressions.yaml

1. Send an HTTP request to event-source

```bash
curl -d '{ "a": "b", "c": 11, "d": { "e": true } }' -H "Content-Type: application/json" -X POST http://localhost:12000/example
```
curl -d '{ "a": "b", "c": 11, "d": { "e": true } }' -H "Content-Type: application/json" -X POST http://localhost:12000/example

1. You will notice in sensor logs that the event is invalid as the sensor expects `e == false`

1. Send another HTTP request to event-source

```bash
curl -d '{ "a": "b", "c": 11, "d": { "e": false } }' -H "Content-Type: application/json" -X POST http://localhost:12000/example
```
curl -d '{ "a": "b", "c": 11, "d": { "e": false } }' -H "Content-Type: application/json" -X POST http://localhost:12000/example

1. Look for a workflow with name starting with `expr-workflow-`

Expand Down
18 changes: 5 additions & 13 deletions docs/sensors/filters/script.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,29 +36,21 @@ filters:
1. Create a webhook event-source
```sh
kubectl -n argo-events apply -f https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/event-sources/webhook.yaml
```
kubectl -n argo-events apply -f https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/event-sources/webhook.yaml
1. Create a webhook sensor with context filter
```sh
kubectl -n argo-events apply -f https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/sensors/filter-script.yaml
```
kubectl -n argo-events apply -f https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/sensors/filter-script.yaml
1. Send an HTTP request to the event-source
```sh
kubectl port-forward svc/webhook-eventsource-svc 12000
curl -d '{"hello": "world"}' -X POST http://localhost:12000/example
```
kubectl port-forward svc/webhook-eventsource-svc 12000
curl -d '{"hello": "world"}' -X POST http://localhost:12000/example
1. You will notice in sensor logs that the event did not trigger anything.
1. Send another HTTP request the event-source
```sh
curl -X POST -d '{"a": "b", "d": {"e": "z"}}' http://localhost:12000/example
```
curl -X POST -d '{"a": "b", "d": {"e": "z"}}' http://localhost:12000/example
1. Then you will see the event successfully triggered a workflow creation.
16 changes: 5 additions & 11 deletions docs/sensors/filters/time.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,26 +82,20 @@ If `stop` is smaller than `start` (`stop` < `start`), the stop time is treated a

1. Create a webhook event-source

```bash
kubectl -n argo-events apply -f https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/event-sources/webhook.yaml
```
kubectl -n argo-events apply -f https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/event-sources/webhook.yaml

1. Create a webhook sensor with time filter

```bash
kubectl -n argo-events apply -f https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/sensors/filter-with-time.yaml
```
kubectl -n argo-events apply -f https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/sensors/filter-with-time.yaml

1. Send an HTTP request to event-source

```bash
curl -d '{"message":"this is my first webhook"}' -H "Content-Type: application/json" -X POST http://localhost:12000/example
```
curl -d '{"message":"this is my first webhook"}' -H "Content-Type: application/json" -X POST http://localhost:12000/example

1. You will notice one of following behaviours:

- if you run this example between 02:30 and 04:30, the sensor logs the event is valid
- if you run this example outside time range between 02:30 and 04:30, the sensor logs the event is invalid
- if you run this example between 02:30 and 04:30, the sensor logs the event is valid
- if you run this example outside time range between 02:30 and 04:30, the sensor logs the event is invalid

## Further examples

Expand Down

0 comments on commit 730b2e0

Please sign in to comment.