adding one more idea to the filter#1176
Conversation
|
/assign @grantr |
|
/approve cancel |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: If they are not already assigned, you can assign the PR to them by writing 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 |
grantr
left a comment
There was a problem hiding this comment.
Let's definitely add this to the doc, because it's an interesting thought experiment. Here are my thoughts:
My impression of the Broker/Trigger model is that its value comes from its opinions. The opinions baked into Broker/Trigger have benefits for users and contributors: users have their basic needs met immediately and are guided along one particular, well-supported path, and contributors scope down the set of problems to only the chosen ones. Those outside the scope of the opinions chosen may need to implement their own path, but that's always possible with Channel and Subscription, which were intentionally designed to have as few opinions as possible (though they still have some opinions).
The proposal to give Trigger a URI filter basically makes Trigger equivalent to a Subscription. Since the proposal also makes the Trigger object an internal detail, I think we can s/Trigger/Subscription/ here.
Now the proposal is basically two parts:
- Implement Trigger filtering internally by forwarding events to a function.
- Create CRDs (one of which is proposed here) that encapsulate the choice of filtering behavior so users don't need to deal with writing and deploying and hooking up their own filtering functions.
This is interesting and elegant, but I think it will make Trigger more difficult to implement because the Broker can't assume anything about how the Trigger will behave. The Broker must send every event to each Trigger function always, and that removes the ability to optimize the Broker's implementation, which is the principal value of Broker over Channel as described above.
I think (but could be wrong) that the only possible implementation of this is a single Channel with one Subscription per Trigger. If that's true, I think there's no reason to make Trigger work this way, because it's exactly what Channel and Subscription already provide.
I suppose this proposal could be extended to add a BrokerCEL that knows how TriggerCEL works (or assumes it knows) and can optimize for that, but then we're back to the current (with #1047) Broker and Trigger.
| Another option could be to continue to use the orignal subscription filter | ||
| function to allow for advanced filters without directly depending on CEL. | ||
|
|
||
| Allow for the base trigger to take `spec.filter.uri` or `spec.fitler.ref`. Ref |
| Allow for the base trigger to take `spec.filter.uri` or `spec.fitler.ref`. Ref | ||
| would be _addressable_ and resolve to a uri. | ||
|
|
||
| The data plane contact of the filer uri/ref would be the same as subscriptions. |
| _Addressable_ resource. | ||
|
|
||
| The side effect is CEL becomes an add-on. If we use services, we can use | ||
| servings.service revisions for versioning. |
There was a problem hiding this comment.
This allows versioning the filtering code, but it doesn't solve the problem of versioning the CEL expression format. How would TriggerCEL specify which version of the CEL filtering Service it wanted to use? I think this is the same problem #1047 has with CEL versioning (the solution given there was to bump the CRD version when the CEL format changes).
evankanderson
left a comment
There was a problem hiding this comment.
Trigger dispatch to a function feels expensive and possibly a better fit for a simple Pipeline (#1067), rather than a built-in Trigger primitive.
In particular, I'm concerned how adding this option might interact with other optimizations like batching, authorization, and protocol negotiation.
Co-Authored-By: n3wscott <32305648+n3wscott@users.noreply.github.com>
|
So there's good news and bad news. 👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there. 😕 The bad news is that it appears that one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request. Note to project maintainer: This is a terminal state, meaning the ℹ️ Googlers: Go here for more info. |
|
So there's good news and bad news. 👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there. 😕 The bad news is that it appears that one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request. Note to project maintainer: This is a terminal state, meaning the ℹ️ Googlers: Go here for more info. |
| ```yaml | ||
| kind: TriggerCEL | ||
| spec: | ||
| filter: > |
There was a problem hiding this comment.
Here spec.filter is a string, above it is an object. Can it be both?
There was a problem hiding this comment.
This is the TriggerCEL spec. The above Trigger spec is a different definition, IIUC.
There was a problem hiding this comment.
Ahh, thank you for pointing that out.
| ``` | ||
|
|
||
| Then, we make a TriggerCEL that is exactly the same as the above proposal with | ||
| the chance in resource name. |
| ```yaml | ||
| kind: TriggerCEL | ||
| spec: | ||
| filter: > |
There was a problem hiding this comment.
Ahh, thank you for pointing that out.
|
@n3wscott I'm closing this one. I've heard this from others in the meantime that they like this approach, so I'm sure it will come up when when we revisit advanced filtering. 😺 |
Add functions as a base idea to triggers and how it could support CEL.