From 512f5083ba4b5ebde2932e811e8f1e21c752c874 Mon Sep 17 00:00:00 2001 From: Pierangelo Di Pilato Date: Thu, 4 Aug 2022 12:28:52 +0200 Subject: [PATCH 1/2] Promote strict subscriber to beta Signed-off-by: Pierangelo Di Pilato --- config/core/configmaps/features.yaml | 4 ++-- docs/eventing-api.md | 6 ++---- pkg/apis/messaging/v1/subscription_types.go | 3 +-- test/experimental/config/features.yaml | 2 +- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/config/core/configmaps/features.yaml b/config/core/configmaps/features.yaml index 6409e9f9c0d..b84d7cf2d64 100644 --- a/config/core/configmaps/features.yaml +++ b/config/core/configmaps/features.yaml @@ -40,9 +40,9 @@ data: # For more details: https://github.com/knative/eventing/issues/5593 kreference-mapping: "disabled" - # ALPHA feature: The subscriber-strict flag force subscriptions to define a subscriber + # BETA feature: The subscriber-strict flag force subscriptions to define a subscriber # For more details: https://github.com/knative/eventing/issues/5756 - strict-subscriber: "disabled" + strict-subscriber: "enabled" # ALPHA feature: The new-trigger-filters flag allows you to use the new `filters` field # in Trigger objects with its rich filtering capabilities. diff --git a/docs/eventing-api.md b/docs/eventing-api.md index d59f8fea576..35e259d39c2 100644 --- a/docs/eventing-api.md +++ b/docs/eventing-api.md @@ -3777,8 +3777,7 @@ knative.dev/pkg/apis/duck/v1.Destination -(Optional) -

Subscriber is reference to (optional) function for processing events. +

Subscriber is reference to function for processing events. Events from the Channel will be delivered here and replies are sent to a Destination as specified by the Reply.

@@ -4108,8 +4107,7 @@ knative.dev/pkg/apis/duck/v1.Destination -(Optional) -

Subscriber is reference to (optional) function for processing events. +

Subscriber is reference to function for processing events. Events from the Channel will be delivered here and replies are sent to a Destination as specified by the Reply.

diff --git a/pkg/apis/messaging/v1/subscription_types.go b/pkg/apis/messaging/v1/subscription_types.go index 4bd637cbe01..ec80fea20ee 100644 --- a/pkg/apis/messaging/v1/subscription_types.go +++ b/pkg/apis/messaging/v1/subscription_types.go @@ -90,10 +90,9 @@ type SubscriptionSpec struct { // etc.) Channel duckv1.KReference `json:"channel"` - // Subscriber is reference to (optional) function for processing events. + // Subscriber is reference to function for processing events. // Events from the Channel will be delivered here and replies are // sent to a Destination as specified by the Reply. - // +optional Subscriber *duckv1.Destination `json:"subscriber,omitempty"` // Reply specifies (optionally) how to handle events returned from diff --git a/test/experimental/config/features.yaml b/test/experimental/config/features.yaml index 2bdeb743684..1926ccfdd75 100644 --- a/test/experimental/config/features.yaml +++ b/test/experimental/config/features.yaml @@ -25,5 +25,5 @@ data: kreference-group: "enabled" delivery-retryafter: "enabled" delivery-timeout: "enabled" - strict-subscriber: "disabled" + strict-subscriber: "enabled" new-trigger-filters: "enabled" From bf0ca1d36740628f77973ea47f1000b9eb753c83 Mon Sep 17 00:00:00 2001 From: Pierangelo Di Pilato Date: Thu, 4 Aug 2022 14:59:27 +0200 Subject: [PATCH 2/2] Remove reply as subscriber test Signed-off-by: Pierangelo Di Pilato --- test/rekt/channel_test.go | 52 --------------------------------------- 1 file changed, 52 deletions(-) diff --git a/test/rekt/channel_test.go b/test/rekt/channel_test.go index 355678cb911..d294a312822 100644 --- a/test/rekt/channel_test.go +++ b/test/rekt/channel_test.go @@ -151,33 +151,6 @@ func TestSmoke_ChannelImplWithSubscription(t *testing.T) { } } -/* -TestChannelChainByUsingReplyAsSubscriber tests the following scenario: - -EventSource ---> (Channel ---> Subscription) x 10 ---> Sink - -It uses Subscription's spec.reply as spec.subscriber. - -This test should fail with https://github.com/knative/eventing/issues/5756 done. - -*/ -func TestChannelChainByUsingReplyAsSubscriber(t *testing.T) { - t.Parallel() - - ctx, env := global.Environment( - knative.WithKnativeNamespace(system.Namespace()), - knative.WithLoggingConfig, - knative.WithTracingConfig, - k8s.WithEventListener, - environment.Managed(t), - ) - - createSubscriberFn := func(ref *duckv1.KReference, uri string) manifest.CfgFn { - return subscription.WithReply(ref, uri) - } - env.Test(ctx, t, channel.ChannelChain(10, createSubscriberFn)) -} - /* TestChannelChain tests the following scenario: @@ -201,31 +174,6 @@ func TestChannelChain(t *testing.T) { env.Test(ctx, t, channel.ChannelChain(10, createSubscriberFn)) } -/* -TestChannelDeadLetterSinkByUsingReplyAsSubscriber tests if the events that cannot be delivered end up in -the dead letter sink. - -It uses Subscription's spec.reply as spec.subscriber. - -This test should fail with https://github.com/knative/eventing/issues/5756 done. -*/ -func TestChannelDeadLetterSinkByUsingReplyAsSubscriber(t *testing.T) { - t.Parallel() - - ctx, env := global.Environment( - knative.WithKnativeNamespace(system.Namespace()), - knative.WithLoggingConfig, - knative.WithTracingConfig, - k8s.WithEventListener, - environment.Managed(t), - ) - - createSubscriberFn := func(ref *duckv1.KReference, uri string) manifest.CfgFn { - return subscription.WithReply(ref, uri) - } - env.Test(ctx, t, channel.DeadLetterSink(createSubscriberFn)) -} - /* TestChannelDeadLetterSink tests if the events that cannot be delivered end up in the dead letter sink.