Skip to content

Commit

Permalink
feat: removed new trigger filters feature flag
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 3, 2024
1 parent d0df87a commit 709015b
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 18 deletions.
8 changes: 3 additions & 5 deletions control-plane/pkg/reconciler/consumer/consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ import (
"knative.dev/pkg/resolver"
"knative.dev/pkg/tracker"

"knative.dev/eventing/pkg/apis/feature"

"knative.dev/eventing-kafka-broker/control-plane/pkg/apis/config"
"knative.dev/eventing-kafka-broker/control-plane/pkg/apis/internals/kafka/eventing"
kafkainternals "knative.dev/eventing-kafka-broker/control-plane/pkg/apis/internals/kafka/eventing/v1alpha1"
Expand Down Expand Up @@ -174,7 +172,7 @@ func (r *Reconciler) reconcileContractEgress(ctx context.Context, c *kafkaintern
}
}

filter, filters := reconcileFilters(ctx, c)
filter, filters := reconcileFilters(c)

egress := &contract.Egress{
ConsumerGroup: c.Spec.Configs.Configs["group.id"],
Expand Down Expand Up @@ -343,7 +341,7 @@ func (r *Reconciler) reconcileReplyStrategy(ctx context.Context, c *kafkainterna
return nil
}

func reconcileFilters(ctx context.Context, c *kafkainternals.Consumer) (*contract.Filter, []*contract.DialectedFilter) {
func reconcileFilters(c *kafkainternals.Consumer) (*contract.Filter, []*contract.DialectedFilter) {
if c.Spec.Filters == nil {
return nil, nil
}
Expand All @@ -355,7 +353,7 @@ func reconcileFilters(ctx context.Context, c *kafkainternals.Consumer) (*contrac
filter = &contract.Filter{Attributes: c.Spec.Filters.Filter.Attributes}
}

if feature.FromContext(ctx).IsEnabled(feature.NewTriggerFilters) && c.Spec.Filters.Filters != nil {
if c.Spec.Filters.Filters != nil {

Check warning on line 356 in control-plane/pkg/reconciler/consumer/consumer.go

View check run for this annotation

Codecov / codecov/patch

control-plane/pkg/reconciler/consumer/consumer.go#L356

Added line #L356 was not covered by tests
for _, f := range c.Spec.Filters.Filters {
filters = append(filters, contract.FromSubscriptionFilter(f))
}
Expand Down
8 changes: 1 addition & 7 deletions control-plane/pkg/reconciler/trigger/trigger.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,13 +337,7 @@ func (r *Reconciler) reconcileTriggerEgress(ctx context.Context, broker *eventin
egress.OidcServiceAccountName = *trigger.Status.Auth.ServiceAccountName
}

newFiltersEnabled := func() bool {
r.FlagsLock.RLock()
defer r.FlagsLock.RUnlock()
return r.Flags.IsEnabled(feature.NewTriggerFilters)
}()

if newFiltersEnabled && len(trigger.Spec.Filters) > 0 {
if len(trigger.Spec.Filters) > 0 {
dialectedFilters := make([]*contract.DialectedFilter, 0, len(trigger.Spec.Filters))
for _, f := range trigger.Spec.Filters {
dialectedFilters = append(dialectedFilters, contract.FromSubscriptionFilter(f))
Expand Down
6 changes: 1 addition & 5 deletions control-plane/pkg/reconciler/trigger/trigger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2304,11 +2304,7 @@ func triggerReconciliation(t *testing.T, format string, env config.Env, useNewFi
table[i].Name = table[i].Name + " - " + format
}

if useNewFilters {
useTableWithFlags(t, table, &env, map[string]feature.Flag{feature.NewTriggerFilters: feature.Enabled})
} else {
useTable(t, table, &env)
}
useTable(t, table, &env)
}

func withDelivery(trigger *eventing.Trigger) {
Expand Down
1 change: 0 additions & 1 deletion test/experimental/features_config/features.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ data:
delivery-retryafter: "disabled"
delivery-timeout: "enabled"
kreference-mapping: "disabled"
new-trigger-filters: "enabled"
transport-encryption: "disabled"
eventtype-auto-create: "disabled"
authentication-oidc: "disabled"

0 comments on commit 709015b

Please sign in to comment.