diff --git a/docs/delivery/README.md b/docs/delivery/README.md
index 794b7c775c1..1afc94b97a7 100644
--- a/docs/delivery/README.md
+++ b/docs/delivery/README.md
@@ -123,7 +123,7 @@ capabilities and are free to add more delivery options.
### Exposing underlying DLC
-Channel implementation supporting dead letter channel should advertise it in
+Channel implementation supporting dead letter channel should resolve it to a URI in
their status.
```go
@@ -133,7 +133,7 @@ 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"`
+ DeadLetterSinkURI *apis.URL `json:"deadLetterSinkUri,omitempty"`
}
```
diff --git a/docs/eventing-api.md b/docs/eventing-api.md
index 1e2cb9cfe3f..8d3c6bc7178 100644
--- a/docs/eventing-api.md
+++ b/docs/eventing-api.md
@@ -263,6 +263,24 @@ SubscribableStatus
+DeliveryStatus
+
+
+DeliveryStatus
+
+
+ |
+
+
+(Members of DeliveryStatus are embedded into this type.)
+
+(Optional)
+DeliveryStatus contains a resolved URL to the dead letter sink address, and any other
+resolved delivery options.
+ |
+
+
+
deadLetterChannel
@@ -273,7 +291,8 @@ knative.dev/pkg/apis/duck/v1.KReference
(Optional)
DeadLetterChannel is a KReference and is set by the channel when it supports native error handling via a channel
-Failed messages are delivered here.
+Failed messages are delivered here.
+Deprecated in favor of DeliveryStatus, to be removed September 2022.
|
|
@@ -375,7 +394,10 @@ For exponential policy, backoff delay is backoffDelay*2^.
DeliveryStatus
-
DeliveryStatus contains the Status of an object supporting delivery options.
+(Appears on:ChannelableStatus, BrokerStatus, TriggerStatus, SubscriptionStatusPhysicalSubscription)
+
+
+
DeliveryStatus contains the Status of an object supporting delivery options. This type is intended to be embedded into a status struct.
@@ -387,16 +409,16 @@ For exponential policy, backoff delay is backoffDelay*2^.
-deadLetterChannel
+deadLetterSinkUri
-
-knative.dev/pkg/apis/duck/v1.KReference
+
+knative.dev/pkg/apis.URL
|
(Optional)
- DeadLetterChannel is a KReference that is the reference to the native, platform specific channel
+ DeadLetterSink is a KReference that is the reference to the native, platform specific channel
where failed events are sent to.
|
@@ -1721,6 +1743,23 @@ knative.dev/pkg/apis/duck/v1.Addressable
delivered into the Broker mesh.
+
+
+DeliveryStatus
+
+
+DeliveryStatus
+
+
+ |
+
+
+(Members of DeliveryStatus are embedded into this type.)
+
+DeliveryStatus contains a resolved URL to the dead letter sink address, and any other
+resolved delivery options.
+ |
+
TriggerFilter
@@ -1889,16 +1928,19 @@ knative.dev/pkg/apis.URL
-deadLetterSinkUri
+DeliveryStatus
-
-knative.dev/pkg/apis.URL
+
+DeliveryStatus
|
-(Optional)
- DeadLetterSinkURI is the resolved URI of the dead letter sink for this Trigger.
+
+(Members of DeliveryStatus are embedded into this type.)
+
+DeliveryStatus contains a resolved URL to the dead letter sink address, and any other
+resolved delivery options.
|
@@ -3828,16 +3870,19 @@ knative.dev/pkg/apis.URL
-deadLetterSinkUri
+DeliveryStatus
-
-knative.dev/pkg/apis.URL
+
+DeliveryStatus
|
-(Optional)
- ReplyURI is the fully resolved URI for the spec.delivery.deadLetterSink.
+
+(Members of DeliveryStatus are embedded into this type.)
+
+DeliveryStatus contains a resolved URL to the dead letter sink address, and any other
+resolved delivery options.
|
diff --git a/pkg/apis/duck/v1/channelable_types.go b/pkg/apis/duck/v1/channelable_types.go
index 2d03a3f879c..39784fcaf96 100644
--- a/pkg/apis/duck/v1/channelable_types.go
+++ b/pkg/apis/duck/v1/channelable_types.go
@@ -63,8 +63,13 @@ type ChannelableStatus struct {
duckv1.AddressStatus `json:",inline"`
// Subscribers is populated with the statuses of each of the Channelable's subscribers.
SubscribableStatus `json:",inline"`
+ // DeliveryStatus contains a resolved URL to the dead letter sink address, and any other
+ // resolved delivery options.
+ // +optional
+ DeliveryStatus `json:",inline"`
// DeadLetterChannel is a KReference and is set by the channel when it supports native error handling via a channel
// Failed messages are delivered here.
+ // Deprecated in favor of DeliveryStatus, to be removed September 2022.
// +optional
DeadLetterChannel *duckv1.KReference `json:"deadLetterChannel,omitempty"`
}
diff --git a/pkg/apis/duck/v1/delivery_types.go b/pkg/apis/duck/v1/delivery_types.go
index b82bbc4f9b7..dffd0397a33 100644
--- a/pkg/apis/duck/v1/delivery_types.go
+++ b/pkg/apis/duck/v1/delivery_types.go
@@ -115,10 +115,10 @@ const (
BackoffPolicyExponential BackoffPolicyType = "exponential"
)
-// DeliveryStatus contains the Status of an object supporting delivery options.
+// DeliveryStatus contains the Status of an object supporting delivery options. This type is intended to be embedded into a status struct.
type DeliveryStatus struct {
- // DeadLetterChannel is a KReference that is the reference to the native, platform specific channel
+ // DeadLetterSink 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"`
+ DeadLetterSinkURI *apis.URL `json:"deadLetterSinkUri,omitempty"`
}
diff --git a/pkg/apis/duck/v1/zz_generated.deepcopy.go b/pkg/apis/duck/v1/zz_generated.deepcopy.go
index 0501d0e6045..ffd6985aed6 100644
--- a/pkg/apis/duck/v1/zz_generated.deepcopy.go
+++ b/pkg/apis/duck/v1/zz_generated.deepcopy.go
@@ -115,6 +115,7 @@ func (in *ChannelableStatus) DeepCopyInto(out *ChannelableStatus) {
in.Status.DeepCopyInto(&out.Status)
in.AddressStatus.DeepCopyInto(&out.AddressStatus)
in.SubscribableStatus.DeepCopyInto(&out.SubscribableStatus)
+ in.DeliveryStatus.DeepCopyInto(&out.DeliveryStatus)
if in.DeadLetterChannel != nil {
in, out := &in.DeadLetterChannel, &out.DeadLetterChannel
*out = new(duckv1.KReference)
@@ -177,10 +178,10 @@ func (in *DeliverySpec) DeepCopy() *DeliverySpec {
// 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
+ if in.DeadLetterSinkURI != nil {
+ in, out := &in.DeadLetterSinkURI, &out.DeadLetterSinkURI
+ *out = new(apis.URL)
+ (*in).DeepCopyInto(*out)
}
return
}
diff --git a/pkg/apis/duck/v1beta1/delivery_conversion.go b/pkg/apis/duck/v1beta1/delivery_conversion.go
index d48ccde0c18..b6ec90337a0 100644
--- a/pkg/apis/duck/v1beta1/delivery_conversion.go
+++ b/pkg/apis/duck/v1beta1/delivery_conversion.go
@@ -76,24 +76,4 @@ func (sink *DeliverySpec) ConvertFrom(ctx context.Context, from apis.Convertible
}
}
-// 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)
- }
-}
+// DeliveryStatus v1beta1 is not convertable to v1 (Channel ref type vs URL)
diff --git a/pkg/apis/duck/v1beta1/delivery_conversion_test.go b/pkg/apis/duck/v1beta1/delivery_conversion_test.go
index 7746135bf35..4dc2e37a338 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
@@ -205,78 +192,5 @@ 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)
- }
- })
- }
-}
+// v1beta1 and v1 DeliveryStatus are not convertable to each other.
+// (channel ref vs apis.URL)
diff --git a/pkg/apis/eventing/v1/broker_types.go b/pkg/apis/eventing/v1/broker_types.go
index d03749bd1bb..d12e586804a 100644
--- a/pkg/apis/eventing/v1/broker_types.go
+++ b/pkg/apis/eventing/v1/broker_types.go
@@ -92,6 +92,10 @@ type BrokerStatus struct {
// delivered into the Broker mesh.
// +optional
Address duckv1.Addressable `json:"address,omitempty"`
+
+ // DeliveryStatus contains a resolved URL to the dead letter sink address, and any other
+ // resolved delivery options.
+ eventingduckv1.DeliveryStatus `json:",inline"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
diff --git a/pkg/apis/eventing/v1/trigger_types.go b/pkg/apis/eventing/v1/trigger_types.go
index d7b876c868e..aa842be3f80 100644
--- a/pkg/apis/eventing/v1/trigger_types.go
+++ b/pkg/apis/eventing/v1/trigger_types.go
@@ -120,9 +120,9 @@ type TriggerStatus struct {
// +optional
SubscriberURI *apis.URL `json:"subscriberUri,omitempty"`
- // DeadLetterSinkURI is the resolved URI of the dead letter sink for this Trigger.
- // +optional
- DeadLetterSinkURI *apis.URL `json:"deadLetterSinkUri,omitempty"`
+ // DeliveryStatus contains a resolved URL to the dead letter sink address, and any other
+ // resolved delivery options.
+ eventingduckv1.DeliveryStatus `json:",inline"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
diff --git a/pkg/apis/eventing/v1/zz_generated.deepcopy.go b/pkg/apis/eventing/v1/zz_generated.deepcopy.go
index 908b4e354a8..bc1223f042d 100644
--- a/pkg/apis/eventing/v1/zz_generated.deepcopy.go
+++ b/pkg/apis/eventing/v1/zz_generated.deepcopy.go
@@ -119,6 +119,7 @@ func (in *BrokerStatus) DeepCopyInto(out *BrokerStatus) {
*out = *in
in.Status.DeepCopyInto(&out.Status)
in.Address.DeepCopyInto(&out.Address)
+ in.DeliveryStatus.DeepCopyInto(&out.DeliveryStatus)
return
}
@@ -274,11 +275,7 @@ func (in *TriggerStatus) DeepCopyInto(out *TriggerStatus) {
*out = new(apis.URL)
(*in).DeepCopyInto(*out)
}
- if in.DeadLetterSinkURI != nil {
- in, out := &in.DeadLetterSinkURI, &out.DeadLetterSinkURI
- *out = new(apis.URL)
- (*in).DeepCopyInto(*out)
- }
+ in.DeliveryStatus.DeepCopyInto(&out.DeliveryStatus)
return
}
diff --git a/pkg/apis/messaging/v1/subscription_types.go b/pkg/apis/messaging/v1/subscription_types.go
index b093269d9b0..4bd637cbe01 100644
--- a/pkg/apis/messaging/v1/subscription_types.go
+++ b/pkg/apis/messaging/v1/subscription_types.go
@@ -128,9 +128,9 @@ type SubscriptionStatusPhysicalSubscription struct {
// +optional
ReplyURI *apis.URL `json:"replyUri,omitempty"`
- // ReplyURI is the fully resolved URI for the spec.delivery.deadLetterSink.
- // +optional
- DeadLetterSinkURI *apis.URL `json:"deadLetterSinkUri,omitempty"`
+ // DeliveryStatus contains a resolved URL to the dead letter sink address, and any other
+ // resolved delivery options.
+ eventingduckv1.DeliveryStatus `json:",inline"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
diff --git a/pkg/apis/messaging/v1/zz_generated.deepcopy.go b/pkg/apis/messaging/v1/zz_generated.deepcopy.go
index 752f11d6e10..dd756192282 100644
--- a/pkg/apis/messaging/v1/zz_generated.deepcopy.go
+++ b/pkg/apis/messaging/v1/zz_generated.deepcopy.go
@@ -381,11 +381,7 @@ func (in *SubscriptionStatusPhysicalSubscription) DeepCopyInto(out *Subscription
*out = new(apis.URL)
(*in).DeepCopyInto(*out)
}
- if in.DeadLetterSinkURI != nil {
- in, out := &in.DeadLetterSinkURI, &out.DeadLetterSinkURI
- *out = new(apis.URL)
- (*in).DeepCopyInto(*out)
- }
+ in.DeliveryStatus.DeepCopyInto(&out.DeliveryStatus)
return
}