Skip to content

adding one more idea to the filter#1176

Closed
n3wscott wants to merge 2 commits into
knative:masterfrom
n3wscott:celtrigger
Closed

adding one more idea to the filter#1176
n3wscott wants to merge 2 commits into
knative:masterfrom
n3wscott:celtrigger

Conversation

@n3wscott
Copy link
Copy Markdown
Contributor

@n3wscott n3wscott commented May 7, 2019

Add functions as a base idea to triggers and how it could support CEL.

@googlebot googlebot added the cla: yes Indicates the PR's author has signed the CLA. label May 7, 2019
@knative-prow-robot knative-prow-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels May 7, 2019
@n3wscott
Copy link
Copy Markdown
Contributor Author

n3wscott commented May 7, 2019

/assign @grantr

@n3wscott
Copy link
Copy Markdown
Contributor Author

n3wscott commented May 7, 2019

/approve cancel

@knative-prow-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
To fully approve this pull request, please assign additional approvers.
We suggest the following additional approver: grantr

If they are not already assigned, you can assign the PR to them by writing /assign @grantr in a comment when ready.

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow-robot knative-prow-robot removed the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 7, 2019
Copy link
Copy Markdown
Contributor

@grantr grantr left a comment

Choose a reason for hiding this comment

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

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.

Comment thread docs/broker/filtering.md Outdated
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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

spec.filter.ref

Comment thread docs/broker/filtering.md
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.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

contract and filter uri/ref

Comment thread docs/broker/filtering.md
_Addressable_ resource.

The side effect is CEL becomes an add-on. If we use services, we can use
servings.service revisions for versioning.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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).

Copy link
Copy Markdown
Member

@evankanderson evankanderson left a comment

Choose a reason for hiding this comment

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

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.

Comment thread docs/broker/filtering.md Outdated
Co-Authored-By: n3wscott <32305648+n3wscott@users.noreply.github.com>
@googlebot
Copy link
Copy Markdown

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 cla/google commit status will not change from this state. It's up to you to confirm consent of all the commit author(s), set the cla label to yes (if enabled on your project), and then merge this pull request when appropriate.

ℹ️ Googlers: Go here for more info.

@googlebot googlebot added cla: no Indicates the PR's author has not signed the CLA. and removed cla: yes Indicates the PR's author has signed the CLA. labels May 8, 2019
@googlebot
Copy link
Copy Markdown

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 cla/google commit status will not change from this state. It's up to you to confirm consent of all the commit author(s), set the cla label to yes (if enabled on your project), and then merge this pull request when appropriate.

ℹ️ Googlers: Go here for more info.

Comment thread docs/broker/filtering.md
```yaml
kind: TriggerCEL
spec:
filter: >
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Here spec.filter is a string, above it is an object. Can it be both?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is the TriggerCEL spec. The above Trigger spec is a different definition, IIUC.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ahh, thank you for pointing that out.

Comment thread docs/broker/filtering.md
```

Then, we make a TriggerCEL that is exactly the same as the above proposal with
the chance in resource name.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

chance -> change?

Comment thread docs/broker/filtering.md
```yaml
kind: TriggerCEL
spec:
filter: >
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ahh, thank you for pointing that out.

@grantr
Copy link
Copy Markdown
Contributor

grantr commented Aug 29, 2019

@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. 😺

@grantr grantr closed this Aug 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: no Indicates the PR's author has not signed the CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants