From 057219550833a9e6db20212198b3e9ced9e03ccc Mon Sep 17 00:00:00 2001 From: nferraro Date: Wed, 22 May 2019 15:10:29 +0200 Subject: [PATCH] Fix #668: add documentation and enable automatically the feature with more than 2 channels --- docs/traits.adoc | 3 +++ pkg/trait/knative.go | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/docs/traits.adoc b/docs/traits.adoc index 0493800cb7..6fe592919e 100644 --- a/docs/traits.adoc +++ b/docs/traits.adoc @@ -157,6 +157,9 @@ More information can be found in the official Kubernetes documentation about htt ! knative.endpoint-sinks ! Configures a (comma-separated) list of endpoints the Knative consumes. +! knative.filter-source-channels +! Force the knative endpoint to filter messages based on the `ce-knativehistory` header (Knative experimental feature). It's enabled automatically when there are more than 2 source channels. It's optional (default to false) when there's a single source channel. + !=== | istio diff --git a/pkg/trait/knative.go b/pkg/trait/knative.go index edad18f37b..6b15d2477b 100644 --- a/pkg/trait/knative.go +++ b/pkg/trait/knative.go @@ -106,8 +106,10 @@ func (t *knativeTrait) Configure(e *Environment) (bool, error) { t.EndpointSinks = strings.Join(items, ",") } - if t.FilterSourceChannels == nil && len(strings.Split(t.ChannelSources, ",")) > 1 { - // Filter channels when the integration subscribes to more than one + if len(strings.Split(t.ChannelSources, ",")) > 1 { + // Always filter channels when the integration subscribes to more than one + // Using Knative experimental header: https://github.com/knative/eventing/blob/master/pkg/provisioners/message.go#L28 + // TODO: filter automatically all source channels when the feature becomes stable filter := true t.FilterSourceChannels = &filter }