Magically create Triggers based on labels/annotations on any Knative Addressable resource!
kubectl apply -f https://github.com/n3wscott/autotrigger/releases/download/v0.1.0/release.yaml
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"}]
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_display
- Autotrigger controller does not clean up triggers if the
eventing.knative.dev/autotrigger
label is removed.- you could remove the filters, then the annotation and that will clean them up.