Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions docs/delivery/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
30 changes: 0 additions & 30 deletions docs/eventing-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -372,36 +372,6 @@ For exponential policy, backoff delay is backoffDelay*2^<numberOfRetries>.</p>
</tr>
</tbody>
</table>
<h3 id="duck.knative.dev/v1.DeliveryStatus">DeliveryStatus
</h3>
<p>
<p>DeliveryStatus contains the Status of an object supporting delivery options.</p>
</p>
<table>
<thead>
<tr>
<th>Field</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<code>deadLetterChannel</code><br/>
<em>
<a href="https://pkg.go.dev/knative.dev/pkg/apis/duck/v1#KReference">
knative.dev/pkg/apis/duck/v1.KReference
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>DeadLetterChannel is a KReference that is the reference to the native, platform specific channel
where failed events are sent to.</p>
</td>
</tr>
</tbody>
</table>
<h3 id="duck.knative.dev/v1.Subscribable">Subscribable
</h3>
<p>
Expand Down
10 changes: 0 additions & 10 deletions pkg/apis/duck/v1/delivery_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
12 changes: 0 additions & 12 deletions pkg/apis/duck/v1/delivery_conversion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
8 changes: 0 additions & 8 deletions pkg/apis/duck/v1/delivery_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}
21 changes: 0 additions & 21 deletions pkg/apis/duck/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 0 additions & 22 deletions pkg/apis/duck/v1beta1/delivery_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
89 changes: 0 additions & 89 deletions pkg/apis/duck/v1beta1/delivery_conversion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand All @@ -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
Expand Down Expand Up @@ -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)
}
})
}
}