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
1 change: 1 addition & 0 deletions Gopkg.lock

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

16 changes: 16 additions & 0 deletions pkg/apis/duck/v1alpha1/channelable_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"knative.dev/pkg/apis/duck"
"knative.dev/pkg/apis/duck/v1alpha1"
duckv1beta1 "knative.dev/pkg/apis/duck/v1beta1"
apisv1alpha1 "knative.dev/pkg/apis/v1alpha1"
)

// +genclient
Expand All @@ -45,6 +46,12 @@ type Channelable struct {
// ChannelableSpec contains Spec of the Channelable object
type ChannelableSpec struct {
SubscribableTypeSpec `json:",inline"`

// ErrorChannel is the channel receiving messages that couldn't be sent to
// subscribers. One message is sent to this channel per failing subscriber.
//
// +optional
ErrorChannel *apisv1alpha1.Destination `json:"errorChannel,omitempty"`
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For each channel object, I can do a "custom" error channel? 🤔

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, for security reason. Potentially each channel is associated with an ACL and by default the error channel should have the same ACL. In practice, most channels send failed messages to a globally shared error channel but we need to allow for restricted channels.

Does that make sense to you?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, that makes sense.

}

// ChannelableStatus contains the Status of a Channelable object.
Expand Down Expand Up @@ -81,6 +88,15 @@ func (c *Channelable) Populate() {
ReplyURI: "sink2",
}},
}
c.Spec.ErrorChannel = &apisv1alpha1.Destination{
ObjectReference: &corev1.ObjectReference{
Name: "aname",
},
URI: &apis.URL{
Scheme: "http",
Host: "test-error-domain",
},
}
c.Status = ChannelableStatus{
AddressStatus: v1alpha1.AddressStatus{
Address: &v1alpha1.Addressable{
Expand Down
11 changes: 11 additions & 0 deletions pkg/apis/duck/v1alpha1/channelable_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"knative.dev/pkg/apis"
"knative.dev/pkg/apis/duck/v1alpha1"
duckv1beta1 "knative.dev/pkg/apis/duck/v1beta1"
apisv1alpha1 "knative.dev/pkg/apis/v1alpha1"

"github.com/google/go-cmp/cmp"
)
Expand Down Expand Up @@ -57,7 +58,17 @@ func TestChannelablePopulate(t *testing.T) {
}},
},
},
ErrorChannel: &apisv1alpha1.Destination{
ObjectReference: &corev1.ObjectReference{
Name: "aname",
},
URI: &apis.URL{
Scheme: "http",
Host: "test-error-domain",
},
},
},

Status: ChannelableStatus{
AddressStatus: v1alpha1.AddressStatus{
Address: &v1alpha1.Addressable{
Expand Down
6 changes: 6 additions & 0 deletions pkg/apis/duck/v1alpha1/zz_generated.deepcopy.go

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