AutoTrigger
Magically create Triggers based on labels/annotations on any Knative
Addressable resource!
Install
kubectl apply -f https://github.com/n3wscott/autotrigger/releases/download/v0.1.0/release.yamlUsage
AutoTrigger automatically create triggers based on labels and annotations on Knative
Addressable resources.
Looking for the eventing.knative.dev/autotrigger label:
metadata:
labels:
eventing.knative.dev/autotrigger: "true"And if this is found, the controller takes a look at the annotations:
annotations:
trigger.eventing.knative.dev/filter: |
[{"type":"cloudevents.event.type"}]Filter object is a json encoded string that turns into a list of objects:
[
{
"broker": "knative-broker",
"source": "source uri",
"type": "cloudevents.event.type"
}
]broker, source and type are optional. broker defaults to "default".
source defaults to "Any". type defaults to "Any".
If you want to select on all events passing through the default broker:
annotations:
trigger.eventing.knative.dev/filter: "[{}]"You can add more than one filter:
annotations:
trigger.eventing.knative.dev/filter: |
[{"type":"cloudevents.event.foo"},{"type":"cloudevents.event.bar"}]Full Example
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
name: auto-event-display
labels:
eventing.knative.dev/autotrigger: "true"
annotations:
trigger.eventing.knative.dev/filter: |
[{"type":"botless.slack.message"},{"type":"botless.bot.command"}]
spec:
template:
spec:
containers:
- image: github.com/knative/eventing-sources/cmd/event_displayKnown Issues:
- Autotrigger controller does not clean up triggers if the
eventing.knative.dev/autotriggerlabel is removed.- you could remove the filters, then the annotation and that will clean them
up.
- you could remove the filters, then the annotation and that will clean them
On this page
Languages
Go99.0%Shell1.0%
Contributors
Apache License 2.0
Created March 13, 2020
Updated March 13, 2020