diff --git a/docs/delivery/README.md b/docs/delivery/README.md index 794b7c775c1..78db6fdc94a 100644 --- a/docs/delivery/README.md +++ b/docs/delivery/README.md @@ -121,22 +121,6 @@ const ( Channel, brokers and event sources are not required to support all these capabilities and are free to add more delivery options. -### Exposing underlying DLC - -Channel implementation supporting dead letter channel should advertise it in -their status. - -```go - -// DeliveryStatus contains the Status of an object supporting delivery options. -type DeliveryStatus struct { - // DeadLetterChannel is a KReference that is the reference to the native, platform specific channel - // where failed events are sent to. - // +optional - DeadLetterChannel *duckv1.KReference `json:"deadLetterChannel,omitempty"` -} -``` - ### Error events The error event is the original events annotated with various CloudEvents diff --git a/docs/eventing-api.md b/docs/eventing-api.md index 1e2cb9cfe3f..cfda2651167 100644 --- a/docs/eventing-api.md +++ b/docs/eventing-api.md @@ -372,36 +372,6 @@ For exponential policy, backoff delay is backoffDelay*2^.

-

DeliveryStatus -

-

-

DeliveryStatus contains the Status of an object supporting delivery options.

-

- - - - - - - - - - - - - -
FieldDescription
-deadLetterChannel
- - -knative.dev/pkg/apis/duck/v1.KReference - - -
-(Optional) -

DeadLetterChannel is a KReference that is the reference to the native, platform specific channel -where failed events are sent to.

-

Subscribable

diff --git a/pkg/apis/duck/v1/delivery_conversion.go b/pkg/apis/duck/v1/delivery_conversion.go index bae7a804ec2..49fc3888dd3 100644 --- a/pkg/apis/duck/v1/delivery_conversion.go +++ b/pkg/apis/duck/v1/delivery_conversion.go @@ -32,13 +32,3 @@ func (source *DeliverySpec) ConvertTo(ctx context.Context, sink apis.Convertible func (sink *DeliverySpec) ConvertFrom(ctx context.Context, source apis.Convertible) error { return fmt.Errorf("v1 is the highest known version, got: %T", source) } - -// ConvertTo implements apis.Convertible -func (source *DeliveryStatus) ConvertTo(ctx context.Context, sink apis.Convertible) error { - return fmt.Errorf("v1 is the highest known version, got: %T", sink) -} - -// ConvertFrom implements apis.Convertible -func (sink *DeliveryStatus) ConvertFrom(ctx context.Context, source apis.Convertible) error { - return fmt.Errorf("v1 is the highest known version, got: %T", source) -} diff --git a/pkg/apis/duck/v1/delivery_conversion_test.go b/pkg/apis/duck/v1/delivery_conversion_test.go index bc348da09cc..e13cdc9523b 100644 --- a/pkg/apis/duck/v1/delivery_conversion_test.go +++ b/pkg/apis/duck/v1/delivery_conversion_test.go @@ -32,15 +32,3 @@ func TestDeliverySpecConversionBadType(t *testing.T) { t.Errorf("ConvertFrom() = %#v, wanted error", good) } } - -func TestDeliveryStatusConversionBadType(t *testing.T) { - good, bad := &DeliveryStatus{}, &DeliveryStatus{} - - if err := good.ConvertTo(context.Background(), bad); err == nil { - t.Errorf("ConvertTo() = %#v, wanted error", bad) - } - - if err := good.ConvertFrom(context.Background(), bad); err == nil { - t.Errorf("ConvertFrom() = %#v, wanted error", good) - } -} diff --git a/pkg/apis/duck/v1/delivery_types.go b/pkg/apis/duck/v1/delivery_types.go index b82bbc4f9b7..68b74552c6f 100644 --- a/pkg/apis/duck/v1/delivery_types.go +++ b/pkg/apis/duck/v1/delivery_types.go @@ -114,11 +114,3 @@ const ( // Exponential backoff policy BackoffPolicyExponential BackoffPolicyType = "exponential" ) - -// DeliveryStatus contains the Status of an object supporting delivery options. -type DeliveryStatus struct { - // DeadLetterChannel is a KReference that is the reference to the native, platform specific channel - // where failed events are sent to. - // +optional - DeadLetterChannel *duckv1.KReference `json:"deadLetterChannel,omitempty"` -} diff --git a/pkg/apis/duck/v1/zz_generated.deepcopy.go b/pkg/apis/duck/v1/zz_generated.deepcopy.go index 0501d0e6045..814048947ed 100644 --- a/pkg/apis/duck/v1/zz_generated.deepcopy.go +++ b/pkg/apis/duck/v1/zz_generated.deepcopy.go @@ -174,27 +174,6 @@ func (in *DeliverySpec) DeepCopy() *DeliverySpec { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *DeliveryStatus) DeepCopyInto(out *DeliveryStatus) { - *out = *in - if in.DeadLetterChannel != nil { - in, out := &in.DeadLetterChannel, &out.DeadLetterChannel - *out = new(duckv1.KReference) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeliveryStatus. -func (in *DeliveryStatus) DeepCopy() *DeliveryStatus { - if in == nil { - return nil - } - out := new(DeliveryStatus) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Subscribable) DeepCopyInto(out *Subscribable) { *out = *in diff --git a/pkg/apis/duck/v1beta1/delivery_conversion.go b/pkg/apis/duck/v1beta1/delivery_conversion.go index d48ccde0c18..3b6d6c504a9 100644 --- a/pkg/apis/duck/v1beta1/delivery_conversion.go +++ b/pkg/apis/duck/v1beta1/delivery_conversion.go @@ -75,25 +75,3 @@ func (sink *DeliverySpec) ConvertFrom(ctx context.Context, from apis.Convertible return fmt.Errorf("unknown version, got: %T", source) } } - -// ConvertTo implements apis.Convertible -func (source *DeliveryStatus) ConvertTo(ctx context.Context, to apis.Convertible) error { - switch sink := to.(type) { - case *eventingduckv1.DeliveryStatus: - sink.DeadLetterChannel = source.DeadLetterChannel - return nil - default: - return fmt.Errorf("unknown version, got: %T", sink) - } -} - -// ConvertFrom implements apis.Convertible -func (sink *DeliveryStatus) ConvertFrom(ctx context.Context, from apis.Convertible) error { - switch source := from.(type) { - case *eventingduckv1.DeliveryStatus: - sink.DeadLetterChannel = source.DeadLetterChannel - return nil - default: - return fmt.Errorf("unknown version, got: %T", source) - } -} diff --git a/pkg/apis/duck/v1beta1/delivery_conversion_test.go b/pkg/apis/duck/v1beta1/delivery_conversion_test.go index 7746135bf35..b5528ab2ee7 100644 --- a/pkg/apis/duck/v1beta1/delivery_conversion_test.go +++ b/pkg/apis/duck/v1beta1/delivery_conversion_test.go @@ -23,7 +23,6 @@ import ( "github.com/google/go-cmp/cmp" v1 "knative.dev/eventing/pkg/apis/duck/v1" "knative.dev/pkg/apis" - duckv1 "knative.dev/pkg/apis/duck/v1" pkgduck "knative.dev/pkg/apis/duck/v1" ) @@ -39,18 +38,6 @@ func TestDeliverySpecConversionBadType(t *testing.T) { } } -func TestDeliveryStatusConversionBadType(t *testing.T) { - good, bad := &DeliveryStatus{}, &DeliveryStatus{} - - if err := good.ConvertTo(context.Background(), bad); err == nil { - t.Errorf("ConvertTo() = %#v, wanted error", bad) - } - - if err := good.ConvertFrom(context.Background(), bad); err == nil { - t.Errorf("ConvertFrom() = %#v, wanted error", good) - } -} - // Test v1beta1 -> v1 -> v1beta1 func TestDeliverySpecConversion(t *testing.T) { var retryCount int32 = 10 @@ -204,79 +191,3 @@ func TestDeliverySpecConversionV1(t *testing.T) { }) } } - -// Test v1beta1 -> v1 -> v1beta1 -func TestDeliveryStatusConversion(t *testing.T) { - tests := []struct { - name string - in *DeliveryStatus - err *string - }{{ - name: "min configuration", - in: &DeliveryStatus{ - DeadLetterChannel: &duckv1.KReference{ - Kind: "dlKind", - Namespace: "dlNamespace", - Name: "dlName", - APIVersion: "dlAPIVersion", - }, - }, - }} - for _, test := range tests { - t.Run(test.name, func(t *testing.T) { - ver := &v1.DeliveryStatus{} - err := test.in.ConvertTo(context.Background(), ver) - if err != nil { - if test.err == nil || *test.err != err.Error() { - t.Error("ConvertTo() =", err) - } - return - } - got := &DeliveryStatus{} - if err := got.ConvertFrom(context.Background(), ver); err != nil { - t.Error("ConvertFrom() =", err) - } - if diff := cmp.Diff(test.in, got); diff != "" { - t.Error("roundtrip (-want, +got) =", diff) - } - }) - } -} - -// Test v1 -> v1beta1 -> v1 -func TestDeliveryStatusConversionV1(t *testing.T) { - tests := []struct { - name string - in *v1.DeliveryStatus - err *string - }{{ - name: "min configuration", - in: &v1.DeliveryStatus{ - DeadLetterChannel: &duckv1.KReference{ - Kind: "dlKind", - Namespace: "dlNamespace", - Name: "dlName", - APIVersion: "dlAPIVersion", - }, - }, - }} - for _, test := range tests { - t.Run(test.name, func(t *testing.T) { - ver := &DeliveryStatus{} - err := ver.ConvertFrom(context.Background(), test.in) - if err != nil { - if test.err == nil || *test.err != err.Error() { - t.Error("ConvertFrom() =", err) - } - return - } - got := &v1.DeliveryStatus{} - if err := ver.ConvertTo(context.Background(), got); err != nil { - t.Error("ConvertTo() =", err) - } - if diff := cmp.Diff(test.in, got); diff != "" { - t.Error("roundtrip (-want, +got) =", diff) - } - }) - } -}