Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Trigger Filters do not seem to perform any filtering #8018

Open
cldfzn opened this issue Jun 20, 2024 · 2 comments
Open

New Trigger Filters do not seem to perform any filtering #8018

cldfzn opened this issue Jun 20, 2024 · 2 comments
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug. triage/needs-user-input Issues which are waiting on a response from the reporter

Comments

@cldfzn
Copy link

cldfzn commented Jun 20, 2024

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

@cldfzn cldfzn added the kind/bug Categorizes issue or PR as related to a bug. label Jun 20, 2024
@Cali0707 Cali0707 self-assigned this Jun 27, 2024
@Cali0707
Copy link
Member

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?

@pierDipi
Copy link
Member

pierDipi commented Jul 4, 2024

The broker that supports the new trigger filtering are: MTChannelBasedBroker and Kafka, RabbitMQ broker doesn't yet but we would welcome contributions

cc @ikavgo

@pierDipi pierDipi added the triage/needs-user-input Issues which are waiting on a response from the reporter label Jul 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. triage/needs-user-input Issues which are waiting on a response from the reporter
Projects
None yet
Development

No branches or pull requests

3 participants