Let's discuss about multi-tenant receive adapters!
Problem Statement
Single-tenant receive adapters handle only one source (CO) at a time, i.e. there is a one-to-one mapping between receive adapter and source specification. While this architecture works well for high volume, always "on" event sources, it is not optimal (i.e. waste precious resources, cpu and memory) for sources producing "fewer" events, such as PingSource, APIServerSource and GitHubSource.
Proposed Solution
Add support for multi-tenant receive adapters capable of handling more than one source.
I feel that there is a general agreement on the need to support both architectures. If you think otherwise, please add a comment below.
Assuming we (as a community) decide to support both single-tenant and multi-tenant receive adapters, here some of the questions that need to be answered:
Let's discuss. @grantr @n3wscott @nachocano @vaikas @matzew @antoineco @sebgoa @davyodom @akashrv @duglin
Exit Criteria
a document recording any decisions made here.
Related PR/issues
I think it makes a lot of sense, kudos for suggesting this 馃憤
A few challenges I can envision:
For push based, at a first glance at least, seems fairly similar to what the Broker is already doing routing the events based off of a triggers/XXX/yyy. We should try to leverage work there as well as not duplicate this and hoist the common bits into something reusable.
I feel that there is a general agreement on the need to support both architectures.
Agree, i see how the single receive adapter model it's a waste of resources for "webhook/notifications" like events from external systems like GH. On the other side of the spectrum, I think it works pretty well with queue event sources like kafka, aws sqs and so on.
What I wish to understand is: what is the line between
Where do we put the multi-tenant code? Along side with the single-tenant code or in a separate repo?
It would be awesome if they share most of the code, but maybe this won't be always possible
@antoineco
We did this by ...
Are you saying you have mt source adapters?
For push-based, this seems to be a recurring pattern, for the broker and also for the MT Github adapter (https://github.com/knative/eventing-contrib/pull/1148)
No, I'm just saying we had a similar problem with multi-tenancy and secrets.
I have one question - I could imagine how the single-tenancy is fine enough for kafkasource right now but wouldn't the single kafkasource deployment for one serverless app an overhead here too, while comparing it to a single kafkasource deployment (for a namespace or the cluster) for all the serverless apps?
For example, I have 3 apps that I am deploying through knative and for them to get requests from kafka I'd need to deploy 3 kafkasource deployments - one service as a sink in each kafkasource. I am wondering now, whats the point of my apps scaling down to 0 if there are additional 3 controllers taking CPU and memory which I wanted to reduce from the starting?
We talked about this during last week source WG meeting. Here the main points:
On the first point, what about reversing the statement: Move to cluster scoped-mt, option to have a namespace-scoped Mt in the near future, to be consistent with the rest of Knative.
We discussed to initially add this option in a ConfigMap and later on maybe provide an annotation on the namespace or CR. First we need to collect use cases.
@n3wscott @vaikas @nachocano Does that sound good to you? Did I miss something?
@Shashankft9 you got this right. Thanks a lot for you feedback!
We talked about this during last week source WG meeting. Here the main points:
- Move to namespaced-mt, option to have a cluster scoped Mt in the future
- Anti-pattern to have 1:1 adapter to resource.
On the first point, what about reversing the statement: Move to cluster scoped-mt, option to have a namespace-scoped Mt in the near future, to be consistent with the rest of Knative.
We discussed to initially add this option in a ConfigMap and later on maybe provide an annotation on the namespace or CR. First we need to collect use cases.
@n3wscott @vaikas @nachocano Does that sound good to you? Did I miss something?
SGTM. I'll create a tracking issue in knative-gcp as well because we are interested in this for our Google sources. Hope to be able to work on this sometime soon.
Yes sounds good. No option to have 1:1 in same namespace. Always namespace Mt 馃槄, option in the future to have cluster mt
I updated the PR accordingly, except that we need the option today.
we have an initial plan.