autotrigger

module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 13, 2019 License: Apache-2.0

README

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.yaml

Usage

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_display
Known Issues:
  • 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.

Directories

Path Synopsis
cmd
pkg
reconciler/autotrigger/resources
Package resources holds simple functions for synthesizing child resources.
Package resources holds simple functions for synthesizing child resources.
reconciler/autotrigger/resources/names
Package names holds simple functions for synthesizing resource names.
Package names holds simple functions for synthesizing resource names.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL