New Trigger Filters do not seem to perform any filtering
Describe the bug
When I attempt to use a trigger with the new-trigger-filters feature enabled in the config-features configmap I do not see any filtering and a service attached to the trigger that is echoing the received events shows all events. If I add a filter block with the filters block the filter block takes precedence and filters the events properly. If I have read things correctly, it should not take precedence. I do get reconciliation errors if I put improper syntax in to the filters field though.
apiVersion: eventing.knative.dev/v1
kind: Trigger
metadata:
name: example
spec:
broker: example
filters:
- cesql: "type LIKE 'dev.knative.apiserver.resource.%'"
Expected behavior The filter should not forward all events to the service.
knative version: 1.14.0
Hi @cldfzn thanks for reporting this! I've tried to reproduce this with the following test case:
diff --git a/test/rekt/features/new_trigger_filters/feature.go b/test/rekt/features/new_trigger_filters/feature.go
index ee95bab4e..e258341a9 100644
--- a/test/rekt/features/new_trigger_filters/feature.go
+++ b/test/rekt/features/new_trigger_filters/feature.go
@@ -59,6 +59,7 @@ func NewFiltersFeatureSet(installBroker InstallBrokerFunc) *feature.FeatureSet {
FilterAttributeWithEmptyFiltersFeature(installBroker),
FiltersOverrideAttributeFilterFeature(installBroker),
MultipleFiltersFeature(installBroker),
+ CESQLFilterFeature(installBroker),
)
return &feature.FeatureSet{
Name: "New Trigger Filters",
@@ -536,3 +537,28 @@ func MultipleFiltersFeature(installBroker InstallBrokerFunc) *feature.Feature {
return f
}
+
+func CESQLFilterFeature(installBroker InstallBrokerFunc) *feature.Feature {
+ f := feature.NewFeature()
+
+ eventContexts := []CloudEventsContext{
+ {
+ eventType: "exact.event.type",
+ shouldDeliver: false,
+ },
+ {
+ eventType: "dev.knative.apiserver.resource.event.type",
+ shouldDeliver: true,
+ },
+ }
+
+ filters := []eventingv1.SubscriptionsAPIFilter{
+ {
+ CESQL: "type LIKE 'dev.knative.apiserver.resource.%'",
+ },
+ }
+
+ createNewFiltersFeature(f, eventContexts, filters, eventingv1.TriggerFilter{}, installBroker)
+
+ return f
+}
However, all of the tests passed when I ran this...
Would you be able to provide the output of kubectl get cm config-features -n knative-eventing -oyaml? Also which broker implementation are you using?
The broker that supports the new trigger filtering are: MTChannelBasedBroker and Kafka, RabbitMQ broker doesn't yet but we would welcome contributions
cc @ikavgo
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.