- What is a trigger?
- How to define a trigger?
- What resource types are supported out of box?
- How can I add my custom resource as trigger?
What is a trigger?
Trigger is the resource executed by sensor once the event dependencies are resolved. Any K8s resource can act as a trigger (Custom Resources included).
How to define a trigger?
resource field in the trigger object has details of what to execute when the event dependencies have been resolved.
The framework provides support to fetch trigger resources from different sources.
Inlined artifacts are included directly within the sensor resource and decoded as a string. [Example](../examples/sensors/artifact.yaml)
Argo Events uses the [minio-go](https://github.com/minio/minio-go) client for access to any Amazon S3 compatible object store. [Example](../examples/sensors/context-filter-webhook.yaml)
Artifacts are defined in a file that is mounted via a [PersistentVolume](https://kubernetes.io/docs/concepts/storage/persistent-volumes/) within the `sensor-controller` pod. [Example](../examples/sensors/trigger-source-file.yaml)
Artifacts are accessed from web via RESTful API. [Example](../examples/sensors/url-sensor.yaml)
Artifact stored in Kubernetes configmap are accessed using the key. [Example](../examples/sensors/trigger-source-configmap.yaml)
Artifact stored in either public or private Git repository [Example](https://github.com/argoproj/argo-events/blob/master/examples/sensors/trigger-source-git.yaml)
What resource types are supported out of box?
Trigger Standard Kubernetes Resource
There could be a case where you may want to trigger a standard Kubernetes resource like Pod, Deployment etc. instead of an Argo Workflow. The sensor allows you to trigger any K8s resource in the same way you would trigger an Argo Workflow.
To trigger other standard K8s resources, change the group and version in
Follow the example to trigger a gateway.
In the example, the sensor creates a configmap and gateway resource for artifact gateway.
Because a gateway depends on
gateway-configmapwhich stores the event source configurations, the first trigger in sensor is a configmap and the second trigger is actual gateway.
How to pass the event payload to triggers other than Argo Workflow?
Same way you would pass an event payload to an Argo Workflow trigger. Refer here
How can I add my custom resource as trigger?
The set of currently supported resources are implemented in the
You need to register your custom resource in order for sensor to be able to trigger it. Once you register your custom resource, you'll need to rebuild the sensor image.
Follow these steps,
- Go to
- Import your custom resource api package.
initmethod, add the scheme to your custom resource api.
- Make sure there are no errors.
- Rebuild the sensor binary using
- To build the image, first change
Makefileto your docker registry and then run