docs/docs/eventing/broker/triggers
Julian Friedman 61b8c3f91e
Move mkdocs work over from julz/mkdocs branch (#3551)
* initial move over

* Fix up index page names

* Add version variables

* Escape macro syntax

* Automatic fixups with mkhugo

* Drop no-longer-needed excludes

* Rename more _index files

* Move broker-configmaps.md a README.md

avoids a directory with no index/readme

* Autogenerate Eventing nav

* Fix markdown

* Update Serving nav

* Add h1 headers

Makes things look nicer in github, and makes search work more accurately
in mkdocs

* Unexclude all samples

* Correct client link

* Fix gitignore, skip hugo tests
2021-05-11 05:58:46 -07:00
..
README.md Move mkdocs work over from julz/mkdocs branch (#3551) 2021-05-11 05:58:46 -07:00

README.md

title weight type showlandingtoc aliases
Triggers 02 docs false
docs/eventing/triggers

Triggers

A trigger represents a desire to subscribe to events from a specific broker.

The subscriber value must be a Destination.

Simple example which will receive all the events from the given (default) broker and deliver them to Knative Serving service my-service:

kubectl create -f - <<EOF
apiVersion: eventing.knative.dev/v1
kind: Trigger
metadata:
  name: my-service-trigger
spec:
  broker: default
  subscriber:
    ref:
      apiVersion: serving.knative.dev/v1
      kind: Service
      name: my-service
EOF

Simple example which will receive all the events from the given (default) broker and deliver them to the custom path /my-custom-path for the Kubernetes service my-service:

kubectl create -f - <<EOF
apiVersion: eventing.knative.dev/v1
kind: Trigger
metadata:
  name: my-service-trigger
spec:
  broker: default
  subscriber:
    ref:
      apiVersion: v1
      kind: Service
      name: my-service
    uri: /my-custom-path
EOF

Trigger filtering

Exact match filtering on any number of CloudEvents attributes as well as extensions are supported. If your filter sets multiple attributes, an event must have all of the attributes for the trigger to filter it. Note that we only support exact matching on string values.

Example

This example filters events from the default broker that are of type dev.knative.foo.bar and have the extension myextension with the value my-extension-value.

kubectl create -f - <<EOF
apiVersion: eventing.knative.dev/v1
kind: Trigger
metadata:
  name: my-service-trigger
spec:
  broker: default
  filter:
    attributes:
      type: dev.knative.foo.bar
      myextension: my-extension-value
  subscriber:
    ref:
      apiVersion: serving.knative.dev/v1
      kind: Service
      name: my-service
EOF