Allow valid object references for Subscription's channel#1283
Conversation
We will do the check in the subscription controller
Harwayne
left a comment
There was a problem hiding this comment.
What happens if the spec.channel is not a subscribable? For example, a ClusterRole. What error is seen by the user?
Current version does not shown an error. I was planning on doing it in a follow up PR, but I think I should do it here before this is merged. As we cannot check for Subscribable, I'll add the label check with the CRD informer/lister in the controller, instead of the webhook. If you guys have a strong opinion of doing it in the webhook, please do let me know. |
|
The following is the coverage report on pkg/.
|
The easier thing may be to add a status condition, and mark it as failing if |
The code already does that. See here. I think I added those in a previous PR. |
|
The following is the coverage report on pkg/.
|
updating apiextensions lib.
|
The following is the coverage report on pkg/.
|
|
The following is the coverage report on pkg/.
|
|
The following is the coverage report on pkg/.
|
|
The following is the coverage report on pkg/.
|
|
@vaikas-google @Harwayne ready for a second pass. |
|
The following is the coverage report on pkg/.
|
| Subscribers []ChannelSubscriberSpec `json:"subscribers,omitempty" patchStrategy:"merge" patchMergeKey:"uid"` | ||
| } | ||
|
|
||
| // Subscribable is an Implementable "duck type". |
There was a problem hiding this comment.
I think we should create a new Duck Type that looks something like this:
type Channelable struct {
metav1.TypeMeta ...
metav1.ObjectMeta ...
Spec ChannelSpec ...
Status Addressable ...
}
So that we have one Duck type that allows us to create Subscriptions to it as well get the Addressable part, since a Channel is both so rather than muck with addressable and subscribable, we have a proper Channelable type that handles spec / status. I think Addressable might not be enough, since we might also need some kind of Subscriptions statuses wired through. If you think this is reasonable, let's create an issue to track this, unless we think this change might be useful to do now.
@Harwayne @n3wscott
There was a problem hiding this comment.
I agree we need this to make things cleaner.
IMO we can track it and do it in a follow up, but waiting to hear thoughts from the guys...
There was a problem hiding this comment.
fine with an issue, we need to relax this constraint to be able to use new channels, please generate an issue to track this work and I'm good.
|
The following is the coverage report on pkg/.
|
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: nachocano, vaikas-google The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Co-authored-by: Markus Thömmes <markusthoemmes@me.com>
Co-authored-by: Markus Thömmes <markusthoemmes@me.com>
* Rollback certificate algorithm changes (knative#1281) (knative#1283) Co-authored-by: Markus Thömmes <markusthoemmes@me.com> * mute noisy metrics * [SRVKS-790] Patch subresource to unblock webhooks on 4.9 (knative#1361) Co-authored-by: Markus Thömmes <markusthoemmes@me.com> Co-authored-by: Stavros Kontopoulos <skontopo@redhat.com>
* add patch of missing versions Signed-off-by: Ahmed Abdalla <aabdelre@redhat.com> * Patch 0.23 with missing API versions Signed-off-by: Ahmed Abdalla <aabdelre@redhat.com> * remove the patch, it's not needed in other versions Signed-off-by: Ahmed Abdalla <aabdelre@redhat.com> * Using pre-built image from OCP registry (#2) Signed-off-by: Matthias Wessendorf <mwessend@redhat.com> * Apply ko publish patch to here ... (#3) Signed-off-by: Matthias Wessendorf <mwessend@redhat.com> * One more thing.... (#4) Signed-off-by: Matthias Wessendorf <mwessend@redhat.com> * Add logs to understand rekt progress Signed-off-by: Ahmed Abdalla <aabdelre@redhat.com> * Adding back vendor patches (#5) * Rollback certificate algorithm changes (knative#1281) (knative#1283) Co-authored-by: Markus Thömmes <markusthoemmes@me.com> * mute noisy metrics * [SRVKS-790] Patch subresource to unblock webhooks on 4.9 (knative#1361) Co-authored-by: Markus Thömmes <markusthoemmes@me.com> Co-authored-by: Stavros Kontopoulos <skontopo@redhat.com> Co-authored-by: Matthias Wessendorf <mwessend@redhat.com> Co-authored-by: Markus Thömmes <markusthoemmes@me.com> Co-authored-by: Stavros Kontopoulos <skontopo@redhat.com>
Fixes #1283
Helps with #1216
Proposed Changes
spec.channeldoes not just allow the Channel kind (^Channel$), but also other kind of channels. Similarly withspec.reply.channel. Also removed the check for apiVersion equals to eventing.knative.dev/v1alpha1.channelconfigured is a valid object reference in the webhook, and perform more checks in the subscription controller. There, we check whether the channel CRD has themessaging.knative.dev/subscribablelabel set totrue. If no, then we return an error.Release Note