Skip to content

Commit

Permalink
feat: remove new-trigger-filters feature flag (#8067)
Browse files Browse the repository at this point in the history
Signed-off-by: Calum Murray <cmurray@redhat.com>
  • Loading branch information
Cali0707 committed Jul 16, 2024
1 parent 1316277 commit 2cc0a5b
Show file tree
Hide file tree
Showing 10 changed files with 4 additions and 25 deletions.
5 changes: 0 additions & 5 deletions config/core/configmaps/features.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,6 @@ data:
# For more details: https://github.com/knative/eventing/issues/5593
kreference-mapping: "disabled"

# BETA feature: The new-trigger-filters flag allows you to use the new `filters` field
# in Trigger objects with its rich filtering capabilities.
# For more details: https://github.com/knative/eventing/issues/5204
new-trigger-filters: "enabled"

# BETA feature: The transport-encryption flag allows you to encrypt events in transit using the transport layer security (TLS) protocol.
# For more details: https://github.com/knative/eventing/issues/5957
transport-encryption: "disabled"
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/eventing/v1/trigger_validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ func ValidateAttributesNames(attrs map[string]string) (errs *apis.FieldError) {
}

func ValidateSubscriptionAPIFiltersList(ctx context.Context, filters []SubscriptionsAPIFilter) (errs *apis.FieldError) {
if filters == nil || !feature.FromContext(ctx).IsEnabled(feature.NewTriggerFilters) {
if filters == nil {
return nil
}

Expand Down
5 changes: 1 addition & 4 deletions pkg/apis/eventing/v1/trigger_validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -692,9 +692,6 @@ func TestTriggerSpecValidationWithCrossNamespaceEventLinksFeatureEnabled(t *test
}

func TestFilterSpecValidation(t *testing.T) {
newTriggerFiltersEnabledCtx := feature.ToContext(context.TODO(), feature.Flags{
feature.NewTriggerFilters: feature.Enabled,
})
tests := []struct {
name string
filter *TriggerFilter
Expand Down Expand Up @@ -939,7 +936,7 @@ func TestFilterSpecValidation(t *testing.T) {
Filters: test.filters,
Subscriber: validSubscriber,
}
got := ts.Validate(newTriggerFiltersEnabledCtx)
got := ts.Validate(context.Background())
if diff := cmp.Diff(test.want.Error(), got.Error()); diff != "" {
t.Errorf("Validate TriggerSpec (-want, +got) =\n%s", diff)
}
Expand Down
1 change: 0 additions & 1 deletion pkg/apis/feature/features.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ func newDefaults() Flags {
DeliveryRetryAfter: Disabled,
DeliveryTimeout: Enabled,
KReferenceMapping: Disabled,
NewTriggerFilters: Enabled,
TransportEncryption: Disabled,
OIDCAuthentication: Disabled,
EvenTypeAutoCreate: Disabled,
Expand Down
3 changes: 0 additions & 3 deletions pkg/apis/feature/features_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,4 @@ func TestShouldNotOverrideDefaults(t *testing.T) {
if !f.IsDisabled(KReferenceGroup) && !f.IsEnabled(KReferenceGroup) {
t.Errorf("Expected default value for %s in flags %+v", KReferenceGroup, f)
}
if !f.IsEnabled(NewTriggerFilters) {
t.Errorf("Expected default value for %s to be %s in flags %+v", NewTriggerFilters, Enabled, f)
}
}
1 change: 0 additions & 1 deletion pkg/apis/feature/flag_names.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ const (
DeliveryRetryAfter = "delivery-retryafter"
DeliveryTimeout = "delivery-timeout"
KReferenceMapping = "kreference-mapping"
NewTriggerFilters = "new-trigger-filters"
TransportEncryption = "transport-encryption"
EvenTypeAutoCreate = "eventtype-auto-create"
OIDCAuthentication = "authentication-oidc"
Expand Down
2 changes: 1 addition & 1 deletion pkg/broker/filter/filter_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ func (h *Handler) getTrigger(ref path.NamespacedNameUID) (*eventingv1.Trigger, e

func (h *Handler) filterEvent(ctx context.Context, trigger *eventingv1.Trigger, event cloudevents.Event) eventfilter.FilterResult {
switch {
case feature.FromContext(ctx).IsEnabled(feature.NewTriggerFilters) && len(trigger.Spec.Filters) > 0:
case len(trigger.Spec.Filters) > 0:
logging.FromContext(ctx).Debugw("New trigger filters feature is enabled. Applying new filters.", zap.Any("filters", trigger.Spec.Filters))
filter, ok := h.filtersMap.Get(trigger)
if !ok {
Expand Down
4 changes: 1 addition & 3 deletions pkg/broker/filter/filter_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -672,9 +672,7 @@ func TestReceiver_WithSubscriptionsAPI(t *testing.T) {
reporter,
configmapinformer.Get(ctx).Lister().ConfigMaps("ns"),
func(ctx context.Context) context.Context {
return feature.ToContext(context.TODO(), feature.Flags{
feature.NewTriggerFilters: feature.Enabled,
})
return ctx
})
if err != nil {
t.Fatal("Unable to create receiver:", err)
Expand Down
5 changes: 0 additions & 5 deletions test/config/config-features.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,6 @@ data:
# For more details: https://github.com/knative/eventing/issues/5593
kreference-mapping: "disabled"

# BETA feature: The new-trigger-filters flag allows you to use the new `filters` field
# in Trigger objects with its rich filtering capabilities.
# For more details: https://github.com/knative/eventing/issues/5204
new-trigger-filters: "enabled"

# ALPHA feature: The transport-encryption flag allows you to encrypt events in transit using the transport layer security (TLS) protocol.
# For more details: https://github.com/knative/eventing/issues/5957
transport-encryption: "disabled"
Expand Down
1 change: 0 additions & 1 deletion test/experimental/config/features.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,4 @@ data:
kreference-group: "enabled"
delivery-retryafter: "enabled"
delivery-timeout: "enabled"
new-trigger-filters: "enabled"
eventtype-auto-create: "enabled"

0 comments on commit 2cc0a5b

Please sign in to comment.