Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What's the role of BrokerSpec.Delivery outside mtbroker implementations? #4515

Closed
slinkydeveloper opened this issue Nov 12, 2020 · 14 comments
Closed
Assignees
Labels
area/delivery kind/bug Categorizes issue or PR as related to a bug. priority/awaiting-more-evidence Lowest priority. Possibly useful, but not yet enough support to actually get it done.

Comments

@slinkydeveloper
Copy link
Contributor

slinkydeveloper commented Nov 12, 2020

My understanding of BrokerSpec.Delivery documentation (https://github.com/knative/eventing/blob/master/pkg/apis/eventing/v1/broker_types.go#L77) is that it leaks the details of the mtbroker implementation:

// Delivery is the delivery specification for Events within the Broker mesh.

In fact this is used inside the broker controller to configure the subscription to internal channels https://github.com/knative/eventing/blob/master/pkg/reconciler/mtbroker/resources/subscription.go#L63. This should be decoupled from the spec itself, for example providing this delivery configuration through a config map and address it with BrokerSpec.Config (which is exactly the role of that field).

What this means outside the mtbroker implementation? How should we interpret it in other broker implementations?

E.g. this delivery spec, within the broker mesh, doesn't make sense in Kafka, because delivery spec (retries in particular) doesn't map to kafka semantics, where we have the at least once guaranteed by the protocol itself through coordination between sender and receiver (acks).

Additional Context

In case of eventing-kafka-broker we wrongly interpreted it and we use it as a "global default" of delivery for each trigger. If a trigger has a delivery spec, then use the trigger specific, otherwise use the global one, if any. I guess this probably has more sense as usage for this field.

How did you interpreted this field in gcp broker @grantr?

Proposals

  • Change the meaning to "defaulter" for trigger delivery spec
  • Remove it
@slinkydeveloper slinkydeveloper added the kind/bug Categorizes issue or PR as related to a bug. label Nov 12, 2020
@matzew
Copy link
Member

matzew commented Nov 12, 2020

E.g. this delivery spec, within the broker mesh, doesn't make sense in Kafka, because delivery spec (retries in particular) doesn't map to kafka semantics, where we have the at least once guaranteed by the protocol itself through coordination between sender and receiver (acks).

seems like imp detail that was exposed, to early ?

well, or for channel based brokers.. (unlike w/ Rabbit / Kafka broker)... but than the Broker type has no more direct ref w/ the Channels...

so that field feels "wrong"

@slinkydeveloper
Copy link
Contributor Author

slinkydeveloper commented Nov 12, 2020

Looping @pierDipi and @vaikas too in the discussion, which are working on the other broker impls

@lionelvillard
Copy link
Member

In case of eventing-kafka-broker we wrongly interpreted it and we use it as a "global default" of delivery for each trigger. If a trigger has a delivery spec, then use the trigger specific, otherwise use the global one, if any. I guess this probably has more sense as usage for this field.

that's the original intent.

@slinkydeveloper
Copy link
Contributor Author

slinkydeveloper commented Nov 12, 2020

that's the original intent.

If that's the case, then the doc is wrong/unclear and our usage in mtbroker is wrong too

@pierDipi
Copy link
Member

If a trigger has a delivery spec, then use the trigger specific, otherwise use the global one, if any.

Change the meaning to "defaulter" for trigger delivery spec

A trigger has no delivery spec.

If that's the case, then the doc is wrong/unclear and our usage in mtbroker is wrong too

This is related to this issue: #4057 (We should re-open it)

@grantr
Copy link
Contributor

grantr commented Nov 12, 2020

In GCP broker we interpret broker's delivery spec as a global default for all triggers attached to the broker (google/knative-gcp#1536). The backend is capable of per-trigger delivery specs, but we don't have an API that can set them.

We also have a configmap that sets a default delivery spec for all brokers (google/knative-gcp#1566).

We currently rely on PubSub to implement retry and dead letter policy. Some translation is required to get the generic delivery spec into a form supported by PubSub. This is explained in more detail in https://github.com/google/knative-gcp/blob/master/docs/spec/delivery.md.

  • PubSub only supports exponential backoff so we will reject the Linear backoff setting (Properly implement linear backoff in Broker delivery spec google/knative-gcp#1832).
  • We translate BackoffDelay and Backoff Policy to PubSub's minimum and maximum backoff values.
  • PubSub only supports topics as dead letter queues, so we define a custom URI scheme to specify topic names. Arbitrary dead letter sinks are not supported. It's possible to support them but it hasn't been a priority.

I haven't thought about it too carefully, but maybe it would be reasonable to define a DeliveryPolicy CRD with a webhook that applies its policy to triggers matching a selector, annotating the trigger with the specifics of the policy applied. This would allow for a default policy specification and leave the door open for alternate versions of that CRD that are implementation-specific.

@tommyreddad implemented all this so he's more expert than me on the details.

@vaikas
Copy link
Contributor

vaikas commented Nov 12, 2020

My $.02 here is, do we have a concrete use case for having a per trigger delivery spec that's different from a Broker specific. I know there's a lot of things we can do, but before complicating things by having various places to have this configured, want to make sure that we have a concrete use case (aka, somebody is trying to do something that they can't). I haven't heard anybody asking for it, which is not to say nobody's asked for it, but just asking.

@slinkydeveloper
Copy link
Contributor Author

slinkydeveloper commented Nov 13, 2020

In GCP broker we interpret broker's delivery spec as a global default for all triggers attached to the broker (google/knative-gcp#1536). The backend is capable of per-trigger delivery specs, but we don't have an API that can set them.

So I guess you misinterpreted like we did in eventing-kafka-broker 😄 . What should we do with this field then?

@slinkydeveloper
Copy link
Contributor Author

slinkydeveloper commented Nov 13, 2020

I haven't thought about it too carefully, but maybe it would be reasonable to define a DeliveryPolicy CRD with a webhook that applies its policy to triggers matching a selector, annotating the trigger with the specifics of the policy applied. This would allow for a default policy specification and leave the door open for alternate versions of that CRD that are implementation-specific.

TBH this sounds like a next step to the simpler solution of supporting Delivery in trigger, which should be pretty much straightforward to implement for all broker implementations i know out there. Although this is not the point of this issue, so maybe can we open a new one for that? I'm interested in this too.

@grantr grantr added area/delivery priority/awaiting-more-evidence Lowest priority. Possibly useful, but not yet enough support to actually get it done. labels Nov 16, 2020
@lberk
Copy link
Member

lberk commented Dec 14, 2020

@slinkydeveloper have you gotten answers to your questions above? Should we open a new issue to track the different issue as you described?

@slinkydeveloper
Copy link
Contributor Author

I think we still didn't agreed on this issue, let me go through it at today eventing delivery wg

slinkydeveloper added a commit to slinkydeveloper/eventing that referenced this issue Dec 15, 2020
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
slinkydeveloper added a commit to slinkydeveloper/eventing that referenced this issue Jan 18, 2021
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
slinkydeveloper added a commit to slinkydeveloper/eventing that referenced this issue Jan 26, 2021
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
knative-prow-robot pushed a commit that referenced this issue Feb 1, 2021
* Propose #4515

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Suggestions

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Little change to the spec

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Better comment

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Update codegen

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Updated yamls

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Removed default word
Added more wording in the spec

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Added the delivery field to v1beta1 spec too

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
@vaikas
Copy link
Contributor

vaikas commented Feb 1, 2021

@slinkydeveloper can this be closed now?

@slinkydeveloper
Copy link
Contributor Author

No, need to implement the change to the mtbroker

@slinkydeveloper
Copy link
Contributor Author

/assign

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/delivery kind/bug Categorizes issue or PR as related to a bug. priority/awaiting-more-evidence Lowest priority. Possibly useful, but not yet enough support to actually get it done.
Projects
None yet
Development

No branches or pull requests

7 participants