Support Trigger Filters attribute
It looks like the new (since 1.15) GA feature of Trigger.filters (plural) is not supported on latest kn client
/kn-linux-amd64 version
Version:
Build Date:
Git Revision:
Supported APIs:
* Serving
- serving.knative.dev/v1 (knative-serving v0.43.0)
* Eventing
- sources.knative.dev/v1 (knative-eventing v0.43.0)
- eventing.knative.dev/v1 (knative-eventing v0.43.0)
➜ Downloads ./kn-linux-amd64 trigger create --help
Create a trigger
Usage:
kn-linux-amd64 trigger create NAME --sink SINK [options]
Examples:
# Create a trigger 'mytrigger' to declare a subscription to events from default broker. The subscriber is service 'mysvc'
kn trigger create mytrigger --broker default --sink ksvc:mysvc
# Create a trigger to filter events with attribute 'type=dev.knative.foo'
kn trigger create mytrigger --broker default --filter type=dev.knative.foo --sink ksvc:mysvc
Options:
--broker string Name of the Broker which the trigger associates with. (default "default")
--filter strings Key-value pair for exact CloudEvent attribute matching against incoming events, e.g type=dev.knative.foo
-n, --namespace string Specify the namespace to operate in.
-s, --sink string Addressable sink for events. You can specify a broker, channel, Knative service, Kubernetes service or URI. Examples: '--sink broker:nest' for a broker 'nest', '--sink channel:pipe' for a channel 'pipe', '--sink ksvc:mysvc:mynamespace' for a Knative service 'mysvc' in another namespace 'mynamespace', '--sink
https://event.receiver.uri' for an HTTP URI, '--sink ksvc:receiver' or simply '--sink receiver' for a Knative service 'receiver' in the current namespace, '--sink svc:receiver:mynamespace' for a Kubernetes service 'receiver' in the 'mynamespace' namespace, '--sink special.eventing.dev/v1alpha1/channels:pipe'
for GroupVersionResource of v1alpha1 'pipe'. If a prefix is not provided, it is considered as a Knative service in the current namespace.
Use "kn-linux-amd64 options" for a list of global command-line options (applies to all commands).
This issue is stale because it has been open for 90 days with no
activity. It will automatically close after 30 more days of
inactivity. Reopen the issue with /reopen. Mark the issue as
fresh by adding the comment /remove-lifecycle stale.
/remove-lifecycle stale
Analyzing this issue it could be splitted in 2 sub-tasks:
- Updating the kn client in order to be able to support Trigger.filters [1] [2]
- Add a new flag parameter
--filtersto read from cli the desired list of filters
For task#2 it could be useful to agree on the filters "format" that could be something like:
kn trigger create my-github-trigger --filters [ { "any": [ { "exact": { "type": "com.github.push" } }, { "exact": { "subject": "https://github.com/cloudevents/spec" } } ] } ]
[1] https://github.com/knative/eventing/blob/main/pkg/apis/eventing/v1/trigger_types.go#L101 [2] https://github.com/knative/eventing/blob/06f8dc9242d1940d6516f95200e491008727b93f/pkg/apis/eventing/v1/trigger_types.go#L127
This issue is stale because it has been open for 90 days with no
activity. It will automatically close after 30 more days of
inactivity. Reopen the issue with /reopen. Mark the issue as
fresh by adding the comment /remove-lifecycle stale.